dotfiles/.local/bin/tools/togglemonitor

8 lines
296 B

#!/bin/sh
# toggle external monitor
intern=LVDS-1
extern=HDMI-1
(xrandr | grep "$extern disconnected") && exit
(xrandr --listactivemonitors | grep $extern) || (xrandr --output $extern --right-of $intern --auto & exit)
(xrandr --listactivemonitors | grep $extern) && xrandr --output $extern --off