Skip to content

Instantly share code, notes, and snippets.

@ryochack
Created November 18, 2017 00:55
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 ryochack/0c3036b03dbe54005981517ef1c155e5 to your computer and use it in GitHub Desktop.
Save ryochack/0c3036b03dbe54005981517ef1c155e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# https://wiki.archlinuxjp.org/index.php/Xrandr#.E3.82.B9.E3.82.AF.E3.83.AA.E3.83.97.E3.83.88
MAIN="LVDS-1"
EXT="VGA-1"
if (xrandr | grep -q "$EXT disconnected"); then
xrandr --output $MAIN --auto --output $EXT --off
else
xrandr --output $MAIN --auto --primary --output $EXT --auto --above $MAIN
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment