Skip to content

screenshot: bind the first wl_seat so the region selector receives input - #4049

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
WyInnovate:fix/region-seat-binding
Oct 31, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
WyInnovate:fix/region-seat-binding

Conversation

@WyInnovate

Copy link
Copy Markdown
Contributor

Description

dms screenshot region renders its overlay but never receives input on compositors that advertise more than one wl_seat. niri with the agent seat is one: it exposes seat0 plus a niri-agent automation seat.

RegionSelector.handleGlobal binds every wl_seat global, assigns it to r.seat and calls setupInput() for each one, so the last seat wins. The selector creates its pointer and keyboard from a seat the user never types on: the surface maps, no events ever arrive, and drag/click/Esc all do nothing — the process has to be killed.

Window and full-screen captures are unaffected (they never open the selector). dms screenshot scroll uses the same selector code path and is equally broken.

The fix keeps the first seat, mirroring the guard the clipboard manager already uses (#3989, which fixed the same failure mode in #3812).

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Related issues

Fixes #4048

Screenshots / video

Not a visual change: the overlay already rendered, only input was dead. Verified locally on niri with seat0 + niri-agent using a build of this branch:

  • before: drag, click and Esc ignored; process hangs until killed;
  • after: dragging a region saves a PNG (1149×644 in my test), and Esc returns {"status":"aborted","error":"User cancelled selection"}.

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • Go changes: make fmt clean and make test passes locally; no unit test added because the selector has no test harness — verified on hardware instead. No dependency changes, so go mod tidy is untouched.
  • QML changes: n/a (Go only)

Compositors may advertise more than one wl_seat: niri exposes seat0 (real
input) alongside a niri-agent automation seat. handleGlobal assigned every
seat to r.seat and called setupInput() for each one, so the last seat won -
the selector created its pointer and keyboard from a seat the user never
types on, and the overlay was deaf (no drag, no click, no Esc).

Keep the first seat, mirroring the guard the clipboard manager already uses
(duxlabs-dev#3989).

Verified on niri with two seats: before, the selector ignored drag/click/Esc
and had to be killed; after, dragging a region saves a PNG and Esc returns
{"status":"aborted"}.
@github-actions github-actions Bot added core Go daemon and CLI under core/ fix labels Oct 31, 2026
@bbedward

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Claude review

Looks good: keeping the first wl_seat fixes the region selector, and the scroll capture too since it goes through the same handleGlobal.
No issues found.

Not part of this PR, but worth a follow-up: core/internal/colorpicker/picker.go:244 has the same bug. It binds every wl_seat and calls setupInput() for each one, so the color picker will also stop getting input on niri with the agent seat. The fix is the same if p.seat != nil { return } guard.

Checked: the seat guard in RegionSelector.handleGlobal, how r.seat is used afterwards (setup check, shortcuts inhibitor), and other places that bind wl_seat in core. Model: claude-opus-5-5.

@bbedward
bbedward merged commit ff2e17d into duxlabs-dev:master Oct 31, 2026
4 checks passed
@WyInnovate
WyInnovate deleted the fix/region-seat-binding branch November 1, 2026 03:16
purian23 pushed a commit that referenced this pull request Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Go daemon and CLI under core/ fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

screenshot: region selector binds the last wl_seat, so the overlay never receives input

2 participants