Ubuntu – Rotate touchscreen and disable the touchpad on Yoga 2 Pro in rotated mode

function keyslenovotouchpad

On my Lenovo Yoga 2 pro I installed Ubuntu 14.04 32bit and kept the installed Windows 8 on another partition.

In Windows, When you turn it into tablet mode, the keyboard and touchpad turns off so you don't accidently click on it at the back of the "tablet".

In ubuntu 14.04 only the keyboard turns off, but the touchpad stays active.
Not even the Fn+F6 combination doesn't turn it off.

So far I can only disable it with

synclient TouchpadOff=1

(and re-enable with 0)

I tried xev to get the keycode for Fn+F6 but pressing this combo generates no output. Turning the monitor to the back neither.

How can I disable the touchpad automatically when I rotate or turn the monitor on the back, and re-enable the Fn+F6 Hotkey?

screenshot of the Touchpad Off Button on F6


UPDATE:
After some weeks sudo apt-get upgrade Fn+F6 is working now, so there is only the question how to rotate the screen and how to disable the touchpad automatically when rotating the screen.

Best Answer

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