Created
May 22, 2013 13:58
-
-
Save menski/5627724 to your computer and use it in GitHub Desktop.
udev montior hot-pluging
This file contains hidden or 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", RUN+="/usr/local/bin/hotplug_monitor.sh" |
This file contains hidden or 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/bash | |
export DISPLAY=:0.0 | |
export XAUTHORITY=/home/menski/.Xauthority | |
INTERN="LVDS1" | |
EXTERN="DP1" | |
BEAMER="VGA1" | |
MODE="${1-1024x768}" | |
XRANDR="$(xrandr -q)" | |
if [[ $XRANDR =~ "$EXTERN connected" ]]; then | |
xrandr --output $INTERN --off --output $EXTERN --auto | |
elif [[ $XRANDR =~ "$BEAMER connected" ]]; then | |
xrandr --output $INTERN --mode $MODE --output $BEAMER --same-as $INTERN --mode $MODE >> /tmp/hotplug.txt 2>&1 | |
else | |
xrandr --output $EXTERN --off --output $BEAMER --off --output $INTERN --auto | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment