Skip to content

Allow toggling Caps Lock via both Shift keys#5981

Open
tyvsmith wants to merge 1 commit into
basecamp:devfrom
tyvsmith:caps-lock-shift-both-capslock
Open

Allow toggling Caps Lock via both Shift keys#5981
tyvsmith wants to merge 1 commit into
basecamp:devfrom
tyvsmith:caps-lock-shift-both-capslock

Conversation

@tyvsmith
Copy link
Copy Markdown
Contributor

@tyvsmith tyvsmith commented May 26, 2026

Adds shift:both_capslock alongside the existing compose:caps in default/hypr/input.lua and config/hypr/input.lua. Pressing both Shift keys simultaneously now toggles real Caps Lock; single-Shift behavior is unchanged, and Caps Lock continues to act as the XCompose key.

Why

The current default compose:caps makes Caps Lock the XCompose key — great for emoji, accented characters, and ~/.XCompose shortcuts — but it removes any way to enable real Caps Lock, which is occasionally valuable. More importantly, fcitx5's Wayland input-method grab occasionally desyncs (notably after a Hyprland reload), and when it does, Caps Lock can get stuck "on" with no easy way to toggle it back off — the Compose key is the very thing that's broken. This recurring confusion shows up across closed issues #166, #953, #1792, #2241, #2545, #3238, and #5200.

shift:both_capslock is a stock libxkbcommon option that provides an escape hatch. It costs nothing for users who don't reach for it:

This is purely additive — it restores the missing Caps Lock capability via a discoverable two-Shift chord without changing any existing behavior.

Note on syntax

The XKB option string is comma-separated and must not contain spaces between options. "compose:caps,shift:both_capslock" is correct; "compose:caps, shift:both_capslock" would cause libxkbcommon to silently drop the second option. The change uses the correct space-free form.

Test plan

  • Press both Shifts simultaneously → Caps Lock LED toggles, alphabetic keys produce uppercase.
  • Single Shift still produces uppercase only while held.
  • Caps Lock alone still acts as Compose / Multi_key
  • ~/.XCompose shortcuts still work.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tyvsmith tyvsmith marked this pull request as ready for review May 26, 2026 20:43
Copilot AI review requested due to automatic review settings May 26, 2026 20:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds the shift:both_capslock XKB option so that pressing both Shift keys simultaneously toggles Caps Lock, in addition to the existing compose:caps setting.

Changes:

  • Append shift:both_capslock to kb_options in the default Hyprland input config.
  • Append shift:both_capslock to kb_options in the user Hyprland input config.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
default/hypr/input.lua Adds both-shift Caps Lock toggle to default keyboard options.
config/hypr/input.lua Adds the same option to the user-facing config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silopolis
Copy link
Copy Markdown

Also very much liked the Ctrl + Capslock option proposed in #2545 but as long as I can get back access to those cute uppercase accented characters we "like" in France 🙄 ...
Thanks for bringing this 🙏

@tyvsmith
Copy link
Copy Markdown
Contributor Author

Also very much liked the Ctrl + Capslock option proposed in #2545 but as long as I can get back access to those cute uppercase accented characters we "like" in France 🙄 ... Thanks for bringing this 🙏

From looking around in the community it seemed double shift as an alternate was a bit more common, and I had heard some odd behavior of modifier keys with capslock can happen, thus went with double shift. Happy to switch the PR to ctrl + caps if there's a strong signal to go that direction though.

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.

3 participants