Skip to content

Instantly share code, notes, and snippets.

@rkfg
Created September 3, 2018 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkfg/eb06ff29346cb2bab81b3afdb17efffd to your computer and use it in GitHub Desktop.
Save rkfg/eb06ff29346cb2bab81b3afdb17efffd to your computer and use it in GitHub Desktop.
Display switcher
#!/bin/sh
DISPLAY=:0
MAIN=DVI-D-0
TV=HDMI-0
if xrandr --listactivemonitors | grep -q "$MAIN"
then
xrandr --output "$MAIN" --off
xrandr --output "$TV" --auto
else
xrandr --output "$TV" --off
xrandr --output "$MAIN" --auto
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment