1 ) Create file ~/tp.sh with content below.
#!/bin/bash
off=`sudo synclient |grep TouchpadOff |cut -c30-35`
if [ $off -eq 0 ] ;then
echo 'turnoff touchpad';
sudo synclient TouchpadOff=1
else
echo 'turnon touchpad';
sudo synclient TouchpadOff=0
fi
2 ) sudo chmod +x ~/tp.sh
3 ) Adding shortcut by launch Settings > Keyboard, go to tab 'Shorcuts'
Click '+' icon for adding new shortcut.
Name: Touchpad On/Off
Shortcut: sudo ~/tp.sh
Click 'Apply', then click on Disable to select shortcut key, my case is Super+f9 since Fn will not work here.
4 ) Grant permission
adding line below to sudoer and replace <user> to your username.
<user> ALL = (ALL) NOPASSWD: /home/<user>/tp.sh
Enjoy!
Better one.
ReplyDeletehttp://alexsleat.co.uk/2012/03/22/toggle-touchpad-with-keyboard-shortcut-in-ubuntu/