Created
June 19, 2014 21:47
-
-
Save rubo77/590bd5609996a09c965d to your computer and use it in GitHub Desktop.
This script rotates the screen and touchscreen input, dis- or enbles the touchpad, and dis- or enables the virtual keyboard on a Lenovo Yoga or Yoga 2 Pro
This file contains hidden or 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 | |
# This script rotates the screen and touchscreen input, dis- or enbles the touchpad, and dis- or enables the virtual keyboard | |
if [ "$1" = "--help" ] ; then | |
echo 'Usage: rotate-yoga.sh [OPTION]' | |
echo | |
echo 'This script rotates the screen and touchscreen input to "inverted" or "normal"' | |
echo 'and dis- or enbles the touchpad, and dis- or enables the virtual keyboard' | |
echo | |
echo Usage: | |
echo ' --inverted rotates the screen and touchscreen input 180 degrees, disables the touchpad, and enables the virtual keyboard' | |
echo ' --normal rotates the screen and touchscreen input to normal, enables the touchpad, and disables the virtual keyboard' | |
exit 0 | |
fi | |
if [ -z "$1" ] ; then | |
echo "ERROR: Parameter missing." | |
echo "enter rotate-yoga.sh --help for info" | |
exit 0 | |
fi | |
if [ "$1" = "--inverted" ]; then | |
# rotates the screen and touchscreen input 180 degrees, disables the touchpad, and enables the virtual keyboard | |
xrandr -o inverted | |
xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 | |
xinput disable 'SynPS/2 Synaptics TouchPad' | |
onboard & | |
exit | |
elif [ "$1" = "--normal" ]; then | |
# rotates the screen and touchscreen input to normal, enables the touchpad, and disables the virtual keyboard | |
xrandr -o normal | |
xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 | |
xinput enable 'SynPS/2 Synaptics TouchPad' | |
killall onboard | |
exit | |
else | |
echo "wrong parameter" | |
echo "enter rotate-yoga.sh --help for info" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment