Skip to content

Instantly share code, notes, and snippets.

@obfusk

obfusk/xrandr-fu.bash

Last active Sep 7, 2017
Embed
What would you like to do?
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