3

I know that getting your touchpad disabled is as easy as toggling the on/off button in System Settings, but unfortunately it only works for the current session. After a reboot, the touchpad is back on.

8
  • 1
    You could try any of the answer to this question. If they work, you can put them in a script and add it to your Startup Applications, and let me know and I'll write a full answer.
    – TheSchwa
    Feb 24, 2016 at 3:48
  • 1
    You can also blacklist the module (a.k.a. "driver") but then we need a little bit more information on the exact hardware. What's the output to xinput?
    – Fabby
    Feb 24, 2016 at 13:55
  • 1
    Possible duplicate askubuntu.com/questions/65951/how-to-disable-the-touchpad Feb 26, 2016 at 11:36
  • 2
    You can probably disable the touchpad in bios. if you need to turn it off permanently.
    – Pilot6
    Feb 26, 2016 at 16:07
  • 1
    If I want to completely disable a device in my computer I open it up and remove the cable.
    – Elder Geek
    Feb 29, 2016 at 18:24

4 Answers 4

4
+25

The command to disable touchpad

The command to disable touchpad is:

for 14.04:

gsettings set org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled false

for 15.04 +:

gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled

Add it to Startup Applications

The most pragmatic (and simple) solution then is to add the command to Startup Applications.

Like in many cases when commands involve screen, xrandr, keyboard or touchpad settings, You will need to add a small break however to prevent possible local procedures to overrule the command, so it should be:

for 14.04:

/bin/bash -c "sleep 15 && gsettings set org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled false"

for 15.04+:

/bin/bash -c "sleep 15 && gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled"

Open Dash > Startup Applications > Add. Add the command above, according to your Ubuntu version.

Now shortly after login (within 15 seconds) your touchpad is disabled automatically.

Of course you can play with the 15 seconds a bit to optimize for your system.


Edit

From your comment, it turns out the touchpad is (re-) enabled after a while, which means some process is enabling the touchpad.

Usually, it is extremely difficult to find out which process is causing this kind of changes. Even if you could, it would not be sure you could eliminate the cause.

The good news however is that gsettings (which is used to check/control the touchpad) is extremely "low on juice". That means that it will be no burden to your system whatsoever to have a background script keep an eye on the current state, immediately disabling the touchpad again if it is enabled somehow by some process.

If you run 14.04

  • Use the script below
#!/usr/bin/env python3
import subprocess
import time

key = "org.gnome.settings-daemon.peripherals.touchpad"

def check_set():
    currstate = subprocess.check_output([
        "gsettings", "get", key, "touchpad-enabled",
        ]).decode("utf-8").strip()
    if currstate == "true":
        subprocess.Popen([
        "gsettings", "set", key, "touchpad-enabled", "false"])

while True:
    time.sleep(2)
    check_set()

If you use 15.04+

#!/usr/bin/env python3
import subprocess
import time

key = "org.gnome.desktop.peripherals.touchpad"

def check_set():
    currstate = subprocess.check_output([
        "gsettings", "get", key, "send-events",
        ]).decode("utf-8").strip()
    if currstate == "enabled":
        subprocess.Popen([
        "gsettings", "set", key, "send-events", "disabled"])

while True:
    time.sleep(2)
    check_set()

To use it

  • Copy the script into an empty file, save it as no_touchpad.py
  • Add the following command to Startup Applications:

    /bin/bash - c "sleep 15 && python3 /path/to/no_touchpad.py"
    

I am afraid the only alternative is to disconnect the touchpad physically, as mentioned by Serg.

3
  • It's all nice and dandy, but the problem is that for no apparent reason the touchpad is back on after a while.
    – misha
    Mar 2, 2016 at 11:42
  • @misha ok, will edit in a minute... Mar 2, 2016 at 12:42
  • @misha Posted an update. Mar 2, 2016 at 13:05
4

Bellow are 3 possible approaches, advantages and disadvantages discussed. There could be others, but these are most bulletproof and simple.

Dconf approach

First approach is by using dconf (and this is my prefered approach, since it survives reboots at least on my 14.04 LTS system ) , more specifically this command:

dconf write /org/gnome/settings-daemon/peripherals/touchpad/touchpad-enabled false

To finalize it , run dconf update.

Very nice approach, doesn't require root access, survives reboots, simple to script.

Blacklisting the driver

