4

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.

PRATAP
  • 22,460

3 Answers3

4

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

example

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
pratap@i7:~$ 
  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

PRATAP
  • 22,460
1
synclient TouchpadOff=$(synclient -l | grep -q 'TouchpadOff.*1'; echo $?)

and

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

#!/bin/bash

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

source - here

cipricus
  • 3,444
  • 2
  • 34
  • 85
0

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. –  Aug 13 '19 at 15:48