Table of Contents
Disable notebook touchpad in GNU/Linx
Following this recipe you can disable or enable the touchpad of your GNU/Linux notebook using the command line. I used it to control the touchpad of my Teclast F6, where the Fn key to disable the touchpad does not work.
Install the xinput Debian package and run the following to list the X input devices:
xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech USB Receiver Consumer Control id=8 [slave pointer (2)] ⎜ ↳ Logitech USB Receiver id=15 [slave pointer (2)] ⎜ ↳ SYNA3602:00 0911:5288 Touchpad id=11 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Video Bus id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ SHUNCCM2MP: SHUNCCM2MP id=10 [slave keyboard (3)] ↳ Intel HID events id=12 [slave keyboard (3)] ↳ Intel HID 5 button array id=13 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)] ↳ Logitech USB Receiver Consumer Control id=9 [slave keyboard (3)]
The ask more info about input the touchpad (ID #11 in the above example):
niccolo@ithaca:~$ xinput list-props 11 Device 'SYNA3602:00 0911:5288 Touchpad': Device Enabled (154): 1 Coordinate Transformation Matrix (156): 1.000000, ... Device Accel Profile (286): 1 ...
The Device Enabled property has ID #154, we can disable it:
xinput set-prop 11 154 0
Replace the zero with 1 to re-enable it.
Mapping Fn+ESC on the Teclast F6
The ESC key on the Teclast F6 notebook has the blue label indicating that the shortcut Fn+ESC should trigger the touchpad toggle function, but it does not work in GNU/Linux.
Using the evtest tool we can see that the Fn+ESC keys produces three events, i.e. it is the same as pressing three keys together:
Event: time 1620808296.082667, -------------- SYN_REPORT ------------ Event: time 1620808298.469045, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1d Event: time 1620808298.469045, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1 Event: time 1620808298.469045, -------------- SYN_REPORT ------------ Event: time 1620808298.471997, type 4 (EV_MSC), code 4 (MSC_SCAN), value db Event: time 1620808298.471997, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1 Event: time 1620808298.471997, -------------- SYN_REPORT ------------ Event: time 1620808298.473572, type 4 (EV_MSC), code 4 (MSC_SCAN), value 76 Event: time 1620808298.473572, type 1 (EV_KEY), code 85 (KEY_ZENKAKUHANKAKU), value 1
The keys are Left Control, Left Meta (also known as Left Windows Logo key) and the key used to toggle from Zenkaku (full-width) to Hankaku (half-width) Japanese character spacing
Using udev I remapped the ZENKAKUHANKAKU
key to the more useable ESC (see this page about customize udev events):
evdev:atkbd:dmi:* KEYBOARD_KEY_76=esc
If you are interested, I have a more complete configuration file which I use also to swap the Fn key behaviour on function keys (I want them to work as first option, instead of multimedia buttons). See this page about rempapping keyboard keys.
Finally, using the XFCE Settings ⇒ Keyboard, I associated the Ctrl+Super+Escape keyboard shortcut (where Super means Left Windows Logo) to the following shell script /usr/local/bin/touchpad-toggle:
#!/bin/sh STATE="$(xinput --list-props 11 | egrep '^\s+Device Enabled' | rev | awk '{print $1}')" set_on() { xinput set-prop 11 154 1 echo "Touchpad enabled" } set_off() { xinput set-prop 11 154 0 echo "Touchpad disabled (pass \"1\" as first option to re-enable it)" } case "$1" in on|yes|1) set_on ;; off|no|0) set_off ;; *) if [ "$STATE" -eq "1" ]; then set_off else set_on fi ;; esac
NOTICE: I usually use the Left Windows Logo key as the compose key, to type international characters. Unfortunately the compose key cannot be used into an XFCE keyboard shortcut, so I changed my compose key to the Menu key (the one at the right of the space).