Skip to content

Add Weston-compatible Wayland capture - #15

Draft
chruffins wants to merge 5 commits into
masterfrom
hypeship/wayland-capture-v2
Draft

Add Weston-compatible Wayland capture#15
chruffins wants to merge 5 commits into
masterfrom
hypeship/wayland-capture-v2

Conversation

@chruffins

@chruffins chruffins commented Aug 20, 2026

Copy link
Copy Markdown

summary

  • add opt-in Wayland screencopy capture and uinput desktop control
  • harden keyboard, mouse, scroll, framerate, and input-device lifecycle handling
  • support a compositor-provided raw frame recorder such as weston-capture

validation

  • go test ./internal/capture ./internal/desktop ./internal/config
  • go vet ./internal/capture ./internal/desktop ./internal/config
  • built the server in a Debian container

notes

Wayland remains disabled by default. The image integration supplies the compositor-specific recorder separately.


Note

Medium Risk
Adds a new desktop/capture backend that talks to /dev/uinput and spawns an external recorder, but it is disabled by default and the existing X11 path is largely unchanged.

Overview
Adds an opt-in Wayland desktop and capture path so Neko can run against a compositor instead of X11. Capture can pull raw BGRx frames from a configurable recorder (default wf-recorder) into GStreamer via appsrc; custom gst_pipeline strings are rejected in this mode.

Desktop control skips Xorg and injects pointer/keyboard/scroll through a /dev/uinput virtual device, with optional output resize via wlr-randr-style commands. Keyboard maps, modifiers, cursor images, and screenshots are no-ops on Wayland; cursor image fetch now tolerates a nil cursor.

Config flags: capture.video.wayland, capture.video.wayland_recorder, desktop.wayland, desktop.wayland.output, and desktop.wayland.resize_command. Docs and help.json are updated.

Reviewed by Cursor Bugbot for commit 9766fb9. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cfd2583. Configure here.

manager.waylandInput = input
manager.screenSize = screenSize
manager.emmiter.Emit("after_screen_size_change")
manager.waylandMu.Unlock()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen resize deadlocks Wayland backend

High Severity

SetScreenSize holds waylandMu while emitting before_screen_size_change and after_screen_size_change. Those listeners recreate capture pipelines and call GetScreenSize, which takes an RLock on the same mutex from the same goroutine, so an in-session Wayland resize hangs the server.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cfd2583. Configure here.

manager.waylandInput = input
manager.waylandMu.Unlock()
manager.logger.Info().Str("screen_size", manager.screenSize.String()).Msg("using Wayland desktop backend")
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wayland touch hits nil connection

High Severity

Wayland Start still leaves the default xf86 xinput driver enabled and never calls Connect. HasTouchSupport then reports touch as available, so a client touch event writes to a nil conn and panics instead of using the uinput path or advertising no touch.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cfd2583. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant