Merge commit 'd1e8697ba619ce14cbc0580da0d607e5ccff8c72'
This commit is contained in:
@@ -10,13 +10,53 @@
|
||||
set -e
|
||||
|
||||
HDMI_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-1/status )
|
||||
HDMI2_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-2/status )
|
||||
DP_STATUS=$(</sys/class/drm/card0/card0-DP-1/status )
|
||||
I3CONFIG=/home/fabian/i3/i3config
|
||||
|
||||
|
||||
echo "Rule run" >> /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
|
||||
|
||||
31
i3/i3config
31
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
|
||||
|
||||
@@ -11,6 +11,9 @@ HDMI_STATUS=$(</sys/class/drm/card0/card0-HDMI-A-1/status )
|
||||
|
||||
HDMI_ENABLED=$(</sys/class/drm/card0/card0-HDMI-A-1/enabled)
|
||||
|
||||
DP_STATUS=$(</sys/class/drm/card0/card0-DP-1/status )
|
||||
DP_ENABLED=$(</sys/class/drm/card0/card0-DP-1/enabled )
|
||||
|
||||
# Check to see if our state log exists
|
||||
if [ ! -f /tmp/monitor ]; then
|
||||
touch /tmp/monitor
|
||||
@@ -22,15 +25,41 @@ fi
|
||||
# The state log has the NEXT state to go to in it
|
||||
|
||||
# If monitors are disconnected, stay in state 1
|
||||
if [ "disconnected" == "$HDMI_STATUS" -a "disconnected" == "$VGA_STATUS" ]; then
|
||||
STATE=1
|
||||
if [ "disconnected" == "$HDMI_STATUS" -a "disconnected" == "$DP_STATUS" ]; then
|
||||
STATE=5
|
||||
fi
|
||||
|
||||
if [ $1 == "mirror" ]; then
|
||||
if [ $STATE == 4 ]; then
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Mirror Stuff from $STATE to 5"
|
||||
# eDP-1 is on, projectors are mirroring
|
||||
if [ "connected" == "$HDMI_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --same-as eDP-1
|
||||
TYPE="HDMI"
|
||||
elif [ "connected" == "$DP_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --same-as eDP-1
|
||||
TYPE="DP-1"
|
||||
fi
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE mirroring"
|
||||
STATE=5
|
||||
else
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Mirror Stuff from $STATE to 4"
|
||||
# eDP-1 is on, projectors are extending
|
||||
if [ "connected" == "$HDMI_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --right-of eDP-1
|
||||
TYPE="HDMI"
|
||||
elif [ "connected" == "$DP_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --left-of eDP-1
|
||||
TYPE="DP-1"
|
||||
fi
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE extending"
|
||||
STATE=4
|
||||
fi
|
||||
else
|
||||
TYPE="eDP-1"
|
||||
case $STATE in
|
||||
1)
|
||||
# eDP-1 is on, projectors not connected
|
||||
/usr/bin/xrandr --output eDP-1 --auto
|
||||
TYPE="eDP-1"
|
||||
STATE=2
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE"
|
||||
;;
|
||||
@@ -46,6 +75,9 @@ case $STATE in
|
||||
if [ "connected" == "$HDMI_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --off --output HDMI-1 --auto
|
||||
TYPE="HDMI"
|
||||
elif [ "connected" == "$DP_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --off --output HDMI-1 --off --output DP-1 --auto
|
||||
TYPE="DP-1"
|
||||
fi
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE"
|
||||
STATE=4
|
||||
@@ -53,8 +85,11 @@ case $STATE in
|
||||
4)
|
||||
# eDP-1 is on, projectors are mirroring
|
||||
if [ "connected" == "$HDMI_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --same-as eDP-1
|
||||
TYPE="HDMI"
|
||||
elif [ "connected" == "$DP_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --same-as eDP-1
|
||||
TYPE="DP-1"
|
||||
fi
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE mirroring"
|
||||
STATE=5
|
||||
@@ -64,6 +99,9 @@ case $STATE in
|
||||
if [ "connected" == "$HDMI_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --auto --right-of eDP-1
|
||||
TYPE="HDMI"
|
||||
elif [ "connected" == "$DP_STATUS" ]; then
|
||||
/usr/bin/xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --auto --left-of eDP-1
|
||||
TYPE="DP-1"
|
||||
fi
|
||||
/usr/bin/notify-send -t 5000 --urgency=low "Graphics Update" "Switched to $TYPE extending"
|
||||
STATE=2
|
||||
@@ -72,5 +110,6 @@ case $STATE in
|
||||
# Unknown state, assume we're in 1
|
||||
STATE=1
|
||||
esac
|
||||
fi
|
||||
|
||||
echo $STATE > /tmp/monitor
|
||||
|
||||
Reference in New Issue
Block a user