Created
August 23, 2012 05:40
-
-
Save Apsu/3433074 to your computer and use it in GitHub Desktop.
drm udev rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="display" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
The 10-display.rules file goes in /etc/udev/rules.d
The display file goes in /lib/udev