Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 980  / 2 Years ago, sun, may 22, 2022, 8:24:00

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.


More From » touchpad

 Answers
7

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.


[#16523] Tuesday, May 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pheter

Total Points: 223
Total Questions: 111
Total Answers: 119

Location: Guadeloupe
Member since Sat, Aug 22, 2020
4 Years ago
;