I don't use my touchpad often and when I'm typing on the keyboard it sometimes happens that my hand touches it and the cursor gets clicked which is annoying. That's why I push the touchpad-disable-button on each startup.

However, I still need the touchpad occasionally so I don't want to disable it completely.

Is there a way that touchpad-disable-button is automatically activated when I start my linux machine?

EDIT: I installed "xdotool" to simulate a keypress and I found out the particular key to toggle the touchpad is called "XF86TouchpadToggle", but unfortunately when I type "xdotool key XF86TouchpadToggle" in the terminal the LED of the key doesn't go on to and the touchpad is still enabled. This is strange since I can press any other, normal key with this method. For example "xdotool key q" types a 'q' in the terminal.


You can use the xinput program to control input peripherals, including (de)activating them. See Make mouse movements scroll when the middle button is held down for a detailed tutorial. In a nutshell, run xinput list to determine the name or numerical ID of your touchpad, then

xinput --set-prop 'name of touchpad device' 'Device Enabled' 0

To reenable, change the final 0 to 1. To toggle, you can use

enabled=$(xinput --list-props 'name of touchpad device' | sed -n 'y/\t/ /; s/^ *Device Enabled ([0-9]*): *//p')
xinput --set-prop 'name of touchpad device' 'Device Enabled' $((1-enabled))

Put the disabling command somewhere in your X startup scripts. Where to put it depends on your desktop environment and the way you start your X session. If you start X manually with startx, this goes into ~/.xinitrc. If you run your own X session script (~/.xsession), this command goes there. If you're using a predefined session in a graphical login manager, that depends on your session type and on the display manager; many but not all systems run commands from ~/.xprofile before starting the session manager or window manager.

This enables or disables the touchpad at a software level, which may not be interchangeable with the button near the touchpad.

Alternatively, most touchpads support disabling the touchpad while typing.

  • Yes, I already tried the xinput method and it is a temporary workaround. However, I have to type it into the terminal again to re-enable the touchpad. I still would like to toggle it with the button, since it is much quicker and easier to enable the touchpad again. – Arthur Feb 17 '16 at 9:54
  • Do you know if I can make it work somehow with things like "xdotool"? – Arthur Feb 17 '16 at 9:56
  • @Arthur xdotool won't help you here: you're telling applications that the button has been pressed, but the hardware doesn't see a button press. I don't know at what level (hardware, firmware or driver) that button acts, but if it can be controlled in software, it'll be via the touchpad driver, not via generic keyboard support. However you can have the button trigger the software toggle, by using xbindkeys or similar to run an xinput-based toggling command when the button is pressed. There's a risk that this “software switch” will run out of synch with the hardware switch however. – Gilles Feb 17 '16 at 10:08

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.