Lubuntu18.04: how to save touchpad settings?

Hi, this only my second posting to this forum. I hope I do it right.

Problem: In a recent very friendly chat, user wxl showed me how to set Tap-On/Tap-Off on my touchpad when using Lubuntu 18.04:
$ synclient TapButton1=1 or =0. This works excellent, but after the next reboot, the setting is forgotten.

How can I save it, like when I change in Ubuntu the settings for Touchpad they will be kept and are ready after the next reboot?

I should add that I have a dualuser system, and we often set/change out touchpad differently.

Thanks, lubucub

P.S. There is no preview option here, right?

[Disclaimer: I’m not using a version of Lubuntu with LXQt desktop.]

A few years ago I created the following script. (It uses xinput instead of synclient. I’ve wanted to change it to use synclient. It may be easier to script.). I have a ~/bin directory I put the script in. Make it executable. Then I put this line in my ~/.profile:

$HOME/bin/ 0

The parm “0” at the end tell it to turn it off. Otherwise, the script determines the current state and toggles it. Which means: you can go into your keyboard shortcuts and assign that command to a key combination (without the parm) and toggle the touchpad on/off. I use Windows + Space key. I chose those keys because the spacebar is closest to the touchpad. (The Windows key because I don’t like Windows in a similar fashion to my dislike for my touchpad. So, that’s easy to remember. If I get frustrated typing and the mouse moves… I immediate feel something similar to Windows.).

What I did was edit the keyboard shortcut .xml file and add this to it:

<!-- Touchpad toggle disable/enable using Windows + spacebar -->
<keybind key="W-space">
	<action name="Execute">
		<command>bash /home/mark/bin/</command>

But, that is for LXDE. You may have to do something different with LXQt desktop. Below is the script I execute:


# This script does two things:
#   1. Find the touchpad device ID & State (enabled or disabled).
#   2. Toggle it.
# Run this from your .profile, or your distro's settings->startup. 

echo ' DEBUG: entering' 

# Find the touchpad device number
MY_TOUCHPAD_ID=$(xinput list | grep -i touchpad | cut -d'=' -f2 | cut -d$'\t' -f1)

echo ' DEBUG: xinput list (device id):' $MY_TOUCHPAD_ID

if [ "$MY_TOUCHPAD_ID" == "" ]; then
	echo ' ERROR: Can not identify touch pad device number. Exiting'

# If no parm passed, toggle the *current* state.
if [ "$1" == "" ]; then

	echo ' DEBUG: no arg passed'
	# Get current state
	MY_TOUCHPAD_STATE=$(xinput list-props $MY_TOUCHPAD_ID | grep -i "device enabled" | cut  -f3)

	echo ' DEBUG: device' $MY_TOUCHPAD_ID 'has current state:' $MY_TOUCHPAD_STATE

	# Toggle current state
	if [ "$MY_TOUCHPAD_STATE" == "0" ]; then
	elif [ "$MY_TOUCHPAD_STATE" == "1" ]; then
		echo " ERROR: Could not find current touchpad status (to toggle). Setting to enabled."

# Else, if *valid* parm was passed. Honor it.
elif [ "$1" != "0" ] && [ "$1" != "1" ]; then
	echo " ERROR: Passed argument not 0 or 1. Setting to 1."

echo ' DEBUG: changing state to' $MY_TOUCHPAD_STATE

# Change current state
xinput set-prop $MY_TOUCHPAD_ID "Device Enabled" $MY_TOUCHPAD_STATE

echo ' DEBUG: exiting'

That should work for you. That’s what I would start with if I was running LXQt.

@lubucub the above is pretty much what I was suggesting. Better yet, it uses libinput, the successor of synaptics. Since I know you don’t get along too well with the command line, does it make sense? Other questions?

1 Like

@wxl: Thank you, kind of weird stuff, i will ask azdays15 first,

@azdays15: Thank you very much for this detailed instruction :smile:
Weird stuff, but I think I can manage after will have you will have answered these questions, please:

*** 1 ***
Did I understand you correctly that the whole thing is for LXDE?
Because your final remark

That’s what I would start with if I was running LXQt.

