How to remap caps lock to ctrl while keeping ctrl as ctrl?

I have remapped my caps lock to ctrl in x11 with the following code:

xkbOptions = "ctrl:swapcaps";

and I have enabled it in console with the following code:

useXkbConfig = true;

It worked and cap lock now worked as ctrl, but at the same time the ctrl now worked like cap lock. It is possible for me to keep the ctrl as ctrl while map cap locks to ctrl?

I am currently running nixos in a 2017 MacBook Pro.


caps:ctrl_modifier   Caps Lock is also a Ctrl

(Source: List of all setxkbmap configuration options (including models/layout/etc) · GitHub)

1 Like

That gist is awesome, thank you! Tried with your code and checked through the gist, I think the correct mapping should be done with ctrl:nocaps .