omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

[Bug] Modifier key (Shift) release events dropped with fcitx5-rime — Shift cannot switch Chinese/English (Hyprland 0.56.2 keybinds refactor regression)

Open jfdnet opened this issue 3 months ago • 5 comments

[Bug] Modifier key (Shift) release events dropped with fcitx5-rime — Shift cannot switch Chinese/English (Hyprland 0.56.2 keybinds refactor regression)

Summary

On Omarchy 4.0.0-1 (shipped Hyprland 0.56.2), when fcitx5-rime is the active IME, press events for the Shift modifier key reach the IME but the release events are dropped. This breaks Shift-to-toggle-Chinese/English for all Rime-based IME users, and additionally leaves fcitx5's modifier state stuck (every subsequent key carries the Shift modifier until something else clears it).

This is an upstream Hyprland bug (reported to hyprwm/Hyprland as #15886, auto-closed by the bot which requires a discussion first). Since Omarchy ships Hyprland 0.56.2 and this affects Omarchy users out of the box, reporting here so it can be tracked/pinned/fixed on this distribution.

Omarchy & System Details

  • Omarchy: 4.0.0-1
  • Hyprland: 0.56.2, commit efb50993780079460b0cbed1363e2166a2de1d9f (2026-08-05, includes keybinds refactor #15568)
  • Kernel: 7.1.8-arch1-3
  • CPU/GPU: Intel Panther Lake + NVIDIA RTX 5060 Max-Q (desktop renders on Intel)
  • IME: fcitx5 5.1.21 + fcitx5-rime 5.1.14 (Wayland native input method protocol v1)

Steps to reproduce

  1. Use the default Omarchy setup (Hyprland + fcitx5-rime with 万象/wanxiang or any Rime schema).
  2. In Rime, configure the standard ascii_composer Shift toggle (switch_key: Shift_L: commit_code).
  3. Focus a text input (e.g. ghostty), ensure fcitx5 is active.
  4. Tap the left Shift key.

Expected: Chinese ⇄ English toggles (Rime's ascii_composer toggles on Shift release within 500 ms). Actual: nothing happens; fcitx5's Shift modifier state gets stuck.

Evidence (fcitx5 debug log, rimeengine.cpp:447 "Rime receive key")

Physical Shift tap — 5 presses, 0 releases:

Aug 18 10:58:05 Rime receive key: Key(Shift_L states=16) 0   <- press
Aug 18 10:58:06 Rime receive key: Key(Shift_L states=16) 0   <- press
Aug 18 10:58:06 Rime receive key: Key(Shift_L states=16) 0   <- press
Aug 18 10:58:06 Rime receive key: Key(Shift_L states=16) 0   <- press
Aug 18 10:58:06 Rime receive key: Key(Shift_L states=16) 0   <- press
(no "… 1" release event ever arrives)

Normal keys in the same window deliver press+release correctly (0=press, 1=release):

Aug 18 10:58:01 Rime receive key: Key(a states=16) 0   <- press
Aug 18 10:58:01 Rime receive key: Key(a states=16) 1   <- release
Aug 18 10:58:02 Rime receive key: Key(a states=16) 0   <- press
Aug 18 10:58:02 Rime receive key: Key(a states=16) 1   <- release

After the dropped release, the Shift modifier stays stuck on subsequent keys:

Aug 18 10:58:11 Rime receive key: Key(d states=16) 0
Aug 18 10:58:11 Rime receive key: Key(e states=16) 0
Aug 18 10:58:11 Rime receive key: Key(space states=16) 0

Even wtype (virtual keyboard) injection mostly loses Shift releases: 16 presses reached the IME, only 2 releases.

Root cause analysis (upstream)

  • Regression window: keybinds refactor hyprwm/Hyprland#15568 "keybinds: refactor, clean up code, move to new style" (merged 2026-08-05 — exactly this build's date). src/keybinds/ has had no commits since, so 0.56.2 ships the refactor with no follow-up fixes.
  • The release-drop is somewhere between IKeyboard's key listener (which emits releases fine — normal keys prove it) and CInputMethodKeyboardGrabV2::sendKey (which has no filtering). Candidates: CKeybindManager::onKeyEvent release handling, or the shareKeyFromAllKBs merge in CInputManager::onKeyboardKey.
  • This machine has 6 keyboard devices (video-bus ×2, intel-hid-events, power-button, sleep-button, at-translated-set-2-keyboard); the multi-keyboard state merge may also be involved.

Workaround (verified working on this machine)

Since the Shift press reliably reaches the IME, toggle ascii_mode on press via a Rime Lua processor instead of relying on the release event (with a 300 ms window to distinguish taps from chords):

-- ~/.local/share/fcitx5/rime/lua/wanxiang/shift_toggle.lua
local M = {}
local get_ms = (rime_api and rime_api.get_time_ms) or function() return os.time() * 1000 end
local WINDOW_MS = 300
local shift_press_time, shift_toggled = 0, false
local function is_shift(r) return r == "Shift_L" or r == "Shift_R" end
local function toggle(ctx) ctx:set_option("ascii_mode", not ctx:get_option("ascii_mode")) end
function M.func(key, env)
    local ctx, now = env.engine.context, get_ms()
    if key:release() then return 2 end
    local repr = key:repr()
    if is_shift(repr) and not (key:ctrl() or key:alt() or key:super()) then
        if now - shift_press_time < WINDOW_MS then
            if shift_toggled then toggle(ctx); shift_toggled = false end
            shift_press_time = 0
            return 2
        end
        if shift_toggled then shift_toggled = false end
        if ctx:is_composing() then ctx:commit() end
        toggle(ctx); shift_toggled = true; shift_press_time = now
        return 2
    end
    if shift_toggled then
        if now - shift_press_time < WINDOW_MS then toggle(ctx) end
        shift_toggled = false
    end
    return 2
end
return M

Plus set ascii_composer.switch_key: Shift_L: noop / Shift_R: noop to disable Rime's release-based toggle (avoid double-toggle once upstream fixes the release delivery).

Ask

  • Can Omarchy track/pin this Hyprland regression (and possibly carry a patch or bump Hyprland when the upstream fix lands)?
  • Happy to provide more diagnostics (wev comparisons, bisect builds) or help test a fix.

jfdnet avatar Aug 18 '26 03:08 jfdnet

Same code path, different key. Hyprland merges pressed-key state across all keyboards (CInputManager::shareKeyFromAllKBs, src/managers/input/InputManager.cpp L1645-L1659 @ v0.56.2) and drops a release while any other keyboard still reports the key pressed. That other keyboard's entry is never cleared, so one lost release on one HID interface (here: the NuPhy dongle's second keyboard interface, kernel EVIOCGKEY shows KEY_E held on /dev/input/event9) turns every later press of that key into press-without-release. With fcitx5's grab in the path, fcitx5's own repeat timer then re-injects the key until the next keystroke.

Two corrections to the analysis above: it is not a 0.56.2 regression. v0.56.1 has identical code, and the merge was added by hyprwm/Hyprland#11214 (2025-08-04), first shipped in v0.51.0. And share_states = false per device does not exist / does not help; only enabled = false on the offending device does, because shareKeyFromAllKBs skips disabled keyboards.

Deterministic repro with two uinput keyboards, full evidence chain (evdev, fcitx5 grab log, WAYLAND_DEBUG) and a suggested fix: https://github.com/hyprwm/Hyprland/discussions/16275.

Omarchy-side workaround that worked here: hl.device({ name = "<the secondary keyboard device>", enabled = false }) in ~/.config/hypr/input.lua, then unplug/replug the keyboard to clear the stale key for real. Find the offending device with:

# prints the kernel's held-key set per input device; look for a non-empty list on a device you never type on
import os, fcntl, array, glob
KEY_MAX = 0x2ff; n = (KEY_MAX + 7) // 8
for dev in sorted(glob.glob('/dev/input/event*')):
    fd = os.open(dev, os.O_RDONLY | os.O_NONBLOCK)
    name = array.array('B', [0]*256); fcntl.ioctl(fd, (2<<30)|(ord('E')<<8)|0x06|(256<<16), name, True)
    keys = array.array('B', [0]*n)
    try: fcntl.ioctl(fd, (2<<30)|(ord('E')<<8)|0x18|(n<<16), keys, True)
    except OSError: os.close(fd); continue
    down = [i for i in range(KEY_MAX) if keys[i>>3] & (1 << (i&7))]
    print(dev, name.tobytes().split(b'\0')[0].decode(), down); os.close(fd)

michsob avatar Sep 16 '26 11:09 michsob

Second data point for @michsob's analysis, from hardware with no dongle and no multi-interface keyboard — a stock Omarchy install on a Dell laptop. Posting because it widens the blast radius of shareKeyFromAllKBs beyond exotic keyboards, and because two details differ from the evidence chain in hyprwm/Hyprland#16275.

Symptom

Occasionally a single ordinary letter runs away — vvvvvvvvvvvvvv… — and stops the instant any other key is pressed. The key never feels stuck or gritty, and the machine is new, so debris is not a plausible cause. Matches the "writeeeeee" effect described in #16275 exactly, and also hyprwm/Hyprland#15968 (independent report, same symptom, closed as not planned).

System

  • Omarchy 4.0.4-1, Hyprland 0.56.2-2 (efb50993780079460b0cbed1363e2166a2de1d9f), kernel 7.2.5-3-omarchy
  • Dell XPS 13 DX13260, BIOS 1.6.0
  • fcitx5 5.1.22-1 via the stock omarchy-fcitx5.service, stock 10-omarchy-fcitx.conf env (INPUT_METHOD/QT_IM_MODULE/XMODIFIERS/SDL_IM_MODULE=fcitx)
  • fcitx5-rime is not installed. The fcitx5 profile contains only keyboard-us / DefaultIM=keyboard-us
  • kb_layout = de (from vconsole.conf), stock kb_options = compose:caps,shift:both_capslock_cancel

1. It is not rime-specific

The title scopes this to fcitx5-rime, but there is no rime here — fcitx5 runs purely as Omarchy ships it, for ~/.XCompose sequences. If the same code path is responsible, then every default Omarchy install is exposed, not just IME users, because omarchy-fcitx5.service is enabled by install/user/first-run/enable-user-units.sh and the env file points GTK/Qt/SDL at it.

2. No dongle required — vendor pseudo-keyboards are enough

hyprctl devices reports eight keyboard-class devices, of which exactly one can be typed on:

video-bus                     main=False
intel-hid-events              main=False
power-button                  main=False
sleep-button                  main=False
dell-privacy-driver           main=False
dell-wmi-hotkeys              main=False
at-translated-set-2-keyboard  main=False   <- the real one (isa0060/serio0, internal PS/2, single interface)
hl-virtual-keyboard-fcitx5    main=True

No NKRO/boot-mode split, no wireless report loss. Just six ACPI/WMI pseudo-keyboards that a laptop vendor ships, each of which emits key events and each of which shareKeyFromAllKBs lets veto a release. This is the stock configuration of an ordinary laptop.

That also removes the documented recovery path: "unplug the device to clear its m_pressed" does not exist for dell-wmi-hotkeys or intel-hid-events. And the enabled = false workaround is only partly available here — power-button carries the XF86PowerOff bind for Omarchy's power menu (logind has HandlePowerKey=ignore), so it cannot simply be disabled.

Side note matching omacom/omarchy#9552: the main flag sits on hl-virtual-keyboard-fcitx5, not on the typed-on keyboard.

3. The kernel is clean here — the stale entry is above it

Running the EVIOCGKEY script from the comment above across all 15 /dev/input/event* nodes, at 2d8h uptime:

/dev/input/event0      Lid Switch                             []
/dev/input/event1      Power Button                           []
/dev/input/event2      Sleep Button                           []
/dev/input/event3      AT Translated Set 2 keyboard           []
/dev/input/event4      Video Bus                              []
/dev/input/event5      Intel HID events                       []
/dev/input/event6      GXTP7863:00 27C6:0D4A Mouse            []
/dev/input/event7      LXST2024:00 1FD2:5010                  []
/dev/input/event8      GXTP7863:00 27C6:0D4A Touchpad         []
/dev/input/event9      PC Speaker                             []
/dev/input/event10     Dell Privacy Driver                    []
/dev/input/event11     Dell WMI hotkeys                       []
/dev/input/event12     sof-soundwire HDMI/DP,pcm=5            []
/dev/input/event13     sof-soundwire HDMI/DP,pcm=6            []
/dev/input/event14     sof-soundwire HDMI/DP,pcm=7            []

All empty — unlike the NuPhy case, where the kernel itself held KEY_E. The reporter in hyprwm/Hyprland#15968 likewise confirmed via evtest that kernel-level press/release pairs were clean while the burst was running.

So if this is the same bug, the stale entry lives in Hyprland's own per-keyboard m_pressed, not in the kernel — a variant the current evidence chain does not cover, and one that no amount of unplugging or EVIOCGKEY inspection will reveal. It would also explain why it presents as intermittent rather than permanent: a compositor-side entry is cleared by a Hyprland restart, whereas a kernel-side one survives until the device is re-enumerated.

What this is not

I have not captured a burst under instrumentation. The kernel state above was sampled while the system was behaving, so this is a symptom-plus-topology report, not a confirmed instance of the exact code path. If someone can suggest a way to dump Hyprland's per-keyboard m_pressed at runtime (there appears to be no hyprctl for it), I am happy to run it and report back the next time it fires.

Why it matters for Omarchy specifically

The combination that triggers this is entirely stock: fcitx5 enabled by default for XCompose, plus any laptop whose vendor ships hotkey/privacy/WMI input devices. That is most laptops. Worth considering whether Omarchy should ship enabled = false defaults for the pseudo-keyboards that are safe to disable, or carry a patch until hyprwm/Hyprland#16275 gets a maintainer response.

tobiasbischoff avatar Sep 19 '26 19:09 tobiasbischoff

The Shift toggle failure reproduces on a stock Omarchy worker, and the cause is Omarchy's default keymap, not Hyprland dropping the release. The release does arrive, just under a different keysym.

What happens. The default kb_options in default/hypr/input.lua is compose:caps,shift:both_capslock_cancel. That option puts Caps_Lock on the second level of both Shift keys. When Shift is released, Shift is still held, so the release resolves to Caps_Lock instead of Shift_L. Rime's ascii_composer only toggles on a release whose keysym is Shift_L or Shift_R (librime ascii_composer.cc), so it never sees the tap. A log filtered on Shift_L shows presses and no releases, which matches the evidence above. This is the mechanism #7440 describes.

Reproduced on a worker built from the Omarchy ISO (Hyprland 0.56.2, fcitx5 5.1.22). A uinput keyboard sent a real Shift tap through the kernel input path while foot had focus, and fcitx5's key trace was read:

default kb_options:  Release:1  Key(Shift+Caps_Lock states=1)  keycode: 50
compose:caps only:   Release:1  Key(Shift+Shift_L states=1)    keycode: 50

wtype bypasses this: it sends its own keymap, so injected Shift looks clean while physical Shift does not.

Shift is not stuck. states=16 in an fcitx5 Key(...) line is Num Lock (Mod2), which Omarchy turns on by default. A held Shift would read states=17. The a presses in the same log carry 16 too.

Fix. Open pull request #10565 drops shift:both_capslock_cancel from the default, and with that option gone the release comes back as Shift_L. Until it lands, setting kb_options = "compose:caps" in ~/.config/hypr/input.lua, then running hyprctl reload and restarting fcitx5, is the workaround. That also makes the Lua shift_toggle processor above unnecessary. I tried to mark #10565 as fixing this issue, but it was refused because #10565 has been pushed to since it was last classified. That link is left for the maintainer.

Not covered here. The runaway repeating letters in the two comments are a different symptom with a different suspected cause (Hyprland's shareKeyFromAllKBs suppressing a release while another keyboard device still reports the key down). The keymap does not explain them, and this review did not establish or reproduce them. They would be better tracked in an issue of their own, upstream at hyprwm/Hyprland#16275. The reporter's wtype count (16 presses, 2 releases) is also not explained by this mechanism.

Reviewed by Claude Opus 5.5 and independently by Codex Medium. Codex reached the same mechanism from the libxkbcommon keymap and the fcitx5 and librime source, and it agreed the runaway-key reports need separate diagnosis; its independence is not guaranteed. This now waits on the maintainer's decision on #10565.

omarchybot avatar Oct 08 '26 09:10 omarchybot

Adding another data point for the default-fcitx5/Hyprland modifier-and-repeat bug class on a current Omarchy install.

System

  • Omarchy 4.5.0-3
  • Kernel 7.2.15-1-omarchy
  • Hyprland 0.56.2 (package 0.56.2-4)
  • fcitx5 5.1.23
  • MSI laptop (MS-16F4) with built-in keyboard, no external keyboard attached

Symptom

Occasional random key repeat and stuck Shift/Caps Lock. At one point Caps Lock would not toggle off and a Shift key appeared held/repeating, making password entry unusable. TTY (Ctrl+Alt+F3) remained usable, so this is compositor/input-method state rather than a dead key.

Evidence tying it to the fcitx5 virtual keyboard

Before disabling fcitx5, hyprctl devices showed:

  • hl-virtual-keyboard-fcitx5 with main: yes
  • physical at-translated-set-2-keyboard with main: true
  • video-bus, video-bus-1, power-button, power-button-1, msi-wmi-hotkeys

Relevant options:

  • input:virtualkeyboard:share_states = int: 2
  • input:virtualkeyboard:release_pressed_on_close = bool: false

I ran systemctl --user disable --now omarchy-fcitx5.service. The hl-virtual-keyboard-fcitx5 device disappeared from hyprctl devices, the physical keyboard continued to work normally, and the user reports no recurrence during the subsequent observation period. A kernel EVIOCGKEY scan taken during a quiet period showed no held keys, so there was no stuck hardware key state at capture time.

This is the stock Omarchy setup: the user does not use an IME and only needs ~/.XCompose. kb_options = "omarchy:shift_caps_compose" is in play, which maps Shift+Caps to Multi_key; this is distinct from the older shift:both_capslock_cancel Rime issue in #7440.

Why I am commenting instead of filing a duplicate

This matches the existing shareKeyFromAllKBs / fcitx5 input-method path described in this issue and in #5598, #13175 and #7346, and the opt-in request in #17148. It adds a current 4.5.0-3 data point where simply disabling omarchy-fcitx5.service removes the virtual keyboard from the input path. Please consider gating fcitx5 behind opt-in setup for users who only need Compose, or documenting a supported way to disable it without losing XCompose.

Filed by Big Pickle via OpenCode.

iverlaek avatar Nov 26 '26 10:11 iverlaek

@iverlaek, your omarchy:shift_caps_compose setting already uses the replacement for the old Shift mapping. #14939 shipped in v4.5.0; its XKB option changes only the Caps Lock key. The earlier candidate #10565 was closed without merging. The old shift:both_capslock_cancel explanation therefore does not account for your new report.

No recurrence after stopping fcitx5 is useful evidence, but does not identify where the key state was lost. A kernel scan taken while typing was normal cannot rule out a held key during the failure. Please add:

  1. The affected application, whether it is native Wayland or XWayland, and whether the incident follows a focus-changing shortcut, a tab closing, or Shift+CapsLock. #13175 describes a specific focus-change trigger; #5598 describes modifiers across keyboards. Neither is established here.
  2. How often it happened before disabling fcitx5 and how long you observed it afterwards. Please include the service journal for that interval (journalctl --user -u omarchy-fcitx5.service): disable --now does not prevent D-Bus activation from starting it again.
  3. During an occurrence, before restarting anything, repeat the kernel held-key snapshot and capture hyprctl devices -j. If it reproduces in wev, include a short key/modifier trace using harmless test text, and note whether moving focus clears the problem.

Omarchy currently uses fcitx5 for its XCompose sequences; preserving compose across applications with it disabled has not been verified here. The opt-in proposal remains tracked in #17148 for the maintainer.

Reviewed against current source by GPT-6 High in Codex, with Opus 5.5 High and muse-wonder via pi at high thinking as second reviewers. They agreed the cause remains unproven and also flagged possible D-Bus reactivation; independence is not guaranteed. No new worker reproduction was attempted. This waits on the incident details above.

omarchybot avatar Nov 26 '26 11:11 omarchybot