-
-
Save antiguru/3cb11dc5f92a4ebd115d to your computer and use it in GitHub Desktop.
Lenovo X220 Tablet rotation script (sets rotation, wacom rotation, subpixel rendering)
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 | |
# 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)')" | |
# Find input devices to be rotated. | |
IFS=$'\n' | |
devices=("$(xinput --list --name-only | egrep '(Wacom)|(TrackPoint)')") | |
rotate() { | |
xrandr -o $1 | |
for device in $devices; do | |
xsetwacom set $device rotate $2 | |
done; | |
gconftool-2 -s /desktop/gnome/font_rendering/rgba_order -t $3 | |
} | |
# Using current screen orientation proceed to rotate screen and input devices. | |
case "$rotation" in | |
normal) | |
# rotate to the left | |
rotate left ccw vbgr | |
;; | |
left) | |
# rotate to inverted | |
rotate inverted half bgr | |
;; | |
inverted) | |
# rotate to the right | |
rotate right cw vrgb | |
;; | |
right) | |
# rotate to normal | |
rotate normal none rgb | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment