Created
March 31, 2014 20:09
-
-
Save eleloya23/9901109 to your computer and use it in GitHub Desktop.
Rotate Thinkpad Yoga 12.5 on Ubuntu
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 | |
# Info: | |
# This is the laptop im talking about: http://shop.lenovo.com/us/en/laptops/thinkpad/yoga-series/yoga | |
# I'm running Ubuntu 12.04 with Gnome3 | |
# | |
# The following script toggles the orientation of you screen between NORMAL and INVERTED | |
# You may bind this script to a key using xbindkeys or gnome-control-center keyboard preferences. | |
touchscreen='ELAN Touchscreen' | |
touchpad='SynPS/2 Synaptics TouchPad' | |
touchpadid=`xinput | grep "$touchpad" | grep -oP '(?<==)[0-9]+\s'` | |
orientation=`xrandr --properties | grep -oP '(?<=\s)\inverted(?=\s\()'` | |
#If $orientation is empty, it means it is on normal orientation | |
function screen_inverted(){ | |
xrandr -o inverted | |
xinput set-prop "$touchscreen" 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 | |
xinput set-prop $touchpadid 'Device Enabled' 0 | |
onboard & | |
} | |
function screen_normal(){ | |
xrandr -o normal | |
xinput set-prop "$touchscreen" 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1 | |
xinput set-prop $touchpadid 'Device Enabled' 1 | |
killall onboard | |
} | |
if [ -z "$orientation" ]; then | |
# "Screen is in normal orientation" | |
screen_inverted | |
else | |
# "Screen is inverted" | |
screen_normal | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment