Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active September 7, 2017 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obfusk/cd99740e5562197908e7 to your computer and use it in GitHub Desktop.
Save obfusk/cd99740e5562197908e7 to your computer and use it in GitHub Desktop.
use xrandr to enable only HDMI1 if connected, LVDS1 otherwise | OBSOLETE; see https://github.com/obfusk/dotfiles
#!/bin/bash
if xrandr | grep -q HDMI-1; then
hdmi=HDMI-1 lvds=LVDS-1
else
hdmi=HDMI1 lvds=LVDS1
fi
if xrandr | grep ' connected' | grep -q $hdmi; then
if [ "$1" = both -o "$1" = both_low ]; then
xrandr --output $hdmi --primary --auto \
--output $lvds --auto --right-of $hdmi
else
xrandr --output $hdmi --primary --auto --output $lvds --off
fi
else
xrandr --output $lvds --primary --auto --output $hdmi --off
fi
if [ "$1" = both_low ]; then
xbacklight -set 7
else
xbacklight -set 100
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment