Skip to content

Instantly share code, notes, and snippets.

@G33kDude
Created May 25, 2019 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save G33kDude/623f53a860e3f4d42421b8b80af39724 to your computer and use it in GitHub Desktop.
Save G33kDude/623f53a860e3f4d42421b8b80af39724 to your computer and use it in GitHub Desktop.
#!/bin/bash
old="0"
while true; do
if [[ -e /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode ]]; then
new=`cat /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode`
if [[ $new != $old ]]; then
if [[ $new == "1" ]]; then
echo "Rotate to landscape"
xsetwacom set "Wacom Serial Penabled Pen stylus" rotate half
xrandr -o left # Workaround for DE bug
xrandr -o inverted
elif [[ $new == "0" ]]; then
echo "Rotate to portrait"
xsetwacom set "Wacom Serial Penabled Pen stylus" rotate none
xrandr -o right # Workaround for DE bug
xrandr -o normal
fi
fi
old=$new
sleep 1s
fi
done
# From Red_Lion post #576: http://ubuntuforums.org/showthread.php?t=845911&page=58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment