Is there a way to toggle touchpad on/off with a command/keyboard shortcut? I tried using this:

if $(gsettings get org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled); then gsettings set org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled false; else gsettings set org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled true; fi

But it didn't work at all.


Work Around:

with the help of this post https://askubuntu.com/a/1140700/739431

install the xdotool package if not yet installed, sudo apt install xdotool

  1. run xmodmap -pke | grep TouchpadToggle


pratap@i7:~$ xmodmap -pke | grep TouchpadToggle
keycode  71 = XF86TouchpadToggle NoSymbol XF86TouchpadToggle NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol XF86TouchpadToggle
keycode 199 = XF86TouchpadToggle NoSymbol XF86TouchpadToggle NoSymbol XF86TouchpadToggle
  1. run in terminal xdotool key XF86TouchpadToggle to check if the touchpad toggling is working?

enter image description here

  1. Create your own shortcut Shift+Ctrl+I with custom command xdotool sleep 1 key XF86TouchpadToggle sleep value 0.5 may also work.. try it with your comfort..

enter image description here


Yes. On my laptop I can toggle on/off the touch-pad using the key F5. try it on your laptop if it's not works then try pressing Fn + F5 (F5 or the key which your laptop use). look at the icons on your keyboard.

  • The OP's machine has no such shortcuts according to the comment above. – user880592 Aug 13 '19 at 15:48
synclient TouchpadOff=$(synclient -l | grep -q 'TouchpadOff.*1'; echo $?)


tp=$(synclient -l | grep TouchpadOff | awk '{ print $3 }') && tp=$((tp==0)) && synclient TouchpadOff=$tp

both work for me in Xfce to toggle touchpad onn/off.

I use them with a shortcut associated with a script like


synclient TouchpadOff=$(synclient -l | grep -q 'TouchpadOff.*1'; echo $?)

source - here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.