Skip to content

[Singularity scrrencasting fixes #1]:Add JSON source selection for screencasts with monitor and window support - #3

Open
mateoalfaro wants to merge 1 commit into
singularityos-lab:mainfrom
mateoalfaro:main
Open

[Singularity scrrencasting fixes #1]:Add JSON source selection for screencasts with monitor and window support #3
mateoalfaro wants to merge 1 commit into
singularityos-lab:mainfrom
mateoalfaro:main

Conversation

@mateoalfaro

Copy link
Copy Markdown

Fixes the Singularity screencast portal so screen and window sharing work reliably with Discord, OBS, and other xdg-desktop-portal clients.

This PR adds proper source selection for monitor/window capture, hardens the singleton screencast backend lifecycle across repeated share attempts, and fixes SHM/PipeWire format handling for compositors that advertise BGR888.

What Changed:

Added monitor/window source selection support for the screencast chooser.
Added backend session ownership tracking so stale portal sessions cannot interfere with the active capture.
Hardened screencast teardown/restart handling:
cancels pending frame retry timers
disconnects/destroys PipeWire streams consistently
ignores stale Wayland session/frame callbacks
prevents duplicate in-flight frames
detects failed Wayland connections after protocol errors
Added support for 24-bit SHM capture formats:
WL_SHM_FORMAT_BGR888
WL_SHM_FORMAT_RGB888
Fixed SHM stride calculation to use the selected capture format’s bytes-per-pixel instead of always assuming 4 bytes per pixel.
Kept PipeWire output as consumer-friendly SPA_VIDEO_FORMAT_BGRx.
Added conversion from captured SHM formats into PipeWire BGRx.
Fixed 24-bit channel order so captured colors are not inverted/tinted.

Bugs Fixed:

Discord/Electron apps did not trigger the screencast picker UI correctly.
Repeated share attempts could fail after the first successful stream.
OBS/Discord could report the share as denied/cancelled after selecting a source.
BGR888 was rejected as unsupported.
BGR888 capture could cause invalid Wayland SHM stride errors.
Streams could start but show incorrect/inverted colors.

Tested with: NixOS 26.05

- Pass source lists to the chooser over stdin as JSON
- Support monitor and window sources end to end
- Update backend session handling and format negotiation
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