Created
May 25, 2019 02:38
-
-
Save G33kDude/623f53a860e3f4d42421b8b80af39724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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