I want my touchpad to be disabled when I use my mouse. How can I do that?
touchpad-indicator has stopped working on 11.10. It used to work on 11.04. Gnome3 is not a solution as I don't like it and find it buggy.
30 Answers
Run the following command in a terminal:
xinput list
You will get an output that looks like this:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Laptop_Integrated_Webcam_1.3M id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ Dell WMI hotkeys id=13 [slave keyboard (3)]
It displays all the input devices connected. Note that they all have an id. Since 12 is the id for my touchpad, running the following command will disable it.
xinput set-prop 12 "Device Enabled" 0
In Ubuntu versions >12.04 you can also directly disable via
xinput --disable 12
(and enable via a similar command)
- Search for mouse
- Click on Mouse and Touchpad
- Click off/on button to the right of touchpad settings.


- 3,283
check this link out: How to disable-enable touchpad in ubuntu 11.10
The answer found there is really neat:
sudo add-apt-repository ppa:atareao/atareao
sudo apt-get update
sudo apt-get install touchpad-indicator
After this you will get a switch in your notification area.
The only thing I would wish is to be able to set the switch key to Fn+F8 (which is a touchpad key switch on my keyboard...
Based on answer given by @Peng Wu I created a bash script that can be used...
#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
xinput set-prop $ID "Device Enabled" 0
echo 'Touchpad has been disabled.'
You can manually run it or run it on start. Then you can make the script run at boot.
Another bash script to toggle touchpad:
#!/bin/bash
declare -i ID
ID=`xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
if [ $STATE -eq 1 ]
then
xinput disable $ID
echo "Touchpad disabled."
else
xinput enable $ID
echo "Touchpad enabled."
fi
- 28,986
- 487
Simply, in a terminal:
synclient TouchpadOff=1
However, the above seems to not work anymore in Ubuntu 16.04. In this case, then xinput still works:
xinput set-prop `xinput --list | awk '/[Tt]ouch[Pp]ad.*pointer/ {print $7}' | sed 's/id=\(.*\)/\1/'` "Device Enabled" 0
- 1,016
- 1
- 12
- 25
UPDATED SOLUTION:
Instead of xinput, with id variables that can change, better use synclient as indicated in other answers, like this.
sudo apt install xserver-xorg-input-synaptics
To turn off touchpad:
synclient TouchpadOff=1
To turn on:
synclient TouchpadOff=0
To be used with launchers or shortcuts as said below.
This is just the application of the commands in this answer under the present question. The solution below is limited to Xfce/Xubuntu, but although I made it by chance, I find it too elegant not too share it here. So, I created a separate question initially, just for Xubuntu. That question cannot but be a duplicate of this one and may be closed for this reason, that's why I dare to re-post that answer here.
It is about these two commands:
Disable:
xinput set-prop 15 "Device Enabled" 0
Enable:
xinput set-prop 15 "Device Enabled" 1
The id number will be found by running
xinput list
This is how to disable your touchpad automatically on startup This method will disable the pad more safely by name rather than by id. Here is how to get the name of your touchpad:
$ xinput list --name-only | grep -i Touchpad
ETPS/2 Elantech Touchpad
Create a bash script file. I added the file to ubuntu Startup Applications so it runs on every restart. Remember to make the file executable. Here are the contents:
#!/bin/bash
$ xinput disable 'ETPS/2 Elantech Touchpad'
- 607
In my case, fn+F9 is mapped into Touchpad toggle.
But the key does nothing just showing touch pad icon on the right-top of the screen like this.
Here is a solution for toggling touchpad just by pressing a shortcut.
1. Getting id of your touchpad
$ xinput list
2. Writing a script for toggling touchpad
So I got a bash script file for toggling touchpad with 'xinput' command(original script can be found here).
In my case, the id of touch pad was 12.
#!/bin/bash
device=12
state=`xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$"`
if [ "$state" -eq '1' ];then
xinput --disable "$device"
else
xinput --enable "$device"
fi
Save the above script file as .toggleTouchPad.sh at where you want.
3. Keyboard shortcut for running the script
And last step is adding keyboard shortcut to run the script file.
So just write sh /PATH/TO/SCRIPT in the Command of your shortcut window .
4. Try the shortcut
Press the shortcut and check if touchpad is toggled.
It worked at ASUS A556UA Laptop and Ubuntu14.04 x64 installed.
Thing to be improved.
- assigning Touchpad toggle key to the above custom shortcut would not work
- it just shows touch pad icon on the right-top of the screen
- so I had to assign another key(super+F9) rather than Touchpad toggle(fn+F9) key.
please suggest a way to assign Touchpad toggle key to a custom shortcut for complete solution
- 151
- 1
- 5
I use the following script to enable/disable touchpad. I also assigned it to the keyboard shortcut.
Usage: toggle_touchpad.sh [on|off]
if you run without arguments then it will simply invert the current state of he touchpad.
#!/bin/bash
# toggle_touchpad.sh
is_off=`synclient | grep -Pio "TouchpadOff.*?(\d)" | grep -Eo "[01]"`
if [ -z "$1" ]; then
echo "Inverting touchpad state"
if [ "$is_off" -eq '0' ];then
synclient TouchpadOff=1
notify-send "Touchpad Disabled"
else
synclient TouchpadOff=0
notify-send "Touchpad Enabled"
fi
else
if [ "$1" == "on" ]; then
echo "Turning on touchpad"
synclient TouchpadOff=0
notify-send "Touchpad Enabled"
elif [ "$1" == "off" ]; then
echo "Turning off touchpad"
synclient TouchpadOff=1
notify-send "Touchpad Disabled"
else
echo "Unknown arg! Pass no args or on/off !"
fi
fi
This worked for me in 11.10 :
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Laptop_Integrated_Webcam_1.3M id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ Dell WMI hotkeys id=13 [slave keyboard (3)]
It displays all the input devices connected. Note that they all have an id. Since 12 is the id for my touchpad, running the following command will disable it.
xinput set-prop 12 "Device Enabled" 0
and I would put it in .bashrc or whatever except that I'm not sure that device 12 (actually 11 for me) is always the touchpad.
Now if I could just get the up-arrow in nautilius to work and see the .dirs
- 23,540
- 49
Define keyboard shortcuts
(this answer was copied from an invalid edit)
Instead of remembering that command every time you wish to enable/disable the touchpad, you can instead add it as a keyboard combination shortcut.
Under preferences in Keyboard Shortcuts click add. Give a name to the shortcut like "Disable Touchpad" or something and add the command you discovered above
xinput set-prop <id> "Device Enabled" 0
and click apply. Then add another shortcut called "Enable Touchpad" or something similar to the first and change the previous command to a 1 at the end
xinput set-prop <id> "Device Enabled" 1
those are the off/on respectivly.
Now that those are added, click on Enable Touchpad's Shortcut column (should say 'disabled') and type the keyboard shortcut you want it to be, I chose Win+1 (Hold Windows Key and press the number 1). Do the same for Disable Touchpad, I chose Win+2.
Now Win+1 enables my touchpad and Win+2 disables it.
For Ubuntu 16.04
For disable touchpad:
xinput --disable $(xinput --list | grep -i 'touchpad' | grep -o 'id=[0-9]*' | sed 's/id=//')
and for enable touchpad:
xinput --enable $(xinput --list | grep -i 'touchpad' | grep -o 'id=[0-9]*' | sed 's/id=//')
- 387
https://bitbucket.org/barseghyanartur/xinput
It's a very tiny code which allows you to disable/enable the touchpad from terminal.
Simply follow the Instructions below:
Install:
$ pip install xinput
Disable touchpad:
$ disable-touchpad
Enable touchpad:
$ enable-touchpad
Just add a couple of bash functions to your .bashrc to give you a togggle...
#toggle-touchpad on|off
function touchpadon { /usr/bin/xinput --enable $(xinput --list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}') ; echo "touchpad enabled";}
function touchpadoff { /usr/bin/xinput --disable $(xinput --list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}') ; echo "touchpad disabled";}
- 1,214
- 9
- 11
It is actually very simple to disable touchpad in Ubuntu. Just remove the package xserver-xorg-input-synaptics that is required for using touchpads in Ubuntu!
sudo apt-get remove xserver-xorg-input-synaptics
It is the only way to disable touchpad permanently that worked for me. The other ways were only temporary:
xinput list
xinput set-prop IDOFTOUCHPAD "Device Enabled" 0
synclient TouchpadOff=1
I am using LXDE and I was not able to automatically disable the touchpad by adding these lines to ~/.config/lxsession/LXDE/autostart or /etc/xdg/lxsession/LXDE/autostart with a @-prefix. It was just ignored.
And I tried disabling touchpad with dconf-editor (org.gnome.desktop.peripherals.touchpad) and gconf-editor (desktop.gnome.peripherals.TOUCHPADNAME), but both did not work. The settings on dconf-editor have no effect at all and on gconf-editor it keeps showing the error message "This key has no schema".
- 206
So, by combining Krzysztof Tomaszewski and JaeJun LEE's answers I came to this solution.
Create the following toggleTouchPad.sh script and save it wherever you want:
#!/bin/bash
device=14
state=`xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$"`
if [ "$state" -eq '1' ];then
xinput --disable "$device" && sleep 1 && xdotool key 201
else
xinput --enable "$device" && sleep 1 && xdotool key 200
fi
where 14 is your TouchDevice Id (refer to JaeJun LEE's answer)
Go to Ubuntu Settings -> Devices -> Keyboard
At the end of the list, click on
+to add a new custom shortcutName it
Toggle Touchpad, with Command/path/to/.toggleTouchPad.shand whatever key combination you'd want (I've just chosen Super + F7).
Now, whenever you hit your chosen key combination, it not only toggle the Touchpad but it also shows a notification icon thanks to xdotool
- 111
My solution is the following tp script:
#!/bin/bash
TT=`xinput --list | grep -i touchpad | sed -e "
s/(//
s/)//
s/ //g
"`
set $TT
(( $2 ))
xinput list | grep -iq mouse &&{
xinput --disable $id
}||{
xinput --enable $id
}
The touchpad is disabled if a mouse is detected, and enable if not.
The touchpad id is found by the script.
- 2,865
- 11
Like so often this is not really one problem but two.
So first we get the touchpads id.
Then we can disable and enable, that given id.
# Get the touchpad's id.
touchpad_id=$(
xinput list |
grep Touchpad |
grep -E -o id=[0-9]* |
grep -o [0-9]* \
;
);
Enable.
xinput --enable ${touchpad_id};
Disable.
xinput --disable ${touchpad_id};
- 321
If your laptop keyboard doesn't have a touchpad on/off special-function key, maybe you can find an on-screen virtual keyboard that simulates it (although I haven't found one).
Short of that, this works well:
sudo apt-get install gpointing-device-settings
- 2,906
What worked for me on Ubuntu 12.04 LTS with Dell Laptop
I wanted disable the pointer which is in the middle of the keyboard and creates a lot of issues while typing. So:
$ xinput list
⎡ Virtual core pointer id=2
⎜ ↳ Virtual core XTEST pointer id=4
⎜ ↳ Wacom Graphire2 4x5 eraser id=9
⎜ ↳ Wacom Graphire2 4x5 cursor id=10
⎜ ↳ Wacom Graphire2 4x5 id=11
⎜ ↳ AlpsPS/2 ALPS DualPoint TouchPad id=14
⎜ ↳ Macintosh mouse button emulation id=15
⎜ ↳ DualPoint Stick id=13
⎣ Virtual core keyboard id=3
↳ Virtual core XTEST keyboard id=5
↳ Video Bus id=6
↳ Power Button id=7
↳ Sleep Button id=8
↳ AT Translated Set 2 keyboard id=12
The device I want to disable has id 13. Use xinput to list its properties:
$ xinput -list-props 13
Device 'DualPoint Stick':
Device Enabled (115): 0
[...several lines removed...]
$ xinput -set-prop 13 115 0
This has disabled the Dualpoint stick. But none of the other answers worked for me. I did
Install dconf-tools:
sudo apt-get install dconf-tools
dconf-editor
Then go to org -> gnome -> settings-daemon -> peripherals -> touchpad and uncheck touchpad-enabled field
- 72,312
- 11
- 1
I found a nice solution of creating a key binding that will invoke the command:
xdotool key 199
where 199 is a keycode recognized as XF86TouchpadToggle. This way one can make a key combination of his/her choice to behave like a special key some laptops have to toggle the touchpad as desktop environments like Mate or Cinnamon handle it great. You can check keycodes by this command:
xmodmap -pke
I have created a how-to on my blog: https://artofcode.wordpress.com/2017/10/01/how-to-add-a-key-binding-to-toggle-a-touchpad-under-linux/
To disable my dell latitude's middle stick, I put this on .profile of Ubuntu so every-time I start/reboot my laptop, it will disable that input.
I used the --id-only to avoid mismatch in grep
declare -i ID
ID=`xinput list --id-only 'AlpsPS/2 ALPS DualPoint Stick' | grep -Eo '[0-9]{1,2$
declare -i STATE
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
if [ $STATE -eq 1 ]
then
echo "id" $ID
xinput disable $ID
echo "Touchpad disabled."
else
echo "id" $ID
xinput enable $ID
echo "Touchpad enabled."
fi
- 1,156
- 6
- 15
- 21
- 1
Alternative: using awk and xbindkeys (automatic detection)
First please add touchpad_toggle script in your ~/bin directory:
#!/bin/bash
tpad_device=`xinput list | grep Touchpad | awk '{print $6}' | sed -e 's/id=//'`
tpad_enable=`xinput --list-props $tpad_device | grep 'Device Enable' | awk '{print $4}'`
if [ "$tpad_enable" == "1" ]; then
xinput --disable $tpad_device
elif [ "$tpad_enable" == "0" ]; then
xinput --enable $tpad_device
else
echo "!WARNNING touchpad device not found!"
fi
In your ~/.xbindkeysrc add:
#touchpad_toggle
"touchpad_toggle"
m:0x0 + c:199
XF86TouchpadToggle
- 101
I created a script before on another question: https://askubuntu.com/a/874865/433961
It finds and toggles TouchPad device. You can configure a custom shortcut to it in system settings.
#!/bin/bash
read TPdevice <<< $( xinput | sed -nre '/TouchPad|Touchpad/s/.id=([0-9]).*/\1/p' )
state=$( xinput list-props "$TPdevice" | grep "Device Enabled" | grep -o "[01]$" )
if [ "$state" -eq '1' ];then
xinput --disable "$TPdevice" && notify-send -i emblem-nowrite "Touchpad" "Disabled"
else
xinput --enable "$TPdevice" && notify-send -i input-touchpad "Touchpad" "Enabled"
fi
I'm setting Ctrl+Shift+F9 for toggle touchpad enable and disable like this:
Update: You may need to make your script to executable with command chmod +x filename or input /bin/bash /filepath to Command field of Custom shortcut window.
- 889
Alternative solution which works for all touchpads, no id needed.
open a terminal and write "gedit toggle_touchpad.sh"
#!/bin/bash
condition="$(gsettings get org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled)"
if [ "$condition" == "false" ]; then
gsettings set org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled true
elif [ "$condition" == "true" ]; then
gsettings set org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled false
fi
Save the file and exit. Now you have a file with the name "toggle_touchpad.sh"
Run the command chmod +x toggle_touchpad.sh to make the file executable.
Place the file in any folder you like. Let us assume that you have it in the folder /home/username/myscripts/.
From the menu on the top-right go to system-settings->keyboard->shortcuts->custom-shortcuts.
Create a new shortcut and put as name whatever you want. Put as command /home<username>;/myscripts/toggle_touchpad.sh where "username" is your username
Assign whatever keyboard shortcut you want.
Ready :)
P.S. Personally I put the file in the /opt/myscripts/ folder but in order to put it there you should run the following commands after creating the file:
sudo mkdir /opt/myscripts/
sudo mv toggle_touchpad.sh /opt/myscripts/
sudo chown <username>:<username> /opt/myscripts/toggle_touchpad.sh
chmod +x /opt/myscripts/toggle_touchpad.sh
where "username" is your username
Then when you will create the shortcut you will use the path "/opt/myscripts/toggle_touchpad.sh" instead of the one mentioned above
- 1,458
This method works, but I can't seem to use the "win" button. So I used the CtrlF1 & F2 for it.
Currently my laptop OS is ubuntu 14.04LTS.
Oh, need to find out the xinput < id > with the command below. For Ubuntu 14.04, it is the "SynPS/2 Synaptics TouchPad"
xinput list
SynPS/2 Synaptics TouchPad id=###
I tried all the previous answers here without success.
What worked for me on Ubuntu 16.10 was
killall syndaemon
syndaemon -i 1 -KRd
You may want to change the value 1 to 0.5.
- 72,312
- 231




