Automatically toggle sleep on screen close when active monitor changed
This commit is contained in:
parent
4d6f939554
commit
cd723f98cb
|
@ -11,12 +11,14 @@ while true; do
|
||||||
if [ "$(xrandr --nograb --current | grep '^DP-1 connected')" ]; then
|
if [ "$(xrandr --nograb --current | grep '^DP-1 connected')" ]; then
|
||||||
echo "Display Switcher: switching to external display"
|
echo "Display Switcher: switching to external display"
|
||||||
active_display="external"
|
active_display="external"
|
||||||
|
doas sysctl machdep.lidaction=0
|
||||||
xrandr --output DP-1 --auto --dpi 224 --output eDP-1 --off
|
xrandr --output DP-1 --auto --dpi 224 --output eDP-1 --off
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$(xrandr --nograb --current | grep '^DP-1 disconnected')" ]; then
|
if [ "$(xrandr --nograb --current | grep '^DP-1 disconnected')" ]; then
|
||||||
echo "Display Switcher: switching to internal display"
|
echo "Display Switcher: switching to internal display"
|
||||||
active_display="internal"
|
active_display="internal"
|
||||||
|
doas sysctl machdep.lidaction=1
|
||||||
xrandr --output eDP-1 --auto --dpi 176 --output DP-1 --off
|
xrandr --output eDP-1 --auto --dpi 176 --output DP-1 --off
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue