Last active
December 11, 2015 00:18
-
-
Save akesling/4515212 to your computer and use it in GitHub Desktop.
Bash script for flipping Lenovo Thinkpad 230t screen in X (including input).
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
#!/usr/bin/env bash | |
if [[ -n "$1" ]] ; then | |
if [[ *"$1"* == "display screen monitor" ]] ; then | |
flip_display=true | |
flip_input=false | |
elif [[ *"$1"* == "input wacom tablet stylus" ]] ; then | |
flip_display=false | |
flip_input=true | |
else | |
flip_display=true | |
flip_input=true | |
fi | |
else | |
flip_display=true | |
flip_input=true | |
fi | |
echo "$flip_display $flip_input" | |
display_state="$(xrandr | cut -d' ' -f4 | head -2 | tail -1)" | |
if [[ $flip_display ]] ; then | |
if [[ $display_state == "inverted" ]] ; then | |
xrandr -o normal | |
else | |
xrandr -o inverted | |
fi | |
fi | |
if [[ $flip_input ]] ; then | |
if [[ $display_state == "inverted" ]] ; then | |
xsetwacom set "Wacom ISDv4 E6 Pen stylus" Rotate none | |
xsetwacom set "Wacom ISDv4 E6 Finger touch" Rotate none | |
xsetwacom set "Wacom ISDv4 E6 Pen eraser" Rotate none | |
else | |
xsetwacom set "Wacom ISDv4 E6 Pen stylus" Rotate half | |
xsetwacom set "Wacom ISDv4 E6 Finger touch" Rotate half | |
xsetwacom set "Wacom ISDv4 E6 Pen eraser" Rotate half | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment