Best/Correct way to remap modifier keys permanently in Tumbleweed?


I want to rebind capslock key to HYPER and the right Ctrl key to SUPER. Preferably for all users, and in a way that is permanent and not overwritten by system updates.

I found some ways to do it using localectl and by modding the /usr/share/X11/xkb/symbols/pc file. But they keep getting overwritten by system updates and I have to redo it all over again…

Is there a better/recommended/best practice way on how to modify keys on Tumbleweed?

I do not know specifically about the configuration of keys, but in general, you should not alter files in /usr/share/ (for the reasons you already noted), but in the equivalent files in /etc/. The documentation should tell you more (e.g. if the ones in /etc, when existing, are a replacement of the those in /usr/share, or if entries there are additional to and/or have priority over the same ones in /usr/share).

You could try if configuring what you want in /etc/X11/xkb/symbols/pc does work for you. When yes, the those will not become overwritten by an update.

1 Like

The obvious first question is - are you using X11 or Wayland?
The possibly relevant second question - what Desktop Environment?

1 Like

Yes of course, that is needed info to give a proper reply.

Using X11 together with XFCE / StumpWM.

You should be able to set XkbOptions either directly in /etc/X11/xorg.conf.d or via localectl. AFAIU caps:hyper makes CAPS the Hyper key and ctrl:swap_rwin_rctl swaps meaning of the two keys making the right control the Win key (which is normally Super).