You are not logged in.

#1 2026-07-09 23:04:36

LenovoLegume
Member
Registered: 2026-07-09
Posts: 2

Toggle CapsLock with Ctrl+CapsLock, make it AltGr otherwise [SOLVED]

Hey there,
I've been trying all day to map the CapsLock function to Ctrl+Caps, while making it behave like AltGr otherwise. Mapping AltGr to it was no problem:

 kb_options = lv3:caps_switch 

but I had a hard time with the other thing. I want this because it is standard on German E1 keyboards for Windows, and I always quite liked it. It gives me a second AltGr on the left side of the keyboard (E1 has a lot of layers for typing lots of languages; I'm a linguist) and makes Caps less annoying, but keeps it available.
I tried a bunch of web searches, but nobody really seemed to want what I want to do, then I asked several chat bots, which taught me some stuff about keymapping, but couldn't help me either (not unlikely because there's nothing to train them on)..
My current state is that xkb apparently can't map different modifier functions to a single key, and no terminal command I tried can turn on and off CapsLock.
I'd prefer something installed just via pacman but I am willing to get something from the AUR if it works.
I'm using hyprland on a Lenovo T16 (AMD) Gen 5.
That's what I tried in my keymap.xkb:

interpret Caps_Lock+Control {
    action= LockMods(modifiers=Lock);
};
interpret Caps_Lock+NoneOf(Control) {
	action= SetMods(modifiers=LevelThree,clearLocks);
}; 

Tools I've tried/the chatbot made me try::
xorg-xset, xdotool, python-evdev, ydotool

Ask me for everything else, I don't really know what information to provide.

Edit: Original title was Toggle CapsLock with Ctrl+Caps-Lock-key, make it AltGr otherwise. Since this was to long to append [SOLVED], I shortened it slightly.

Last edited by LenovoLegume (2026-07-12 21:26:19)

Offline

#2 2026-07-10 06:03:29

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,010

Re: Toggle CapsLock with Ctrl+CapsLock, make it AltGr otherwise [SOLVED]

https://man.archlinux.org/man/xcape.1

lot of layers for typing lots of languages; I'm a linguist

https://wiki.archlinux.org/title/Xorg/K … ompose_key
=> caps+g+l = λ

Offline

#3 2026-07-12 21:20:00

LenovoLegume
Member
Registered: 2026-07-09
Posts: 2

Re: Toggle CapsLock with Ctrl+CapsLock, make it AltGr otherwise [SOLVED]

Thank you!

I decided against a compose key. I did not use xcape (as I worry about wayland compatibility), but this send me down just the right track to stumble over keyd.
I installed it and set the following config file:

 /etc/keyd/default.conf
[ids]
*

[main]
capslock = rightalt  #name of AltGr key, not to be confused with altgr, which is a layer (?)

[control]
capslock = capslock

The configuration is pretty straightforward, except I can't read so it took a while to get the correct term for the AltGr key.

Here's the github page:
https://github.com/rvaiya/keyd
and the man page:
https://man.archlinux.org/man/keyd
for people like me.

Offline

Board footer

Powered by FluxBB