Rotate touchscreen and disable the touchpad on Yoga 2 Pro in rotated mode
Info:
I think the Hotkey Fn+F6 works since some time If you install the latest Ubuntu updates.
Rotate the screen and touchscreen input 180 degrees
create the script /usr/local/bin/rotate-screen.sh
(I enhanced that script there at gist so it rotates 90° also)
#!/bin/bash
# This script rotates the screen and touchscreen input 180 degrees, disables the touchpad, and enables the virtual keyboard
# And rotates screen back if the touchpad was disabled
isEnabled=$(xinput --list-props 'SynPS/2 Synaptics TouchPad' | awk '/Device Enabled/{print $NF}')
if [ $isEnabled == 1 ]
then
echo "Screen is turned upside down"
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'
# Remove hashtag below if you want pop-up the virtual keyboard
# onboard &
else
echo "Screen is turned back to normal"
xrandr -o normal
xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
xinput enable 'SynPS/2 Synaptics TouchPad'
# killall onboard
fi
and give it executable rights:
sudo chmod +x /usr/local/bin/rotate-screen.sh
then
1.
create *.desktop
file in /usr/share/applications/
gksudo gedit /usr/share/applications/rotate-screen.desktop
2.
Paste below text:
[Desktop Entry]
Type=Application
Terminal=false
Icon=/usr/share/icons/hicolor/48x48/apps/un-reboot.png
Name=rotate-screen
Exec=/usr/local/bin/rotate-screen.sh
Categories=Utility;
Then run the script via the Unity launcher startmenu (type "rotate-screen")
Source:
https://askubuntu.com/a/446125/34298
I was in the exact same position, only on a Yoga 3. I found this thread and the brilliant answer by rubo77, so I've begun adapting it into a command line tool, so it's a little easier to control things exactly, and only toggle the things you want. It's still work in progress at the moment, but the core functionality is there and working.
Repo: https://github.com/RealOrangeOne/yoga-pal
(Installation instructions can be found Here)
Extra note, if your laptop has a hardware button for rotating the screen (on mine it's on the right hand side), you can bind that to call commands, meaning you can restore it's intended functionality. It can also be used in replacement for rubo's script inside a desktop entry if you would prefer to run it that way.