nsbin/rotate-display.sh
Nico Schottelius 9e0dcf4729 add script to rotate display on ibm x41t
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-12-14 23:05:44 +01:00

27 lines
596 B
Bash

#!/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