Skip to content

Instantly share code, notes, and snippets.

@Apsu
Created January 2, 2013 21:37
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 Apsu/4438344 to your computer and use it in GitHub Desktop.
Save Apsu/4438344 to your computer and use it in GitHub Desktop.
/usr/lib/udev/display dynamic xrandrerer
#!/bin/zsh
for i in /sys/class/drm/card0-*/status; do
d="${${${i#*-}%/*}/(-?-|-)}"
if [[ "$d" == "LVDS1" ]]; then
t="--output LVDS1 --auto --primary$t"
elif [[ "$(<$i)" == "connected" ]]; then
t="$t --output $d --auto --left-of LVDS1"
else
t="$t --output $d --off"
fi
done
doit() {
DISPLAY=:0 XAUTHORITY=/home/apsu/.Xauthority xrandr $*
}
doit $(echo $t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment