Skip to content

Fix caps:escape_shifted_capslock behavior#9971

Closed
zoriya wants to merge 1 commit into
kovidgoyal:masterfrom
zoriya:fix/caps
Closed

Fix caps:escape_shifted_capslock behavior#9971
zoriya wants to merge 1 commit into
kovidgoyal:masterfrom
zoriya:fix/caps

Conversation

@zoriya

@zoriya zoriya commented May 5, 2026

Copy link
Copy Markdown

Fix #9861

Handle cases where a shifted key produces a different fuction, like the caps:escape_shifted_capslock behavior of the previous issue

@kovidgoyal

Copy link
Copy Markdown
Owner

Your patch only changes the pres/repeat behavior, what about release behavior? Indeed, the whole concept of mapping shift+capslock to esc is a bit bonkers. When is an esc release event generated? wen you release capslock? or when you release shift? What happens if you release caps lock first or shift first? What happens if you release capslock but not shit and then press some other key like A?

Also I dont understand the logic, from what I can tell you want xkb_sym to not be the clean_sym when sym and clean_sym are different and sym is a functional key? Why? Wouldnt you need to check if clean_sym is a functional key as well? And what about if you press ctrl+shift+capslock? What's supposed to happen then?

@zoriya

zoriya commented May 5, 2026

Copy link
Copy Markdown
Author

When is an esc release event generated

An esc press event is triggered on capslocks without the shift, similarly the release event is triggered if capslocks is released while shift is pressed.

Shift is registred as a normal modifier, if you press +shift -> +capslock >- -capslock -> +a -> -a -> -shift you will have this exact sequence of event (so capslock -> A)

I did miss the release event mapping, just pushed a fix.

Also I dont understand the logic, from what I can tell you want xkb_sym to not be the clean_sym when sym and clean_sym are different and sym is a functional key? Why? Wouldnt you need to check if clean_sym is a functional key as well? And what about if you press ctrl+shift+capslock? What's supposed to happen then?

My reasoning was that if the modified value was a function we want to apply that instead of the clean value ; apart with things like caps:escape_shifted_capslock there should not be ways to have the modified key being a function different from the clean one (ex tab keeps the same key code shifted or not)

@kovidgoyal

Copy link
Copy Markdown
Owner

I tried your current patch with

kb_options = "compose:ralt,caps:escape_shifted_capslock"  

in Hyprland by running

kitty --config=NONE --debug-input kitten show-key -m kitty  

That gives me surpassingly weird behavior, caps lock alone gives escape press and release events. Holding down shift and pressing caps lock gives me shift+escape press and releasing capslock gives me shift+capslock+escape release event and then releasing shift gives a shift release event rather than an escape release event.

As I suspected trying to map modifier+key to key is just not going to work well.

@kovidgoyal kovidgoyal closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xkb caps:escape_shifted_capslock option always types escape

2 participants