If a driver ( in Linux terminology - module ) is blacklisted, the device won't be used - that's a simple idea. The specific module that we need is pmouse.

Open the file /etc/modprobe.d/blacklist.conf with root privileges, for example with sudo nano /etc/modprobe.d/blacklist.conf (command line editor) or with gksu gedit /etc/modprobe.d/blacklist.conf (gui editor). Add the following line at the end:

 blacklist pmouse

Save, exit, reboot, and now your touch pad will be prevented from use. For the record, wireless usb mouses still will be active - I am currently typing that on my laptop with touchpad module removed, while using a usb wireless mouse.

Small disadvantage of this method is need for root access, but overall it is a simple and effective approach.

xinput

Final one, is xinput --disable ID , where ID is the id= number from the xinput (notice no arguments) of the device. Now how do we make that autostart every time we log in to GUI ?

Make a script and add it to Startup Applications menu :

#!/bin/bash
DISPLAY=:0
xinput --disable 13 # id 13 is just an example

Now every time you log in , this will run. Slightly more verbose, more steps. However, this has advantage when you use any GUI that relies on X server. But only those that use dconf will work with the dconf method (obviously), for example Unity or Gnome.

Hardware solution:

This might be obvious, but if you want to 100 % disable a touchpad, open the laptop and disconnect a ribbon connector that goes from touchpad to the motherboard.

1
  • 1
    Pros for the hardware solution - no possibility of typos. Cons may require a screwdriver and may void your warranty.
    – Elder Geek
    Mar 1, 2016 at 13:04
4

There's a really cool utility called touchpad-indicator which shows an icon in the top bar about the status of the touchpad. The important thing is that it also allows you do to the following:

  • Enable/disable touchpad by simply clicking on the icon.
  • Disable touchpad automatically on startup when touchpad-indicator starts.
  • Disable touchpad when mouse plugged in.
  • Disable touchpad when typing.
  • Enable/disable touchpad using a keyboard shortcut.

I will show you how to install and set it up so that it disables the touchpad on startup.

  1. First we need to install it, open up a terminal and type in the following:

    sudo add-apt-repository ppa:atareao/atareao 
    sudo apt-get update
    sudo apt-get install touchpad-indicator
    
  2. After you have installed it, start it by looking for Touchpad-Indicator in the Dash menu.

  3. You will see a new icon (see picture below) show up at the top right of your screen. Click on it and select Preferences.

    Icon that will show up in the notifications toolbar on the top-right.

  4. You will be presented with this window:

    Touchpad-Indicator tool.

  5. Go to the General Options tab.

    Tabs at the top of application.

  6. Tick the box that says Autostart.

    Autostart checkbox

  7. Now go to the Actions tab.

  8. Tick on the box that says Disable touchpad when Touchpad-Indicator starts.

    Disable touchpad when application starts.

  9. (Optionally) Set any other conditions you like in the Actions tab.

  10. Done.

You can now close that window (by clicking on OK).

Enjoy.

1
  • 2
    This is how I personally do it.
    – jrg
    Mar 1, 2016 at 20:08
3

The following command will disable your touchpad, provided that you replace "XX" with the id of your touchpad.

xinput set-int-prop XX "Device Enabled" 8 0

To find your touchpad's id, run:

xinput --list

For instance, my touchpad look like this:

⎜ ↳ AlpsPS/2 ALPS DualPoint TouchPad id=15 [slave pointer (2)]

So my touchpad's id is 15.

So, using this command, I am able to turn my touchpad off:

xinput set-int-prop 15 "Device Enabled" 8 0

And back on:

xinput set-int-prop 15 "Device Enabled" 8 1

This is the same command issued by your enable/disable touchpad hotkey on your keyboard, so you'll still be able to turn the touchpad back on at any time if you need it.

So now, all that's left is to make this command run whenever you turn your computer on. Probably the easiest way to do this this is to add the command to your startup applications. In Unity, just search for Startup Applications in the dash. enter image description hereIf you're using Mate, the tool is under "System -> Preferences -> Personal -> Startup Applications."

Using the startup applications method to run the command, the touchpad will still be active on the login screen and on the profiles of other user accounts. If you want to make the command run system-wide during startup, this question has some helpful answers to get you started.

Other sources: http://wpkg.org/Disable_/_enable_keyboard_and_mouse_in_Linux

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .