diff --git a/i3/auto_monitor.sh b/i3/auto_monitor.sh index 398a42f..e138d57 100755 --- a/i3/auto_monitor.sh +++ b/i3/auto_monitor.sh @@ -10,13 +10,53 @@ set -e HDMI_STATUS=$(> /tmp/udev_test +OUT2="eDP-1" if [ "connected" == "$HDMI_STATUS" ]; then + xrandr >> /tmp/udev_test /usr/bin/xrandr --output eDP-1 --auto --left-of HDMI-1 - /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "HDMI plugged in" + /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "HDMI-1 plugged in" + echo "HDMI connected" >> /tmp/udev_test + xrandr >> /tmp/udev_test + OUT2="HDMI-1" else /usr/bin/xrandr --output HDMI-1 --off - /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor disconnected" - exit + /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor (HDMI-1) disconnected" + echo "HDMI disconnected" >> /tmp/udev_test fi + +if [ "connected" == "$HDMI2_STATUS" ]; then + xrandr >> /tmp/udev_test + /usr/bin/xrandr --output eDP-1 --auto --left-of HDMI-2 + /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "HDMI-2 plugged in" + echo "HDMI-2 connected" >> /tmp/udev_test + xrandr >> /tmp/udev_test + OUT2="HDMI-2" +else + /usr/bin/xrandr --output HDMI-2 --off + /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor (HDMI-2) disconnected" + echo "HDMI disconnected" >> /tmp/udev_test +fi + +if [ "connected" == "$DP_STATUS" ]; then + xrandr >> /tmp/udev_test + /usr/bin/xrandr --output eDP-1 --auto --right-of DP-1 + /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "DP-1 plugged in" + echo "DP connected" >> /tmp/udev_test + xrandr >> /tmp/udev_test + OUT2="DP-1" +else + /usr/bin/xrandr --output DP-1 --off + /usr/bin/notify-send --urgency=low -t 5000 "Graphics Update" "External monitor (DP-1) disconnected" + echo "DP disconnected" >> /tmp/udev_test +fi +sed 's/^set\s\s*$OUTPUT_EVEN\s.*/set $OUTPUT_EVEN '$OUT2'/' -i "$I3CONFIG" +i3-msg [workspace=2] move workspace to output $OUT2 +i3-msg [workspace=4] move workspace to output $OUT2 +i3-msg [workspace=6] move workspace to output $OUT2 +i3-msg reload diff --git a/i3/i3config b/i3/i3config index 0b7e8cd..2b5af76 100644 --- a/i3/i3config +++ b/i3/i3config @@ -8,6 +8,8 @@ # i3 config file (v4) # # Please see http://i3wm.org/docs/userguide.html for a complete reference! +set $OUTPUT_ODD eDP-1 +set $OUTPUT_EVEN eDP-1 set $mod Mod4 @@ -106,15 +108,25 @@ bindsym $mod+0 workspace 10 # move focused container to workspace bindsym $mod+Shift+1 move container to workspace 1 +bindsym $mod+ctrl+1 move container to workspace 1 bindsym $mod+Shift+2 move container to workspace 2 +bindsym $mod+ctrl+2 move container to workspace 2 bindsym $mod+Shift+3 move container to workspace 3 +bindsym $mod+ctrl+3 move container to workspace 3 bindsym $mod+Shift+4 move container to workspace 4 +bindsym $mod+ctrl+4 move container to workspace 4 bindsym $mod+Shift+5 move container to workspace 5 +bindsym $mod+ctrl+5 move container to workspace 5 bindsym $mod+Shift+6 move container to workspace 6 +bindsym $mod+ctrl+6 move container to workspace 6 bindsym $mod+Shift+7 move container to workspace 7 +bindsym $mod+ctrl+7 move container to workspace 7 bindsym $mod+Shift+8 move container to workspace 8 +bindsym $mod+ctrl+8 move container to workspace 8 bindsym $mod+Shift+9 move container to workspace 9 +bindsym $mod+ctrl+9 move container to workspace 9 bindsym $mod+Shift+0 move container to workspace 10 +bindsym $mod+ctrl+0 move container to workspace 10 # reload the configuration file bindsym $mod+Shift+c exec "i3-msg reload && /usr/bin/notify-send -t 5000 --urgency=low 'Reload' 'Reloaded i3 config'" @@ -150,6 +162,16 @@ mode "resize" { bindsym $mod+r mode "resize" +mode "moveit" { + bindsym Up move up 20px + bindsym Left move left 20px + bindsym Down move down 20px + bindsym Right move right 20px + bindsym $mod+m mode "default" + bindsym Escape mode "default" +} +bindsym $mod+m focus floating; mode "moveit" + # Sound bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master 5%+ unmute bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%- unmute @@ -195,11 +217,16 @@ hide_edge_borders both # Change monitor mirroring bindsym XF86Display exec --no-startup-id "/usr/local/bin/switch_monitors.sh" +bindsym Shift+XF86Display exec --no-startup-id "/usr/local/bin/switch_monitors.sh mirror" # pdfpc assign [class="Pdfpc" window_role="presenter"] 1 assign [class="Pdfpc" window_role="presentation"] 2 # multi monitor -workspace 1 output eDP-1 -workspace 2 output HDMI-1 +workspace 1 output $OUTPUT_ODD +workspace 2 output $OUTPUT_EVEN +workspace 3 output $OUTPUT_ODD +workspace 4 output $OUTPUT_EVEN +workspace 5 output $OUTPUT_ODD +workspace 6 output $OUTPUT_EVEN diff --git a/i3/switch_monitors.sh b/i3/switch_monitors.sh index 15be527..01a5a94 100755 --- a/i3/switch_monitors.sh +++ b/i3/switch_monitors.sh @@ -11,6 +11,9 @@ HDMI_STATUS=$( /tmp/monitor