Monday, October 29, 2012

Script to on/off touchpad on Ubuntu 12.04

I wrote this is for workaround for those touchpad button & fn key is not working.

1 )  Create file ~/ with content below.


off=`sudo synclient |grep TouchpadOff |cut -c30-35`

if [ $off -eq 0 ] ;then
echo 'turnoff touchpad';
sudo synclient TouchpadOff=1
echo 'turnon touchpad';
sudo synclient TouchpadOff=0

2 ) sudo chmod +x ~/

3 ) Adding shortcut by launch Settings > Keyboard, go to tab 'Shorcuts'
 Click '+' icon for adding new shortcut.
Name: Touchpad On/Off
Shortcut: sudo ~/
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>/


1 comment:

  1. Better one.