3

I've seen this trick to rebind keys using dconf, but it only seems to work for some target keys:

dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:ctrl_modifier']"

This works just fine for ctrl in this example, but I need to map it to Tab since that key is broken on my keyboard. I tried "Tab", "tab", "horizontal_tab", and all kinds of other variations with no success.

1 Answer 1

2

There are a few ways to achieve this behaviour. It depends a bit on the type of System you're using.

Xorg

You already added xmodmap as a tag to your question, so you probably already know about that.

xmodmap

Referencing the Arch Linux Wiki, you can remap Caps Lock to Tab with

setxkbmap -option caps:tab

Please make sure to add this option to your startup script, e.g. in .xinitrc, as this config will reset itself when rebooting because of how Linux loads your Keymap.

custom keymap and loadkeys

Another way would be using a custom keymap.

Add to /usr/local/share/kbd/keymaps/personal.map:

keycode 58 = Tab
keycode 15 = Caps_Lock

And using loadkeys to load the remapped key layout:

loadkeys /usr/local/share/kbd/keymaps/personal.map

Wayland

Reference: How to customise keyboard mappings with Wayland

2
  • thanks for the tip, but unfortunately the setxkbmap solution does not work either. it doesn't produce any error in the terminal, but caps is still caps, even after rebooting and loading from .xinitrc. it works with ctrl_modifier though, looks like my system simply doesn't recognize tab as a valid symbol.
    – lokus
    Commented Jan 4, 2022 at 13:37
  • 1
    the loadkeys approach doesn't work either, once again no error from loadkeys but also no effect.
    – lokus
    Commented Jan 10, 2022 at 10:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .