After around 2 days of googling an answer to the question
"how to remap keys on wayland" I have managed to find a very, very simple
way. I dont know if its the right way but it actually works.
The only thing that I had to do is open the file
/usr/share/X11/xkb/keycodes/evdev
That file lists all the keycodes for all the keys in the form < code > = number
You can simply swap the keycodes around. What I actually swapped around is the numbers NOT the code. I changed backslash which on dvorak is next to Enter with Ctrl for Emacs.
edit: to find out which "code" represents each key as in < code > = number you can run the xev
command from the terminal to get the keycode printed in the terminal after pressing the button (search for that keycode in the evdev file to get the evdev scancode for the key), or you can visit
/usr/share/X11/xkb/symbols/
This is a directory which has one file for each language installed on the computer and modifier keys. Select the language your pc runs on.
In that file there will be all variants supported listed, such as dvorak, programmers dvorak, colemans etc etc.
There you can see the < code > names
Same as tranfuria's answer but on command line:
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"
Best Answer
You can use the following command in terminal:
To get this change for every session, after you have run the previous commands create a file called
.xmodmap
with the new keymaps, using the following command:Then, create a file called
.xinitrc
in your home directory, containing the following line/command: