I like using emacs-style navigation in the terminal (e.g. Ctrl + N for down, Ctrl +P for up, Ctrl + A for home, Ctrl + E for end), and I want to do something similar for navigation elsewhere. I would like to use CapsLock + N/P/A/E/etc for down/up/home/end in all apps (I previously used the AutoHotkey script at https://github.com/usuyama/emacs-like-key-bindings-windows to accomplish this in Windows).
I’m currently using KDE Plasma on Wayland, and I haven’t seen anything obvious to do this while poking around settings. Any suggestions? Thank you in advance!
There are several tools for this which work on Wayland. An easy way to do simple remapping would be evremap, your config would look something like this:
[[remap]] input = ["KEY_LEFTCTRL", "KEY_N"] output = ["KEY_DOWN"]
If you want more complex macros, AutoHotkey style, check out hawck. Note that hawck doesn’t support GUI automation in case you were curious, but if you want something similar you could pair it with KWin scripts and ydotool.
Thank you for the suggestions! I’ll dig into these tonight and see what I can get working.
Looks like evremap will do what I want, plus a nifty bonus! The following config lets me use CapsLock + N/P/etc to navigate. And if I just tap CapsLock without pressing anything else, it will act as escape.
device_name = "Telink Wireless Receiver" [[dual_role]] input = "KEY_CAPSLOCK" hold = ["KEY_F19"] tap = ["KEY_ESC"] [[remap]] input = ["KEY_F19", "KEY_N"] output = ["KEY_DOWN"] [[remap]] input = ["KEY_F19", "KEY_P"] output = ["KEY_UP"] [[remap]] input = ["KEY_F19", "KEY_B"] output = ["KEY_LEFT"] [[remap]] input = ["KEY_F19", "KEY_F"] output = ["KEY_RIGHT"] [[remap]] input = ["KEY_F19", "KEY_A"] output = ["KEY_HOME"] [[remap]] input = ["KEY_F19", "KEY_E"] output = ["KEY_END"]
Note: I used F19 because it doesn’t seem to be bound to anything by default. Apparently, a bunch of the other function keys already did things, as described in /usr/share/X11/xkb/symbols/inet
$ cat /usr/share/X11/xkb/symbols/inet | grep FK13 key { [ XF86Tools ] }; key { [ XF86MailForward ] }; key { [ XF86Word ] }; // F2 key { [ XF86MailForward ] }; // F3 $ cat /usr/share/X11/xkb/symbols/inet | grep FK20 key { [ XF86AudioMicMute ] };