Skip to content

Instantly share code, notes, and snippets.

@akesling
Last active December 11, 2015 00:18
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 akesling/4515212 to your computer and use it in GitHub Desktop.
Save akesling/4515212 to your computer and use it in GitHub Desktop.
Bash script for flipping Lenovo Thinkpad 230t screen in X (including input).
#!/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