From 63e57e1bd50071ae58a3001f9e20eba39bef7554 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 29 Jul 2026 13:09:45 -0400 Subject: [PATCH] Let a stray both-Shifts Caps Lock clear itself CapsLock is the compose key, so Caps Lock has to live somewhere else, and both Shifts together is where it went. That combination is easy to hit by accident while typing, and the lock then sticks until you notice it and hit both Shifts again. shift:both_capslock_cancel sets the lock exactly the same way, but types the Shift keys as ALPHABETIC rather than TWO_LEVEL, so the next lone Shift releases it. Since a misfire happens while reaching for Shift anyway, it clears itself almost immediately. Compose is untouched: stays [Multi_key, Multi_key], so the ~/.XCompose emoji sequences work as before. Co-Authored-By: Claude Opus 5 (1M context) --- config/hypr/input.lua | 2 +- default/hypr/input.lua | 6 +++++- test/shell.d/hyprland-keyboard-layout-test.sh | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/hypr/input.lua b/config/hypr/input.lua index 9591c0dd..d20be92a 100644 --- a/config/hypr/input.lua +++ b/config/hypr/input.lua @@ -7,7 +7,7 @@ -- input = { -- -- Use multiple keyboard layouts and switch between them with Left Alt + Right Alt. -- kb_layout = "us,dk,eu", --- kb_options = "compose:caps,shift:both_capslock,grp:alts_toggle", +-- kb_options = "compose:caps,shift:both_capslock_cancel,grp:alts_toggle", -- -- -- Use a specific keyboard variant if needed (e.g. intl for international keyboards). -- kb_variant = "intl", diff --git a/default/hypr/input.lua b/default/hypr/input.lua index c3c7d43f..bdcd384f 100644 --- a/default/hypr/input.lua +++ b/default/hypr/input.lua @@ -30,7 +30,11 @@ local vconsole = read_vconsole() local kb_layout = vconsole.XKBLAYOUT or "us" local kb_variant = vconsole.XKBVARIANT or "" -local kb_options = "compose:caps,shift:both_capslock" +-- CapsLock is the compose key, so Caps Lock itself has to live somewhere else. +-- Both Shifts together is the usual home for it, but it's easy to hit by +-- accident while typing. The _cancel variant sets Caps Lock the same way and +-- releases it on the next lone Shift, so a misfire clears itself. +local kb_options = "compose:caps,shift:both_capslock_cancel" -- Hyprland resolves keybindings against the first entry in kb_layout, not the -- layout that's currently active, so Omarchy's Latin-keysym bindings (SUPER + W diff --git a/test/shell.d/hyprland-keyboard-layout-test.sh b/test/shell.d/hyprland-keyboard-layout-test.sh index 68626cc8..8ed6fe38 100644 --- a/test/shell.d/hyprland-keyboard-layout-test.sh +++ b/test/shell.d/hyprland-keyboard-layout-test.sh @@ -55,7 +55,7 @@ assert_input() { pass "$description" } -base_options="compose:caps,shift:both_capslock" +base_options="compose:caps,shift:both_capslock_cancel" toggle_options="$base_options,grp:alts_toggle" assert_input "missing vconsole.conf falls back to us" "[us] [] [$base_options]"