Skip to content

Instantly share code, notes, and snippets.

@erhan-
Created March 12, 2013 12:58
Show Gist options
  • Save erhan-/5142679 to your computer and use it in GitHub Desktop.
Save erhan-/5142679 to your computer and use it in GitHub Desktop.
Autorotater for thinkpad x200 tablet under arch linux
#!/bin/bash
# Working autorotate on thinkpad x200 tablet
rstate="0"
while [ true ]
do
react=`grep 0 -c /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode`
if (( ($react == "1") && ($rstate=="1") )); then
/usr/bin/xrandr -o normal
xsetwacom set "Serial Wacom Tablet WACf008 stylus" Rotate none
xsetwacom set "Serial Wacom Tablet WACf008 eraser" Rotate none
xsetwacom set "Serial Wacom Tablet WACf008 touch" Rotate none
rstate="0"
fi
if (( ($react != "1") && (rstate == "0") )); then
/usr/bin/xrandr -o right
xsetwacom set "Serial Wacom Tablet WACf008 stylus" Rotate cw
xsetwacom set "Serial Wacom Tablet WACf008 eraser" Rotate cw
xsetwacom set "Serial Wacom Tablet WACf008 touch" Rotate cw
rstate="1"
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment