Hyprland plugin: Cua-Agent wl_seat globals are advertised to every client, breaking single-seat apps (imv SIGFPE)
Primary area
Cua Driver
Summary
The Hyprland input plugin registers its Cua-Agent / Cua-Agent-2 seats as ordinary wl_seat globals (wl_global_create(..., &wl_seat_interface, 9, ...) in input_experiment.cpp) with no global filter, so every Wayland client sees three seats. Clients that only support one seat typically keep the last wl_seat they bind, which is an agent seat, not the user's Hyprland seat. That agent keyboard sends repeat_info(0, 0).
The visible failure: imv-wayland 5.0.1 (current Arch package) crashes with SIGFPE on every image, because it computes 1000 / rate. imv fixed that divide upstream in 696f297 (not yet released). Even with that fix, a single-seat client bound to an agent seat gets no real user keyboard input. That last point is inferred from imv's seat handling; I haven't tested it.
Reproduction
- Omarchy (Hyprland 0.56.2) with
cua-hyprland-pluginloaded (hyprctl plugin listshowscua-hyprland-plugin 0.1.0). WAYLAND_DEBUG=1 imv-wayland some.png
Expected behavior
Ordinary desktop clients see only the user seat, or are otherwise unaffected by the agent seats. Agent seats are hidden from clients that aren't agent targets, e.g. via wl_display_set_global_filter, or are exposed only through a dedicated protocol.
Actual behavior
wl_registry#2.global(1, "wl_seat", 9)
wl_registry#2.global(73, "wl_seat", 9)
wl_registry#2.global(74, "wl_seat", 9)
wl_seat#4.name("Hyprland")
wl_seat#10.name("Cua-Agent")
wl_seat#11.name("Cua-Agent-2")
-> wl_seat#11.get_keyboard(new id wl_keyboard#35)
wl_keyboard#35.repeat_info(0, 0)
Floating point exception (core dumped)
The coredump backtrace is keyboard_repeat (idiv) inside wl_display_roundtrip_queue during imv startup. For comparison, foot (which is multi-seat aware) receives repeat_info(40, 250) from the user seat and works normally.
Environment
- Arch/Omarchy (Edge channel), kernel 7.2.5, Hyprland 0.56.2-3
- cua-hyprland-plugin 0.1.0 from cua-driver-rs-v0.26.1 (source rev cc54254), locally packaged with a downstream independent-keymaps patch. Same
wl_global_create/sendRepeatInfo(0, 0)code is onmain. - imv 5.0.1-2 (Arch)
Evidence
- Stopping fcitx5 (which owns Hyprland's main keyboard) makes no difference. The crash follows the agent seat.
- A local build of imv master (with 696f297) opens images fine under the same plugin.
Workaround and additional context
Unload the plugin, or build imv from master. repeat_info(0, 0) is valid per the protocol, so imv's crash is imv's bug; the plugin-side issue is that the agent seats leak into every client's registry.
Zed 1.21.0 is a concrete case of the untested part: a client that keeps the last seat gets no user input.
On Hyprland 0.56.2 with cua-hyprland-plugin 0.1.0, WAYLAND_DEBUG=1 zeditor --foreground shows Zed binding the Hyprland seat, then releasing that wl_keyboard and wl_pointer as Cua-Agent and Cua-Agent-2 appear. The keymap and text-input enter that follow are on Cua-Agent-2 (repeat_info(0, 0)). No wl_pointer.enter, wl_keyboard.enter, button, or key events arrive on the Hyprland seat. The window still renders, and Hyprland still reports it focused.
env -u WAYLAND_DISPLAY zeditor uses XWayland and input works. Foot on the same session is unaffected.
Write-up, including the trace and the launcher workaround: https://gist.github.com/cfaulkingham/f3709534a8356153a96a9a76c56e8b8b
Maintainer decision: agent-seat visibility on Hyprland
Thank you @l0cka for the precise trace and @cfaulkingham for the Zed case.
What we learned
- With the plugin loaded, every client sees the
Cua-Agentseats. An app that supports only one seat ends up on an agent seat. imv then crashes on the agent keyboard'srepeat_info(0, 0), and Zed drops the user's seat and receives no user input. - Isolated background input depends on the target app binding the agent seat, because the plugin delivers through that app's own pointer and keyboard on the seat. Hiding the seats from every client except the driver, as #4264 does, would make every isolated action fail.
- A single-seat app can only use one seat, so for that app, isolated background input and normal user input exclude each other. We will document that instead of hiding it.
Decision
- Now: agent keyboards send the user seat's repeat rate and delay instead of
(0, 0), once we have confirmed that the driver's press/release timing cannot trigger client-side repeat. This stops the imv crash without changing who can bind the seats. - Next: an agent seat exists only while a lane is in use.
- The plugin creates a lane's
wl_seatglobal when an admitted isolated-input session claims the lane, and removes it when the session ends or the lane goes idle. When no agent is working, apps see only the user's seat. - The first isolated action on a new seat waits a bounded time for the target to bind it. If the target never does, the action is refused with an explicit reason, as #3550 requires. It never falls back to the user's seat.
- The plugin does not install a display-wide global filter. libwayland keeps one filter per display and cannot hand back Hyprland's, so a plugin filter cannot be removed safely on unload.
- The plugin creates a lane's
- Docs: the Hyprland guide says that while an agent session runs, a single-seat app may follow the agent seat and ignore user input until the session ends.
Rejected for now: visibility based on process name (/proc/<pid>/comm is not an identity), a plugin-owned global filter, and per-target filtering. We can revisit the last one with an upstream Hyprland hook if seat lifetime alone proves insufficient.
Acceptance evidence: in a live Hyprland 0.56 session, with a single-seat client (imv or Zed) running beside the target:
- an isolated background click and key reach a real unfocused app;
- the seat appears and disappears around a session;
- imv and Zed keep user input outside sessions;
- the plugin unloads and reloads, and a client that connects afterwards still works.
Next steps: #4264 will be reworked toward item 2, keeping @lorenzozanee as author, or item 1 can land first as its own small PR. #4230's extra lanes build on the same lifetime rule.