Skip to content

Linux/Wayland: absolute mouse, clean reconnects, PipeWire capture fix (WIP) - #6

Draft
flyboy-byte wants to merge 1 commit into
LiboShen:mainfrom
flyboy-byte:linux-wayland-pr
Draft

flyboy-byte wants to merge 1 commit into
LiboShen:mainfrom
flyboy-byte:linux-wayland-pr

Conversation

@flyboy-byte

Copy link
Copy Markdown

Draft / work in progress — I'm not planning to continue this. I'm opening it so the work and what I
learned are available to you or anyone else who wants Linux support. Feel free to take any part of it, or
close it.

What this does

It builds on the portal-based Linux input in v1.5.3 and gets KDE Plasma 6 (Wayland) to a usable
state: the screen streams and tap-to-cursor is pixel-exact.

  • Absolute pointer. Uses NotifyPointerMotionAbsolute, scaled by the portal stream size (this
    differs from the display size under fractional scaling). The relative-motion fallback is removed
    because it drifted.
  • Clean reconnects. Calls Session.Close on stop and disposes LinuxInputHandler on disconnect.
    Before this, a reconnect left a stale session and KDE showed two screen-sharing indicators.
  • Black frames fixed. Unsets DISPLAY on Wayland so libwebrtc captures through PipeWire instead of
    XWayland.
  • CLI install on Linux. cli/ is bundled with the build, and settings symlinks it to
    /usr/local/bin/afk.

⚠️ Touches macOS/Windows (untested there)

  • RTCPeerConnectionStateDisconnected is no longer treated as terminal; only Failed is.
  • The getDisplayMedia mandatory minimum-resolution constraints are replaced with
    frameRate: {ideal: 30, max: 30}.
  • flutter_webrtc is bumped from ^1.3.0 to ^1.4.1.

Verification

flutter analyze ✅ no issues (Arch, 2026-10-27)
flutter build linux --release ✅ (Arch, 2026-10-27)
KDE Plasma 6 Wayland: screen + absolute mouse ✅ manual testing, June 2026
GNOME 47 Wayland (RHEL 10): screen ✅ but video freezes once input is used
X11 / wlroots: input ❌ no path (needs XTest / zwlr_virtual_pointer)
macOS / Windows builds ❓ not built (no machines)

Not done

  • GNOME freeze. The likely cause is two ScreenCast sessions running at once: ours (needed for the
    absolute pointer's stream node) and the one libwebrtc opens inside getDisplayMedia. The likely fix
    is to feed our session's PipeWire stream into WebRTC directly, which flutter_webrtc doesn't currently
    expose.
  • Paste text, window switcher and cursor sync are not implemented on Linux. Multi-monitor is untested.

docs/LINUX.md has the full status: the test matrix, the dead ends (uinput is invisible to Wayland
compositors; a v4l2loopback bridge didn't work), and how to get the PipeWire fd out of the portal in
Dart, for whoever takes on the GNOME fix.

🤖 Generated with Claude Code

… (WIP)

Work in progress. KDE Plasma 6 is usable; GNOME has an open video-freeze
bug. Status, test matrix and dead ends are in docs/LINUX.md.

- Absolute pointer via NotifyPointerMotionAbsolute, scaled by the portal
  stream size; drop the drifting relative-motion fallback
- Close the portal Session on stop and dispose LinuxInputHandler on
  disconnect, so a reconnect gets a fresh session
- Unset DISPLAY on Wayland so libwebrtc captures via PipeWire, not
  XWayland (black frames)
- Bundle cli/ with the Linux build; settings UI installs it to
  /usr/local/bin/afk
- All platforms: Disconnected is no longer terminal (only Failed);
  getDisplayMedia minimum-resolution constraints relaxed;
  flutter_webrtc ^1.4.1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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