3

I installed Arch Linux and dwm window manager. But the tapping of touchpad doesn't work.

I know how to enable the tapping; I find the id of my touchpad, using this command:

~ xinput --list
Virtual core pointer                          id=2    [master pointer  (3)]
  ↳ Elan Touchpad                             id=10   [slave  pointer  (2)]

I can see that the id is 10. Then I can list its properties:

~ xinput --list-props 10
Device 'Elan Touchpad':
    Device Enabled (172):   1
    libinput Tapping Enabled (307): 0

Here I can see that property of tapping with the id of 307 is not set to 1, so it's not enabled, I can enable it with this command:

xinput --set-prop 10 307 1

And it works. Now I wanted to write a script to automate this process, so I don't have to do it everytime I reboot. I wrote this script:

#!/bin/bash

touchpad_id=$(xinput --list | awk '/Touchpad/ {print $5}' | tr -d 'id=')
tapping_id=$(xinput --list-props $touchpad_id | awk '/libinput Tapping Enabled \(/ {print $4}' | tr -d '():')

# Enable Tapping
xinput --set-prop $touchpad_id $tapping_id 1

And this script works when I run it in the terminal (using ./touchpad_click.sh).

Next, I modified the dwm source code to run a script everytime it starts. I added the below function between the run(void) and scan(void) functions of dwm.c:

void
runAutostart(void) {
        system("~/.dwm/autostart.sh &");
}

Added its header:

static void runAutostart(void);

And called the function in main(), right before calling run():

scan();
runAutostart();
run();

And then compiled the dwm.c file with sudo make install. Compiled successfully.

And then wrote this script, autostart.sh:

#!/bin/bash

# Enable Tapping for Touchpad
./touchpad_click.sh

And put both autostart.sh and touchpad_click.sh in the ~/.dwm directory. I also made sure to give both files execute permission:

chmod +x autostart.sh touchpad_click.sh

And I verify that by:

~ ls -lhA
-rwxr-xr-x 1 amir amir  63 Feb 25 18:07 autostart.sh
-rwxr-xr-x 1 amir amir 259 Feb 25 18:07 touchpad_click.sh

Now the problem is that it doesn't work, and when I terminate dwm by Shift+Alt+Q shortcut, or when I reboot the system, the tapping of the touchpad is disabled. How can I fix this?

1
  • 1
    FYI, you don't need this awk mess in your script -- you can (and should) simply use the names of the device and the property instead. Commented Feb 25, 2020 at 16:39

1 Answer 1

4

I think you don't need to build dwm youself and write a special script which setup xinput properties. You can just use Xorg configuration file instead: https://wiki.archlinux.org/index.php/Libinput#Via_Xorg_configuration_file

Create a file /etc/X11/xorg.conf.d/30-touchpad.conf that contains this:

Section "InputClass"
    Identifier "touchpad catchall"
    Driver "libinput"
    Option "Tapping" "on"
EndSection

and restart Xorg.

You must log in to answer this question.

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