confuses me.
LXDE would be fine because I am using Lubuntu 18.04

*** 2 ***

What I did was edit the keyboard shortcut .xml file and add this to it:

Where do I find this file?

Please note, I know a lot but of this lot I know little :wink:

Thank you, lubucub

I’ll answer for him:

  1. He said he wasn’t using LXQt.
  2. The Openbox configuration is in ~/.config/openbox
1 Like

Sorry, I have to ask again:

…you can go into your keyboard shortcuts and assign that command to a key combination…

I find for Lubuntu:
Create New Keyboard shortcuts
There is no automatic way to create new keyboard shortcuts …

Wow! Very heavy stuff for me! Will I have to do all this mentioned in the text just for a simple new keyboard shortcut or is there some easier Lubuntu way for a brat :wink: like me spoiled by Ubuntu and Debian?

Unfortunately, there’s no simple solution for defining hotkeys in Openbox. obkey used to be a thing, but you won’t find it in the Ubuntu archives. There’s a GitHub repo but development on it has ended, so YMMV. In LXQt, there’s lxqt-globalkeys which could easily handle this. That said, you don’t need that shortcut unless your plan is to toggle at will. If not, you just need to make the script, make it executable, and add the $HOME/bin/ 0 line in your profile.

I should also mention this script is for turning the touchpad on and off, which is not what you want. You’ll want to change the following lines as such (basically replacing instances of “device enabled” with “tapping enabled”):

# Get current state
MY_TOUCHPAD_STATE=$(xinput list-props $MY_TOUCHPAD_ID | grep -i "tapping enabled" | cut  -f3)
# Change current state
xinput set-prop $MY_TOUCHPAD_ID "Tapping Enabled" $MY_TOUCHPAD_STATE

If for some reason that doesn’t work, reply back with the results of:

xinput list-props $(xinput list | grep -i touchpad | cut -d'=' -f2 | cut -d$'\t' -f1)

I set it up to toggle because there’s always the very rare moment when I have the laptop without a mouse. Maybe the wireless mouse’s battery dies. Being able to bring the touchpad back to life is very handy. There’s always those few times when you’re thankful for that ability.

And so, I recognized the parm (0 or 1) to force it one way or the other (when logging in, via the .profile).

It would be nice if Lubuntu offered something like this out of the box. I don’t know how people live with the touchpad. I spend more than 10 minutes with the touchpad enabled and I’m ready to commit suicide. It’s amazingly frustrating to try to use the laptops’s keyboard with that thing active. Maybe I have lazy thumbs that constant tap the pad. I don’t now. But, I would give up after more than 10 minutes. I can’t function with it.

Someone mentioned on the mailing list once about using synclient to disable the touchpad depending on how long it’s been since you typed a key. That might be a good way to do it. What I can’t cope with is how typing and touching at the same time causes havoc.

I didn’t realize xinput is “better” (if I’m interpreting Walter’s prior post). Somewhere along the line I got the impression synclient was better. But, maybe that’s because it was easier to script. That was the only reason I’ve had it in the back of my mind to convert my script to synclient. I had the impression xinput was clumsy or something. I didn’t now it’s better.

Makes sense, but in the OP’s case, they want tap-to-click permanently disabled.

I’m pretty sure 19.04+ does, no?

Exactly how I feel about tap-to-click.

I use the keyboard a lot (I use awesome, a keyboard-driven tiling window manager) on a laptop with a touchpad as the pointing device and I just use unclutter to hide the pointer after inactivity. You can tweak the settings to get it to ignore 𝑥 amount of jitter and it won’t pop back up even if you accidentially hover over the touchpad.

Also looking at the synaptics manpage there are a variety of helpful properties that quite possible are options in libinput, too:

   Option "HorizHysteresis" "integer"
          The  minimum  horizontal  HW  distance  required  to generate motion events. Can be
          specified as a percentage. Increase if noise motion is a problem for you.  Zero  is
          disabled.   Default:  0.5  percent  of  the  diagonal  or  (in  case  of evdev) the
          appropriate "fuzz" as advertised by the device.

   Option "VertHysteresis" "integer"
          The  minimum  vertical  HW  distance  required  to  generate  motion  events.   See

   Option "PalmDetect" "boolean"
          If   palm   detection   should   be   enabled.    Note   that  this  also  requires
          hardware/firmware support from the touchpad. Property: "Synaptics Palm Detection"

   Option "PalmMinWidth" "integer"
          Minimum finger width at which touch is considered a palm. Property: "Synaptics Palm

   Option "PalmMinZ" "integer"
          Minimum  finger  pressure at which touch is considered a palm. Property: "Synaptics
          Palm Dimensions"

