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

"kstart --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.

Fixing meta-keys in Vim via Mac OS X Terminal.app

So I configured Terminal.app to use Option (Alt) as Meta key: Terminal => Preferences => Profiles => Keyboard => Use Option as Meta key

But wasn’t working for the key-bindings in my .vimrc:

nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z

So I found this article: Fix meta-keys that break out of Insert mode and ended up with the following snippet for my .vimrc which fixed my Meta-key problem:

let c='a'
while c <= 'z'
  exec "set <M-".tolower(c).">=\e".c
  exec "imap \e".c." <M-".tolower(c).">"
  let c = nr2char(1+char2nr(c))
endw

Everything is easy when you know how!

Entering SSH passphrase once in a KDE Pulse session

If you want KDE to remember your SSH key’s passphrase for your whole desktop session you can create a ~/.config/autostart/ssh-add.desktop file like this:

[Desktop Entry]
Type=Application
Name=ssh-add
Comment=Adds my private key to my session.
Exec=/usr/bin/konsole -e 'ssh-add /home/$USER/.ssh/id_rsa'