Xinput set-button-map not applying from xinitrc after reboot


I have a Thinkpad T480 and want to make the Trackpad middle click be a left click. Following these instructions I figured out how to use the xinput set-button-map command to do that.

However when I put that command in ~/.xinitrc the trackpad settings are not preserved after a reboot so I have to run the command again. I checked the ownership and permissions on ~/.xinitrc and they are correct… my regular user of that home dir is the owner and has rwx access to that file.

Where should I put the xinput set-button-map 12 1 1 3 4 5 6 7 command so the trackpad works as I want even after a reboot/shutdown/resume from sleep etc…



use a startup-script or better create your own systemd-service

here’s a link as example how to create such a system-service for your own needs:

1 Like

Thanks for that. But do you know why it doesn’t work for me by adding the xinput command to ~/.xinitrc ?

I never figured out why putting the xinput command in ~/.xinitrc wasn’t working for me after a reboot.

I tried the link above showing how to create a systemd service file to run a script at startup. Seemingly xinput run from a script in a service file is unable to connect to the X server.

I took advice from this helpful thread and this helpful thread and ended up writing a script and making it run at startup. My limited understanding is that with this method the KDE Windows Manager KWin at startup runs that script I made to execute the xinput command.

After a reboot my problem is now solved… the middle button on my trackpad is fixed… well it’s either disabled or it functions as a left click, not sure which! but I’m happy with either.