Created
December 14, 2014 21:48
-
-
Save dromer/55f88a0acf6a8d4fc6c5 to your computer and use it in GitHub Desktop.
thinkpad dock change script
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/sh | |
exec >/home/dreamer/udev.out 2>&1 | |
# wait for the dock state to change | |
sleep 0.5 | |
DOCKED=$(cat /sys/devices/platform/dock.2/docked) | |
export XAUTHORITY=/home/dreamer/.Xauthority | |
export DISPLAY=:0 | |
case "$DOCKED" in | |
"0") | |
#undocked event - lets remove all connected outputs apart from LVDS | |
for output in $(/usr/bin/xrandr -d :0.0 --verbose|grep " connected"|grep -v LVDS|awk '{print $1}') | |
do | |
/usr/bin/xrandr -d :0.0 --output $output --off | |
done | |
;; | |
"1") | |
#docked event - sample will created extended desktop with DVI1 to the right of LVDS1 | |
#/usr/bin/xrandr -d :0.0 --output DVI1 --right-of LVDS1 --auto | |
xrandr --output HDMI1 --off --output LVDS1 --mode 1280x800 --pos 0x280 --rotate normal --output DP1 --off --output VGA1 --mode tvscreen --pos 1280x0 --rotate normal | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment