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.
The command to disable touchpad
The command to disable touchpad is:
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:
/bin/bash -c "sleep 15 && gsettings set org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled false"
/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.
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
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.
Bellow are 3 possible approaches, advantages and disadvantages discussed. There could be others, but these are most bulletproof and simple.
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
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
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:
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.
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.
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.
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
- 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.
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
After you have installed it, start it by looking for
Touchpad-Indicatorin the Dash menu.
You will see a new icon (see picture below) show up at the top right of your screen. Click on it and select Preferences.
You will be presented with this window:
Go to the General Options tab.
Tick the box that says Autostart.
Now go to the Actions tab.
Tick on the box that says Disable touchpad when Touchpad-Indicator starts.
(Optionally) Set any other conditions you like in the Actions tab.
You can now close that window (by clicking on OK).
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:
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. If 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