Help with keyboard shortcut (fn) to disable the touchpad

hello world, i first started with linux almost 4 years ago, xfce always end up surprising me with its high performance.
with the only drawback that it does not have by default a way to disable the touchpad with the fn keys of the laptops.
or at least not on my computers.

today I decided to publish a small solution to this little problem.
It is a script that acts as a touchpad switch using any key, but I recommend using the one we have by default in our computer model.

-You must manually deactivate and reactivate the touch pad from the configuration menu to wake up the module that controls it, otherwise the script will not work (this is necessary only once).
settings> mouse and touch panel> devices> activate this device
-copy and paste the content of the script in an empty file and grant execution permission.
-create a keyboard shortcut by calling the script in: settings> keyboard> application shortcuts> add
-the name of the touchpad device could vary, I’m not sure about this part but you can check the name of your device by running: xfconf-query -c pointers -l


state=$(xfconf-query -c pointers -p /AlpsPS2_ALPS_GlidePoint/Properties/Device_Enabled -v)

if [ $state == 1 ] ; then
xfconf-query -c pointers -p /AlpsPS2_ALPS_GlidePoint/Properties/Device_Enabled -s 0
xfconf-query -c pointers -p /AlpsPS2_ALPS_GlidePoint/Properties/Device_Enabled -s 1

How do I get this script to be activated-loaded for any user? that is, to pretend the system is already installed with the default script.

If there is another simpler solution, of which I do not know for the touchpad, please tell me.

You could add it to /etc/X11/xinit/xinitrc.d/. That way it should always get loaded, regardless of who logs in. :thinking:

Probably under:


Then every new created user have this script. Just create the file there and make it executable.

For already created users: copy the file to the home folder in .config/autostart/

I just tried your suggestion, unable to run the script, anyway you gave me an idea with this directory: /usr/local/bin/toggle-touch.
the script can be called by any user
The last step to end this little journey is: that the keyboard shortcut is configured by default for any user.

Is there a way for new users to default to the keyboard shortcut “XF86TouchpadToggle” = fn + f5 to call the script?

Thanks for your suggestion, but I am not looking for the script to start automatically when I turn on the computer, on the other hand I find it interesting to be able to distribute a script to new users, I will use that function some day :slight_smile:

Could you help me with this?

xfconf-query -h has an option to toggle a boolean setting
-T, --toggle Invert an existing boolean property

So it may be possible to use this single command

xfconf-query -c pointers -p /AlpsPS2_ALPS_GlidePoint/Properties/Device_Enabled -T

do you think we could distribute this configuration to all users?

I’m going to try this:

Thank you very much, it is good to have more options
the output is this:
--toggle only works with Boolean values.

I am afraid that true false does not apply at this time.

hahaha okay, it has worked, I have marked the answer that served me the most, I preferred the second answer because I think that with that option the script and the configuration in general would survive an update, even a new installation as long as we have /home in another partition and without formatting.

In a few minutes I will prepare the tutorial, in this publication so that other users can replicate it.

once we have created and verified that the script works (explained above)
I named the script toggle-touch

we create the directory:

mkdir -p ~/.local/bin/

now we paste our toggle-touch script in the same directory: ~/.local/bin/

we configure our keyboard to call the script from that location
settings> keyboard> application shortcuts> add

we proceed to distribute our configuration to future new users
we create the necessary directories:

sudo mkdir -p /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
sudo mkdir -p /etc/skel/.local/bin/

we copy necessary files:
change /user/ to the appropriate name.

sudo cp /home/user/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
sudo cp /home/user/.local/bin/toggle-touch /etc/skel/.local/bin/

all future new users should be able to enjoy the changes.

I have personally tested the commands and the script
none presented problems, nor does it affect the normal operation of the system.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.