diff --git a/config/hypr/input.lua b/config/hypr/input.lua index d06e05c7..c43ee6da 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_cancel,grp:alts_toggle", +-- kb_options = "omarchy:shift_caps_compose,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 eca41c01..563a3ae7 100644 --- a/default/hypr/input.lua +++ b/default/hypr/input.lua @@ -11,11 +11,9 @@ local vconsole = keyboard.selected() local kb_layout = vconsole.XKBLAYOUT or "us" local kb_variant = vconsole.XKBVARIANT or "" --- 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" +-- Caps Lock is Caps Lock, and Shift + Caps Lock is the compose key. Stock XKB +-- has no such option, so Omarchy defines it in /etc/xkb. +local kb_options = "omarchy:shift_caps_compose" -- 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/default/systemd/user/omarchy-fcitx5.service b/default/systemd/user/omarchy-fcitx5.service index db6eb578..92c4a6bb 100644 --- a/default/systemd/user/omarchy-fcitx5.service +++ b/default/systemd/user/omarchy-fcitx5.service @@ -1,6 +1,6 @@ [Unit] Description=Fcitx5 input methods and XCompose sequences -# fcitx5 turns the CapsLock compose sequences in ~/.XCompose into text for +# fcitx5 turns the Shift + CapsLock compose sequences in ~/.XCompose into text for # Wayland clients. # # Wait for the compositor: fcitx5 needs WAYLAND_DISPLAY and DISPLAY, which uwsm diff --git a/docs/file-layout.md b/docs/file-layout.md index 9831e349..5e5bc980 100644 --- a/docs/file-layout.md +++ b/docs/file-layout.md @@ -91,6 +91,8 @@ config/** ──► omarchy-settings /etc/skel/.config/ /usr/share/omarchy/config/** (resync source) etc/fastfetch/config.jsonc ──► omarchy-settings /etc/fastfetch/config.jsonc etc/xdg/kitty/kitty.conf ──► omarchy-settings /etc/xdg/kitty/kitty.conf +etc/xkb/{rules/evdev,symbols/omarchy} + ──► omarchy-settings /etc/xkb/ (Shift + Caps Lock compose option) applications/*.desktop ──► omarchy-settings /etc/skel/.local/share/applications/ /usr/share/omarchy/applications/ diff --git a/etc/xkb/rules/evdev b/etc/xkb/rules/evdev new file mode 100644 index 00000000..1e94f26b --- /dev/null +++ b/etc/xkb/rules/evdev @@ -0,0 +1,6 @@ +// Omarchy's own XKB option. libxkbcommon reads /etc/xkb before the system +// rules, which supply everything else. +! include %S/evdev + +! option = symbols + omarchy:shift_caps_compose = +omarchy(shift_caps_compose) diff --git a/etc/xkb/symbols/omarchy b/etc/xkb/symbols/omarchy new file mode 100644 index 00000000..c127da40 --- /dev/null +++ b/etc/xkb/symbols/omarchy @@ -0,0 +1,11 @@ +// Caps Lock stays Caps Lock; Shift + Caps Lock is the Compose key. The actions +// are explicit so the Shift level never inherits the key's Lock modifier, +// which would toggle Caps Lock on every compose. +partial modifier_keys +xkb_symbols "shift_caps_compose" { + key { + type[Group1] = "TWO_LEVEL", + symbols[Group1] = [ Caps_Lock, Multi_key ], + actions[Group1] = [ LockMods(modifiers = Lock), NoAction() ] + }; +}; diff --git a/install/user/xcompose.sh b/install/user/xcompose.sh index 17866bd1..afe8c438 100644 --- a/install/user/xcompose.sh +++ b/install/user/xcompose.sh @@ -1,4 +1,4 @@ -# Set default XCompose that is triggered with CapsLock +# Set default XCompose that is triggered with Shift + CapsLock tee ~/.XCompose >/dev/null < Typing > Keyboard Layouts_ to select layouts such as English and Fr Run `omarchy setup keyboard` or `omarchy setup input` to open the same pickers. To append one language from the command line, use `omarchy setup input mozc`, `hangul`, `pinyin`, or `chewing`. Your custom switching keys are preserved. For alternative engine layouts or keys, install `fcitx5-configtool` with `omarchy pkg add fcitx5-configtool` and launch it from a terminal. Selecting an input language does not change the desktop language. -Use `Super + I` to cycle through input methods or keyboard layouts, and `Super + Shift + I` to go back the other way, so with three configured you can move between two neighbours. The input indicator appears on the right of the bar only when more than one input method or layout is configured. This desktop binding works alongside your existing Fcitx switching keys; you can override it in `~/.config/hypr/bindings.lua`. Tapping Shift alone is not an input switch: Omarchy uses both Shift keys for CapsLock, which changes how input methods see Shift release. Input engines and the CapsLock compose sequences use the [Fcitx5](https://fcitx-im.org/) service already running in every session. +Use `Super + I` to cycle through input methods or keyboard layouts, and `Super + Shift + I` to go back the other way, so with three configured you can move between two neighbours. The input indicator appears on the right of the bar only when more than one input method or layout is configured. This desktop binding works alongside your existing Fcitx switching keys; you can override it in `~/.config/hypr/bindings.lua`. Input engines and the compose sequences use the [Fcitx5](https://fcitx-im.org/) service already running in every session. ### Use ALT as SUPER @@ -78,7 +78,7 @@ On some keyboards, it's not convenient to use the primary meta key (Windows/cmd ```lua hl.config({ input = { - kb_options = "compose:caps,shift:both_capslock_cancel,altwin:swap_alt_win", + kb_options = "omarchy:shift_caps_compose,altwin:swap_alt_win", }, }) ``` diff --git a/manual/45-troubleshooting.md b/manual/45-troubleshooting.md index b308e69f..f1894ece 100644 --- a/manual/45-troubleshooting.md +++ b/manual/45-troubleshooting.md @@ -10,18 +10,6 @@ Omarchy assumes a 2x high-resolution display, which requires setting `GDK_SCALE` For Spotify, you can use `Ctrl + Minus` to shrink the UI (and `Ctrl + Plus` to make it bigger). -### Why isn't Caps Lock working? - -In Omarchy, Caps Lock has been designated to be the xcompose key. That's how you get [quick emojis](07-hotkeys.md#quick-emojis) and [other autocompletions](07-hotkeys.md#quick-completions) done. If you really miss using Caps Lock, you can remap the xcompose key to something else by editing `~/.config/hypr/input.lua`, like setting it to the right alt key: - -``` -hl.config({ - input = { - kb_options = "compose:ralt", - }, -}) -``` - ### My Wi-Fi, Bluetooth, audio, or trackpad just stopped working Before you reboot, try restarting the offending subsystem on its own. _Update > Hardware_ in the Omarchy menu has Wi-Fi, Bluetooth, Audio, and Trackpad, and reloading one of those clears up the majority of "it worked five minutes ago" situations — a Bluetooth headset that won't reconnect, a trackpad that went dead after a suspend, sound that vanished when you unplugged a monitor. diff --git a/manual/46-faq.md b/manual/46-faq.md index 5def15d6..9df81db8 100644 --- a/manual/46-faq.md +++ b/manual/46-faq.md @@ -9,7 +9,7 @@ hl.config({ input = { -- Use multiple keyboard layouts and switch between them with Left Alt + Right Alt kb_layout = "us,fr", - kb_options = "compose:caps,shift:both_capslock_cancel,grp:alts_toggle", + kb_options = "omarchy:shift_caps_compose,grp:alts_toggle", }, }) ``` diff --git a/test/shell.d/hyprland-keyboard-layout-test.sh b/test/shell.d/hyprland-keyboard-layout-test.sh index 106fc7c3..95cffb73 100644 --- a/test/shell.d/hyprland-keyboard-layout-test.sh +++ b/test/shell.d/hyprland-keyboard-layout-test.sh @@ -3,6 +3,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh" require_command lua +require_command xkbcli resolved_input_for() { local module="$1" @@ -94,7 +95,7 @@ assert_greeter_input() { assert_resolved_input resolved_greeter_input "$@" } -base_options="compose:caps,shift:both_capslock_cancel" +base_options="omarchy:shift_caps_compose" toggle_options="$base_options,grp:alts_toggle" assert_input "missing vconsole.conf falls back to us" "[us] [] [$base_options]" @@ -117,6 +118,11 @@ XKBVARIANT=phonetic assert_input "non-latin layout in front gains us even when us trails" "[us,il,us] [,] [$toggle_options]" 'XKBLAYOUT=il,us ' +caps=$(xkbcli compile-keymap --include "$ROOT/etc/xkb" --include-defaults --layout us,ru --options omarchy:shift_caps_compose | grep -A5 'key ') +[[ $caps == *"Caps_Lock,"*"Multi_key ]"* && $caps == *"LockMods(modifiers=Lock),"*"NoAction() ]"* ]] || + fail "Shift + Caps Lock composes without toggling Caps Lock" "$caps" +pass "Shift + Caps Lock composes without toggling Caps Lock" + # The greeter takes no compose or capslock options: they're session comfort # settings with nothing to do with typing a password. assert_greeter_input "greeter falls back to us without vconsole.conf" "[us] [] []"