I have a ThinkPad Laptop, whose disadvantages include a somewhat unconventional keyboard layout, including a PrintScreen key which is in between the right Alt and Ctrl keys. I always hit it by accident and launch Spectacle when I don't mean to. On X11, I have re-maped the keys such that the PrintScreen key is a second Meta key, which is super handy, and I turn the useless Insert key at the top of the keyboard into a PrintScreen key. I use XModMap for this on X11: $ cat ~/.Xmodmap ! Print Screen => Meta keycode 107 = Super_L ! Insert => PrintScreen keycode 118 = Print However this obviously doesn't work on Wayland, and I haven't found another way to do it. It would be nice if KWin somehow supported this officially, in its capacity as an input-handling compositor.
Created attachment 135578 [details] PrintScreen key configure
Nate, Xmodmap is deprecated even on X11 nowadays. XKB is a platform-agnostic way to go. Basically, you create custom keymap and then select it in keyboard KCM's Keyboard model listbox. Also you could try existing models there. There are some pre-ready keyboard options in Advanced tab of the KCM you could look at, see the bottom of screenshot for Print key.
Thanks. Those pre-existing options don't cut it, because there's no way for me to make the Insert key into PrintScreen. Without that, I won't have a PrintScreen key. I spent 3 hours of web searching and trial and error and did not succeed in creating a custom keyboard layout to reverse these two keys. Using xmodmap is easy, but this xkb thing is torture. This is desperately crying out for a GUI so it can take 30 seconds and always work rather than gobbling up an afternoon and making you feel like a failure.
One of the oldest bugs is requesting this feature: Bug 30481.
I understand you. I did a long way before I could do something useful with XKB, and that knowledge quickly wipes from my head every time :) Still, I managed to do some mapping for remote of my Kodi box (make use of colored buttons). I'll share my config if I find that box again. XKB is very powerful but complicated by nature. That is probably why GUI for it still doesn't exist. It's out of topic here but maybe you faced solutions like this: https://unix.stackexchange.com/a/572878/249796 Feel free to ping me if you need my help with it.
Yet another HOWTO (it says Gnome but it's actually irrelevant): https://www.beatworm.co.uk/blog/keyboards/gnome-wayland-xkb
For "trivial" tasks as remapping physical keys one may consider a more low-level approach of overriding key codes in udev hwdb instead of relying on XKB: https://www.freedesktop.org/software/systemd/man/hwdb.html https://wiki.archlinux.org/index.php/Map_scancodes_to_keycodes
Just realized we don't even have current layout and physical keyboard visualization. See what Gnome and xkbprint can do: https://superuser.com/questions/1293956/show-keyboard-geometry-model-in-gnome Gnome even allows to interactively test your layout, which is extremely useful.
Oh, sorry.. We have it too! There is Preview button in the KCM :)