Skip to content

feat: offer both screens and windows in the Wayland portal picker - #264

Open
B077AS wants to merge 1 commit into
devopvoid:mainfrom
B077AS:wayland-portal-both-sources
Open

feat: offer both screens and windows in the Wayland portal picker#264
B077AS wants to merge 1 commit into
devopvoid:mainfrom
B077AS:wayland-portal-both-sources

Conversation

@B077AS

@B077AS B077AS commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Under Wayland the xdg-desktop-portal screen-cast dialog only offered the
source kind that matched the capturer we created: CreateScreenCapturer
showed just the monitor list, CreateWindowCapturer just the window list.
A user picking "share a window" from a screen-capture entry point (or vice
versa) had no way to get there.

This routes the Wayland/PipeWire path through
DesktopCapturer::CreateGenericCapturer, which requests
CaptureType::kAnyScreenContent — the same capture type Chromium uses for
getDisplayMedia. The portal then presents both the monitor and the
application-window tabs in a single dialog and the user chooses.

Details

  • Only active when WEBRTC_USE_PIPEWIRE is defined.
  • CreateGenericCapturer returns null when not running under Wayland or
    when PipeWire is disallowed; in that case the code falls back to the
    existing type-specific CreateWindowCapturer / CreateScreenCapturer
    based on sourceIsWindow, so X11, Windows and macOS behaviour is
    unchanged
    .
  • The selected capturer is still wrapped in DesktopAndCursorComposer, as
    before.
  • On the portal path the actual source selection is done by the portal
    dialog, so sourceIsWindow is not consulted there.

Files

  • webrtc-jni/src/main/cpp/src/media/video/VideoTrackDesktopSource.cpp

Testing

  • Wayland + PipeWire (GNOME): portal dialog now shows both "Entire Screen"
    and "Window" tabs; sharing a monitor and sharing a window both work.
  • X11: unchanged, still uses the X11 screen/window capturers.
  • Windows: unchanged (WGC path).

Use DesktopCapturer::CreateGenericCapturer (CaptureType::kAnyScreenContent,
the same type Chromium uses for getDisplayMedia) when running under Wayland
with PipeWire, so the xdg-desktop-portal dialog shows both the monitor and
the application window tabs. Falls back to the type-specific capturers when
the generic capturer is unavailable (X11, Windows, macOS unchanged).
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