Touchpad Toggle With F6 on Zorin OS 16

I do have the "Fn" key. But I just press on F6(a touchpad emoticon is on the key) to turn off the touchpad.

And nothing happens when just executing the file.

You likely have function lock turned on then and the fn key is being recognized as pressed due to fn key being linked to the keyboard micro controller. Currently trying to see how to induce an fn key press using xdotool, have to find a way to see the keyboard output to induce this keystroke.

run:
xmodmap -pke | grep TouchpadToggle
this will list the key code needed for the toggle, use this code rather than F6 in the script and it should work!

Edit:
even simpler just run:
xdotool key XF86TouchpadToggle

Follow my previous guide but just use this in the script rather than F6. I edited it to reflect this change.

Running xdotool key XF86TouchpadToggle is entirely disabling and enabling the touchpad entirely instead of toggling. When I use that command I can't use the F6 to turn on/off.

In windows 10 this used to work fine. The system used to remember whether before the shutdown touchpad is on/off. So when I used to start the system the next time, touchpad would be in an off state. I used to press F6 when I had to use the touchpad.

I did replace F6 in the script with the code I got from xdotool. It didn't work.

Just tested this in my laptop and this is now what I'm experiencing. When using the command the F6 key still operates as expected and is able to toggle the touchpad as per usual. The command is just sending the system the exact message that your keyboard would if you were to press the key so I'm not sure why you'd be having this issue.

Is it possible to know which code is being sent when I press the F6?

xmodmap -pke | grep TouchpadToggle
this will give you a key id, you can try that id number rather than XF86TouchpadToggle

It gives me 199. When I use xdotool key 199 the touchpad is being disabled. Toggling doesn't work with F6 until I execute xdotool key 199 again.

That's really interesting. One thing funnily enough is you could do a keyboard shortcut to have that script execute on an F6 press

Oh. I see. How do I do that?

Settings, Keyboard shortcuts, add, for the command do a path to the script file, for the key just add F6 as a key.

PS.

Or can I use another key combination to toggle the touchpad instead of F6?

Yes, any key combination you'd like for toggling the touchpad using what i just said, just use the key combo you'd like instead of F6.

How do I create a key combination? Do I have to install some software?

Open settings, Find Keyboard Shortcuts, Scroll to the bottom and click the +. For the command just put ./PATH/TO/YOUR/SCRIPT.sh
Then it'll say shortcut, click it and press whatever key combo you'd like to use and it will save it.

In the script do I use xdotool key XF86TouchpadToggle in the script?

You can use that or 199, just preference as they will do the same thing. I recommend XF86TouchpadToggle as then it's super self-explanatory in the future as to what the script is doing.

1 Like

Ok. Thanks!

1 Like

Marked solution. 162