Mapping mouse buttons to keys or commands in KDE Plasma

So see here: How can I map keyboard buttons to my mouse buttons?.

Some notes: run the `xev` program to open up an X11 window which reports on its inputs (keypresses etc).

Reload xbindkeys with: `killall xbindkeys && xbindkeys -f ~/.xbindkeysrc`

Edit the ~/.xbindkeysrc file to program mouse button events. Get the mouse button number from the `xve` command above.

Send multiple keypress events with `xte` with for example `xte ‘keydown Alt_L’ ‘key Tab’ ‘keyup Alt_L’`

At the moment my .xbindkeysrc looks like this:

"dolphin ~/desktop"
     b:9

"xte 'keydown Alt_L' 'key Tab' 'keyup Alt_L'"
     b:8

"konsole --profile localhost"
     b:10

"kstart5 --activate --window . firefox"
     b:2

Note: b:10 above doesn’t actually work with my ROG Gladius II mouse, there doesn’t seem to be a button for buttons 10 and 11. The extra thumb button on the left at the bottom is the “DPI target button”, it’s handled on the mouse and changes mouse sensitivity, it’s not sent as a button to the workstation. You can read more about the ROG Gladius II.

Disable middle mouse button (paste) on Debian KDE

Every now and again I will accidentally click the middle mouse button when I go to grab my mouse, and KDE will dump my clipboard buffer into a BASH shell. Not good. Could run something damaging if I’m unlucky. So see here for the solution. Basically run this to get the mouse device ID:

xinput list | grep 'id='

Then to edit e.g. device 10 to disable middle mouse button:

xinput set-button-map 10 1 0 3

To persist the changes add the set-button-map command to e.g. ~/.xstartup.

Or you can add a pointer configuration to ~/.Xmodmap like this:

pointer = 1 0 3 4 5 6 7 8 9 10

And make sure xmodmap is applied at start-up with an autostart file like e.g. ~/.config/autostart/mouse-config.desktop:

[Desktop Entry]
Type=Application
Name=mouse-config
Comment=Disables middle mouse button.
Exec=xmodmap /home/jj5/.Xmodmap