add script to rotate display on ibm x41t

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-12-14 23:05:44 +01:00
parent 45198add2b
commit 9e0dcf4729
1 changed files with 27 additions and 0 deletions

27
rotate-display.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/sh
mode_path=/sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode
# 0 = normal
# 1 = tablet
mode=$(cat $mode_path)
if [ $mode = 1 ]; then
mode=inverted
else
mode=normal
fi
current=$(xrandr | awk '/LVDS1/ { print $4 }' | sed 's/(//')
# Do not change anything if already ok
[ $current = $mode ] && exit 0
if [ "$mode" = inverted ]; then
xinput --set-prop 'Serial Wacom Tablet WACf004 stylus' 'Wacom Rotation' 3
xrandr --output LVDS1 --rotate inverted
else
xinput --set-prop 'Serial Wacom Tablet WACf004 stylus' 'Wacom Rotation' 0
xrandr --output LVDS1 --rotate normal
fi