From 9e0dcf47292e7eb5dd112d9fe89f40550bc9fd0c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 14 Dec 2013 23:05:44 +0100 Subject: [PATCH] add script to rotate display on ibm x41t Signed-off-by: Nico Schottelius --- rotate-display.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 rotate-display.sh diff --git a/rotate-display.sh b/rotate-display.sh new file mode 100644 index 0000000..3e93385 --- /dev/null +++ b/rotate-display.sh @@ -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 +