18

You can use this to reverse scroll direction (natural scroll):

xmodmap -e "pointer = 1 2 3 5 4 7 6 8 9 10 11 12"

You can also set it back again with xmodmap -e "pointer = 1 2 3 4 5 7 6 8 9 10 11 12"

and this to switch the left and right buttons:

xmodmap -e "pointer = 3 2 1"

And change it back with xmodmap -e "pointer = 1 2 3"

But how do you enable tap to click from command line? Preferably with one command, and not permanently.

By the way, yes I do know this exists:

enter image description here

Wilf
  • 30,194
  • 17
  • 108
  • 164

4 Answers4

19

Xmodmap is of no help here. Xmodmap controls physical-to-logical mappings of buttons and keys, not the physical process that generate events in the first place.

The tool for this kind of options is xinput. The property name depends on your touchpad model, it may be something like

xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Tap Action" 0

Run xinput list to see the names of available devices and xinput list-props "the device name" to list properties of a device.

See also Dynamic Input Configuration with xinput on the wiki, and some examples.

  • Would I need to restart Unity/Xserver/LightDM to get these to work? – Wilf Jan 09 '14 at 22:02
  • @wilf No, the command takes effect immediately. You can also configure at least some of these settings via a GUI (in which case they'll be applied when your session starts) but I'm not familiar with the GUI. gsettings changes the setting of the GUI interface. – Gilles 'SO- stop being evil' Jan 09 '14 at 22:23
  • Hmmm... 0, 1, "1, 0, 0" don't work with it, but xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Tap Action" "3" turns tapping into a back button... – Wilf Jan 09 '14 at 22:28
  • Success! xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Tap Action" 11 (might of been that number) seems to work, though it is also working as a back button AT THE SAME TIME. Edit: Whoops, actually, that didn't work - ?!? – Wilf Jan 09 '14 at 22:31
  • with another device name (in my case: "Glidepoint Virtual Touchpad") the action name would be different then? There is no "tap action" shown at all for my device :( – PlasmaBinturong Dec 15 '16 at 14:30
  • @PlasmaBinturong Yes, the name of the property may depend on the device. And some touchpads may not have a tap action at all, though I've never encountered one. – Gilles 'SO- stop being evil' Dec 15 '16 at 14:47
  • @Gilles, yes mine has, but funnily (well actually, annoyingly), the tap gets deactivated after resuming sleep/hibernation, and currently I have to sudo service restart glidepoint to get it back... but I still don't see the corresponding tap action in xinput list, so maybe the subject of another question... – PlasmaBinturong Dec 15 '16 at 15:11
  • ID-numbers can be used instead of names. e.g xinput set-prop 16 297 1. 16 is the number of the touchpad from xinput list, 297 stands for the "Tapping Enabled" action from xinput list-props 16, 1 is true. –  Jul 18 '18 at 14:46
  • @cipricus You can use numbers, but the number can vary from one driver to another. Using the number is mainly useful in scripts when you first parse the input of list-props to find a property, and you don't want to deal with complex quoting so you just store the number to use it with set-prop. – Gilles 'SO- stop being evil' Jul 18 '18 at 20:08
  • @Gilles - Of course, but I guess the name of the device and that of the action varies almost as much as the numbers, so the list-props is needed anyway. Furthermore, for some reason, using the name of the action within the command, as suggested by the main answer, wouldn't work for me (xinput set-prop ""AlpsPS/2 ALPS GlidePoint" "Tapping Enabled" 1), while using just the name of the device did work (xinput set-prop "AlpsPS/2 ALPS GlidePoint" 297 1). –  Jul 19 '18 at 14:09
  • for me it's the ``libinput Tapping Enabled'' option – Boson Bear Jul 07 '20 at 23:19
14

You can use gsettings:

gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true  

Which enables tap to click.

gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click false

Will disable it. This is the same as changing it in System Settings.

Seth
  • 58,122
  • Well, doing it with xmodmap could be useful - this is for a battered old netbook with no functioning left click key... but I also thought if I used xmodmap, I could enable it in the login screen as well... – Wilf Jan 09 '14 at 21:29
  • 1
    I'm sure it's not possible @wilf. xmodmap controls physical-to-logical mappings of buttons and keys, not the physical process that generate events in the first place. – Gilles 'SO- stop being evil' Jan 09 '14 at 21:51
  • If it's just the mirror of what's available in the graphical menu, it will not work in case the option is not visible graphically... (I get the error: « org.gnome.settings-daemon.peripherals.touchpad » does not exist) – PlasmaBinturong Dec 15 '16 at 14:38
  • This answer is much preferred over xinput, and if you are using Cinnamon you'll want to adjust accordingly like gsettings set org.cinnamon.settings-daemon.peripherals.touchpad false. – Joe Jun 06 '17 at 15:04
11

Based on the main answer, given that I had to modify some of the instructions there:

The command to enable tap-to-click is therefore of the form:

xinput set-prop "device" "action" 1

To read the "device" you have to do

xinput list

But it may prove difficult to identify the device in that list. Some tips: it is probably under "Virtual core pointer"; it may contain terms like "Syn", "Synaptics", "Touchpad", "Alps", "Glidepoint". e.g., mine was AlpsPS/2 ALPS GlidePoint id=16, but I had to guess; as I was not sure I have tested if that was the correct ID number by disabling/enabling the touchpad with xinput --disable 16 and xinput --enable 16.

Now, to get rid of all the confusing names, ID-numbers can be used instead of the device and action names.

So, to read the "action":

xinput list-props 16

Which listed among others:

    libinput Tapping Enabled (297): 0

So, using ID numbers instead of names, the final command was:

xinput set-prop 16 297 1

Note: for some reason, using the name of the action within the command, as suggested by the main answer, wouldn't work for me (xinput set-prop ""AlpsPS/2 ALPS GlidePoint" "Tapping Enabled" 1), while using just the name of the device did work (xinput set-prop "AlpsPS/2 ALPS GlidePoint" 297 1).


This command can be useful in systems where there is no GUI for such setting, like in the LXQT that I was testing at the date of the post.

2

When setting the Synaptics Tap Action value using xinput, you may need to specify a sequence of numbers. For example, to get normal primary and secondary tap functionality on my Logitech touchpad, I had to do this:

xinput set-prop --type=int --format=8 \ 
    "Logitech Rechargeable Touchpad T650" \
    "Synaptics Tap Action" 1 1 1 2 1 3

I believe this means:

1 1 1 2 1 3
: :
1 1 - enable single-finger tap and assign it to Button1 (left-click)
    : :
    1 2 - enable double-finger tap and assign it to Button2 (right-click)
        : :
        1 3 - enable gesture for middle-click and assign it to Button3 (middle-click)