CAps LOck behaviour (Wayland)

Hello, everyone! I’ve finally found the solution, here’s how it goes:

Since the fastest way to change a key behavior on Wayland were through “Additional Layout Options”, I’ve changed one of the options for Caps Lock behavior, the one I chose was “make Caps Lock an additional Ctrl”. All you have to do is, go to “usr/share/X11/xkb/symbols/” and edit the file “capslock” (make a backup before this), then find the behavior called “ctrl_modifier”, it should look like this:

// This changes the <CAPS> key to become a Control modifier,
// but it will still produce the Caps_Lock keysym.
hidden partial modifier_keys
xkb_symbols "ctrl_modifier" {
    replace key <CAPS> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ Caps_Lock ],
        actions[Group1] = [ SetMods(modifiers=Control) ]
    };
    modifier_map Control { <CAPS> };
};

now replace it with this:

// This changes the <CAPS> key to become a Control modifier,
// but it will still produce the Caps_Lock keysym.
hidden partial modifier_keys
xkb_symbols "ctrl_modifier" {
		  key <CAPS> {
		      type="ALPHABETIC",
		      repeat=No,
		      symbols[Group1]= [ Caps_Lock, Caps_Lock ],
		      actions[Group1]= [ LockMods(modifiers=Lock),
		                         LockMods(modifiers=Shift+Lock,affect=unlock) ]
		  };
};

Save it and then go to “Gnome Tweaks” and activate the option “make Caps Lock an additional Ctrl” on “Additional Layout Options - Caps Lock behavior”.

Now your caps lock should be working with no delay! :wink:

P.S: I’ve tried to add a rule instead of replacing one, but it didn’t work, you could try if you don’t want to change anything.

2 Likes