The author of synaptics (of which synclient is a part of) has essentially deprecated it to focus on libinput (of which xinput is part of) instead. libinput is a little more generalized and abstracted, which makes it extremely powerful and versatile. If you really want to know more, you could always read the docs.

This my solution now that works and my simple mind :wink: can understand:

A) Create 2 scripts:
#This script enables Tap to Click
synclient TapButton1=1
#This script disables Tap to Click
synclient TapButton1=0

B) Put these scripts into $HOME/bin/

C) Put into my .profile:
because I use this most of my time

D) put into my User2’s .profile:
because she rarely uses Tap to Click

E) Have both scripts also in our Desktops in case we want to change the Tapping

Thank you to both of you again, azdays15 and wxl, to introduce fumbling :wink: with the innards of Lubuntu to me :slight_smile:

Or create the script as above with the changes I suggested and stick it outside of home, e.g. /usr/bin/ and then call /usr/bin/ 0 in your $HOME/.profile and /usr/bin/ 1 in your other user’s. You can create a shortcut on the Desktop with ln -s /usr/bin/ $HOME/Desktop which will allow for toggling. This is more general and universal and it doesn’t use synaptics which, like I said, is deprecated.

Sorry that i will stick to my deprecated solution till next year’s 20.04 LTS, which maybe will offer an on-board fix?

You can create a shortcut on the Desktop with ln -s /usr/bin/ $HOME/Desktop which will allow for toggling.

I did put my two scripts as new items into “Menu” > “System Tools”, using alacarte, which offers a sophisticated :wink: way of toggling now for both of us.

Actually, we should have a fix in 19.10.

With 19.04 I use in my case, and with my touchpad,
xinput set-prop 13 307 1
xinput set-prop 13 307 0

That will work for your specific case, but if anything changes, you might run into trouble. The script seeks to find the id (13) more generally and refers to the setting (307) more generally as well.

You are right, I had to readjust the setting the next day :frowning:


xinput set-prop 13 307 1

That will work for your specific case, but if anything changes, you might run into trouble. The script seeks to find the id (13) more generally and refers to the setting (307) more generally as well.

Is there a simple way my system could automatically detect those changes? Please note that I am not a scriptmaster. And I would dearly continue using Lubuntu 19.04 after you had persuaded me to reinstall it.

You can use the script as above. Perhaps a little explanation might help make sense out of it:

Long script explanation (click to expand).

I’ll go through it line by line (except for the comments, i.e. the ones that start with #) so you can understand what’s going on.


This is called the shebang and basically instructs the shell to use this program to run the script. In general, it will come in this format, but I prefer #!/usr/bin/env bash because it’s a bit more portable, but it’s fine as is.

echo ' DEBUG: entering' 

This and other similar lines merely output the quoted text. The purpose for this is to allow for one to understand where one is in the program execution. This is useful for debugging. Since you are not debugging, you can either leave these out or comment them. I will not comment on similar lines.

MY_TOUCHPAD_ID="$(xinput list | grep -i touchpad | cut -d'=' -f2 | cut -d$'\t' -f1)"

This assigns a variable, MY_TOUCHPAD_ID with the output of the string of commands inside of the parentheses. This is called command substitution. The pipes (|) take the output of the previous command and feed it into the input of the next command and each of those commands are as such:

  1. xinput list lists all of the input devices
  2. grep -i touchpad does a case insensitive (that’s the -i) search for any instance of the word touchpad in the above and outputs the result
  3. cut -d'=' -f2 print the field (that’s the -f, with the 2 specifying the second field) after = in the above. Our first command has an output that includes only one such delimiter (that’s the -d), the device ID.
  4. cut -d$'\t' -f1 prints the field before a TAB character. Since the first command includes a master/slave description after the ID, we need to remove this to isolate the ID.
if [ "$MY_TOUCHPAD_ID" == "" ]; then

This uses the conditional if-clause to test if the MY_TOUCHPAD_ID variable (by the way, the $ before the variable outputs its value and is called parameter expansion) is empty.


This exits the program, in the case that the variable is empty, as it means we don’t have a touchpad we can identify, so we shouldn’t go trying to tweak settings on it.


This ends the if-clause.

if [ "$1" == "" ]; then

Another if-clause, but this is checking to see if the first positional parameter or argument to the program is empty. This allows for calling the program in the form to toggle the state rather than explicitly specifying the state with the 0 or 1 argument (e.g. 0 turns it off).

	MY_TOUCHPAD_STATE="$(xinput list-props $MY_TOUCHPAD_ID | grep -i "tapping enabled" | cut  -f3)"

This creates a new variable, MY_TOUCHPAD_STATE that lists the properties of of our touchpad (by ID, using the MY_TOUCHPAD_ID variable from before), then searches for tapping enabled and using the TAB character as a delimiter (though it’s not specified, it’s the default for cut), outputs the third field. This is the value of the “tapping enabled” property, a 0 or 1 value.

	if [ "$MY_TOUCHPAD_STATE" == "0" ]; then

This checks if the state is 0, and if so, sets it to 1.

	elif [ "$MY_TOUCHPAD_STATE" == "1" ]; then

This is another form of the if-clause, but one that’s nested within the clause itself. It can be read “else-if.” It checks to see if the state is 1, and if so, sets it to 0.

		echo " ERROR: Could not find current touchpad status (to toggle). Setting to enabled."

This is another option in the if-clause: an option to match anything that didn’t meet the previous tests. In this case, it means the state was something other than 0 or 1, which is erroneous. The script chooses to arbitrarily set it to 1 to at least return it to a normal state.

elif [ "$1" != "0" ] && [ "$1" != "1" ]; then
	echo " ERROR: Passed argument not 0 or 1. Setting to 1."

I’m not sure you noticed it but there is actually a whole if-clause (i.e. if…fi) nested within another one. The first one checked if the first argument was empty and used the second if so. This returns back to that if-clause. In the event the argument is not empty, then it checks if it is something other than 0 or 1. If this is the case, just like the last error check, this sets it to 1.


We’ve tested if the first argument was empty and if it was not 0 or 1, which leaves us the only other real options: it’s either 0 or 1. In that case, the script was run with a request for an explicit state. This sets our state variable to that argument.

xinput set-prop $MY_TOUCHPAD_ID "Tapping Enabled" $MY_TOUCHPAD_STATE

Now that we have our ID and we have our state, we can simply set it using those variables.

I hope that helps you better understand how the script works and will help you in creating future scripts. The key is that the touchpad ID is acquired generally and the property is defined more generally rather than by its ID.

One thing to consider is that it really doesn’t hurt to set a property to a value it already has. That said, you can also summarize it into two really long commands:

# Turn it off
xinput set-prop "$(xinput list | grep -i touchpad | cut -d'=' -f2 | cut -d$'\t' -f1)" "Tapping Enabled" 0
# Turn it on
xinput set-prop "$(xinput list | grep -i touchpad | cut -d'=' -f2 | cut -d$'\t' -f1)" "Tapping Enabled" 1


After at least 2 hours of tinkering I gave up, the Touchpad scripts, that is.

A) Your short version do not work, neither as scripts, nor in a terminal, e.g.

~$ xinput set-prop "$(xinput list | grep -i touchpad | cut -d'=' -f2 | cut -d$'\t' -f1)" "Tapping Enabled" 1

property 'Tapping Enabled' doesn't exist, you need to specify its type and format

No wonder, Touchpad is not specified.

B) azdays15’s script works fine as is; but of course it just switches the whole Touchpad on or off. If I replace “Touchpad Enabled” with “Tapping Enabled” (as you suggest) nothing happens, Tapping keeps beeing disabled.

Now I really need a long break!

Thanks, lubucub