0

I wanted to remap CapsLock to work as escape, and I did it. What I did was:

setxkbmap -option caps:escape

But that method has a problem. Whenever I press CapsLock, on top it of working as escape, it also locks capitals. My question is, is there any way in which I can make CapsLock not lock capitals, but keep its new function? (and please, if possible, in case your method makes the LED light up, help me turn it off). I want this to work with vim, but I think it would be more appropriate to remap it at an OS level.

As the saying goes, "I use Arch btw"

Thank you very much.

Edit: Finally solved it!

setxkbmap -option caps:swapescape
  • Weird, that should not happen... What does setxkbmap -query tell us? – Quasímodo May 31 '20 at 17:16
  • There you go ("|" separates lines for you to understand it better):

    rules: evdev | model: pc105 | layout: latam,us,us | variant: ,, | options: caps:escape,grp:caps_toggle,grp_led:scroll |

    – Bix Moo May 31 '20 at 18:04
  • Please add that information directly in the answer ([edit] it). As it seems, caps:escape and grp:caps_toggle "compete" for the CapsLock key and result in that behavior. See issue grp:caps_toggle doesn't work with ctrl:swapcaps in Github. – Quasímodo May 31 '20 at 18:19
  • Sorry but I don't know what to do with that information. I went to /usr/share/X11/xkb/rules/evdev and I haven't found anything (iirc) that defined capslock. That means there's no way to remap capslock? – Bix Moo May 31 '20 at 18:36
  • That information simply tells you that you can't have both options consistently. Do you really use those different keyboard layouts? You did not even mention it in the question. If yes, do you really need CapsLock to do that? If not, the answer is really simple. Do you know setxkbmap -option grp:caps_toggle was issued? That is what the -query says. – Quasímodo May 31 '20 at 19:29
  • Do you know then how to remap it exclusively for vim? – Bix Moo May 31 '20 at 22:24

1 Answers1

0

sorry, I cant comment yet, so can you try this answer? it is about hard remapping keys.

https://unix.stackexchange.com/a/170357/235896

I wont copy the contents here as is from this same site and any updates there wont be reflected here. (mmm it would be good if we could nest another answer in our so that it could be externally updated!)