Created
July 14, 2014 21:07
-
-
Save h4cc/61734456d7bc760b13f0 to your computer and use it in GitHub Desktop.
Script for rotating the screen on my Thinkpad X200T.
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/sh | |
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. | |
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')" | |
# Using current screen orientation proceed to rotate screen and input devices. | |
case "$rotation" in | |
normal) | |
# rotate to the left | |
xrandr -o left | |
xsetwacom set "Serial Wacom Tablet stylus" rotate ccw | |
xsetwacom set "Serial Wacom Tablet eraser" rotate ccw | |
xsetwacom set "TPPS/2 IBM TrackPoint" rotate ccw | |
;; | |
left) | |
# rotate to inverted | |
xrandr -o inverted | |
xsetwacom set "Serial Wacom Tablet stylus" rotate half | |
xsetwacom set "Serial Wacom Tablet eraser" rotate half | |
xsetwacom set "TPPS/2 IBM TrackPoint" rotate half | |
;; | |
inverted) | |
# rotate to the right | |
xrandr -o right | |
xsetwacom set "Serial Wacom Tablet stylus" rotate cw | |
xsetwacom set "Serial Wacom Tablet eraser" rotate cw | |
xsetwacom set "TPPS/2 IBM TrackPoint" rotate cw | |
;; | |
right) | |
# rotate to normal | |
xrandr -o normal | |
xsetwacom set "Serial Wacom Tablet stylus" rotate none | |
xsetwacom set "Serial Wacom Tablet eraser" rotate none | |
xsetwacom set "TPPS/2 IBM TrackPoint" rotate none | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I created a slightly improved variant, to be found on https://gist.github.com/antiguru/3cb11dc5f92a4ebd115d. Thanks for providing the script!