[Rant] Why is there no sane way to remap keys?
[Rant] Why is there no sane way to remap keys?
shared from: https://lemmy.ml/post/6282553
There is now an update: https://lemmy.ml/comment/6913362#comment-6913362
The rant is obsolete now :)
I recently switched to Hyprland on my laptop and was able to set it up as I like, but I struggle hard to set up keybinds to simply print different characters when pressing certain key combinations.
For example, one small snippet from my
.Xmodmap
(there are more in this file but that’s enough for a minimal working example)keycode 108 = Mode_switch keycode 38 = a A adiaeresis Adiaeresis
This allows me to press the A key in combination with the right Alt key to print an
ä
or anÄ
when shift is pressed, to.wtype and built-in key binding
After some research I found wtype which allows me to write arbitrary text when called with the parameters.
After I learned that Hyprland (or Wayland) does not distinguish between Alt_R and Alt_L (they’re shown as
Alt_R
andAlt_L
in wev with different keysyms, so they’re clearly two different keys) and I accepted it, I just found out that this tool only works when being in a terminal emulator and not in a GUI application so this tool is useless for me.keyd
Then I tried keyd. After setting it up and adding my user to the needed groups and starting the service and trying to figure out how to actually define keymaps I was able to send something when pressing a defined key combination.
But: Nothing else than ASCII.
The dev thinks it’s a Chromium problem based on this issue but it actually isn’t. I wasn’t able to send an
ä
to ANY application, no matter if GUI or terminal or Qutebrowser.Since there is basically no online resources or user community for this tool, I cannot find any usable information on this issue except the unrelated Chrome reference and thus I removed it again because I cannot use it for what I want to use it for.
xkb
For whatever reason Wayland (or Hyprland) uses certain parts of the X keyboard extension, so I also tried this one.
Despite being absurdly complex and annoying to setup I was able to configure a user based keyboard variant using user-based symbols. From what I’ve taken from various sites my config should do nothing more than remapping
Alt_R
toISO_Layer3_Shift
just for testing purposes.But all I achieved was reproducibly crashing Hyprland when setting it up to actually use said keyboard variant and there seems to be no log file.
yeah, that’s where we are
Again, it’s not about the umlauts, and not about the German keyboard layout, and not about switching lkayouts on-the-fly, it’s just to demonstrate what I mean. You can replace ä with any other character you want.
After a long night of trying out to have the Xmodmap functionality in Wayland using Hyprland as compositor I ended up with not being successful.
I give up for now.
Maybe one day there will be an actually working solution requiring nothing more than two lines in a file.