Products › lamco-dsi-tools › Interfaces › ScreenCast portal

xdg-desktop-portal ScreenCast: How screen sharing works on Wayland

xdg-desktop-portal ScreenCast is how Wayland apps share the screen on GNOME and KDE: The dialog, the PipeWire stream, and how to check it on your desktop.

D-Bus portal org.freedesktop.portal.ScreenCast

The xdg-desktop-portal ScreenCast interface, org.freedesktop.portal.ScreenCast, is how a program asks a Wayland desktop to share the screen: The desktop shows a dialog, a person picks a monitor or a window, and the program gets a PipeWire stream of it. Browsers, video call apps, screen recorders and remote desktop servers use it, and on GNOME and KDE it's the only route to the screen. lamco-dsi-tools (DSI: Desktop session interfaces) records whether a desktop's portal exports ScreenCast, opens a session through it when you allow the dialog, and reads the stream it hands out.

What it is

The portal is a D-Bus service, org.freedesktop.portal.Desktop on the session bus, that's usually started on demand the first time a program calls it. The frontend exports ScreenCast only when a backend for the desktop implements it, such as xdg-desktop-portal-gnome or xdg-desktop-portal-kde.

A session goes through four calls. CreateSession makes a session object. SelectSources, which may be called once per session, says what to share: The types bitmask (monitor, window, or a virtual monitor the desktop creates), whether several sources may be picked, the cursor_mode (hidden, embedded in the frames, or sent as metadata beside them), and optionally a persist_mode and a restore_token. Start is where the desktop normally shows its dialog, and on success its answer lists the streams: A PipeWire node for each source, with properties such as position, size and source type. OpenPipeWireRemote then returns a file descriptor for a PipeWire connection on which the program reads those streams. The frames themselves never pass through D-Bus; that's the PipeWire screen cast stream.

Two properties say what the backend offers: AvailableSourceTypes and AvailableCursorModes. A restore token is good for one session. When the portal takes it, Start can answer without a dialog and hands back a new token. When it doesn't, the person is asked as usual. A remote desktop server opens the screen cast on a RemoteDesktop session instead, so that one dialog covers the screen and the input.

Screen sharing that shows no dialog, says the portal doesn't support ScreenCast, or shows a black screen is a question about one of these steps. The toolkit records each step and says what it saw.

Which desktops offered it

DesktopState
GNOME Shell 48.7 (Debian 13)present
GNOME Shell 51.0 (Fedora 45)present
KDE Plasma, KWin 6.5.6 (NixOS)present
KDE Plasma, KWin 6.8.2 (KDE neon)present
Sway 1.9not examined
Hyprland 0.56.2present
COSMIC, cosmic-comp 1.0.0present
labwc 0.20.3 (Budgie session, CachyOS)present
Cinnamon Wayland session (Linux Mint)absent

Each cell is one version of that desktop on one virtual machine, captured on 2026-11-27 or 2026-11-28 with dsisee observe and no permission dialog answered, so present means the portal offered ScreenCast and nothing exercised it. Sway's cell reads not examined because its portal wasn't running when the capture was taken. The Cinnamon capture raised PORTAL-004 and CAP-001.

The README's run record lists what's been exercised. On GNOME Shell 48.7, capture observe over the ScreenCast portal with the PipeWire stream read, in a full build. On KDE Plasma 6.8.2, the same with the stream read: 14 buffers. A virtual monitor through the portal, and restore tokens, on Mutter 48.7 and KWin 6.8.2, where the dialog was skipped on the second start.

The project's record of runs, reconciled on 2026-12-04, adds:

  • Markers read from DMA-BUFs through the helper, on KWin 6.7.4 on a GPU function on 2026-11-28: 592 of 592 buffers were mapped read-only and every marker was decoded.
  • Long runs on the portal route, ten minutes each beside an animation of 60 frames a second, on GNOME Shell 48.7 and KWin 6.8.2 on 2026-11-28. GNOME Shell 48.7: 35,922 buffers, no stalls, 68 presented frames missed. KWin 6.8.2: 18,075 buffers and 19 presented frames missed, with KDE's idle timer locking the session five minutes into the run.
  • Input to pixels with the focus wait, on KWin 6.8.2 on 2026-11-28: 22 of 22 keys.
  • The idle inhibitor and the session watch against a real lock, beside a capture of the portal's screen cast, on GNOME Shell 48.7 on 2026-11-29: Without the inhibitor the session was locked and idle at 1 minute 55 seconds, the capture stopped delivering, and the stalls were attributed to the locked span. With it the session never locked or went idle, and there were no stalls.
  • The cursor as metadata (--cursor-mode metadata) on the portal route, on KWin 6.8.2 on 2026-11-29: All 20 buffers carried the cursor, eight pointer moves showed as a change of position in exactly eight buffers, and the cursor's image, 32 by 32, came once and was recorded as a hash.
  • Markers read from the DMA-BUFs of a graphics driver, and input to pixels on them, on KWin 6.7.4 on a GPU function on 2026-11-29: 72 of 72 buffers mapped, and 22 of 22 steps were seen by the window and shown by a captured buffer.

The record, through 2026-11-29, has no run of --session remote-desktop on the capture commands, of --cursor-mode metadata on any desktop but KWin 6.8.2, of the cursor lines of dsitell timing for a capture taken with it, or of CAP-013.

A real session, step by step

On 2026-12-04 the released 0.4.0 full build opened a ScreenCast session twice on each of two desktops: First through the dialog, with persist_mode 2 (until_revoked) asked for, and then again with the restore token the first Start returned. GNOME Shell 50.1 ran on Ubuntu 26.04.1 with PipeWire 1.6.2, xdg-desktop-portal 1.21.1 and the GNOME backend 50.0, and offered ScreenCast version 5. KWin 6.8.2 ran on Manjaro with PipeWire 1.6.11, xdg-desktop-portal 1.22.1 and the KDE backend 6.8.2, and offered ScreenCast version 6. Both were virtual machines with no GPU.

# The first run shows the portal's dialog, and a person answers it. The token Start returns is written
# to the file.
dsisee capture observe --route portal --persist permanent --restore-token ./token \
    --duration 10 --frames 100000 --allow-dialogs --out cast-dialog.json

# The second run sends the token from the file. No dialog is expected.
dsisee capture observe --route portal --persist permanent --restore-token ./token \
    --duration 10 --frames 100000 --allow-dialogs --out cast-token.json

dsitell health cast-token.json
dsitell timing cast-token.json
StepGNOME, through the dialogGNOME, with the tokenKDE, through the dialogKDE, with the token
Restore token sentNoYesNoYes
Start answeredAfter about 26 seconds, waiting for a personAfter 63.9 msAfter about 34 seconds, waiting for a personAfter 261.6 ms
Restore token returned by StartYesYes, the same oneYesYes, the same one
Streams1, a monitor at 1280 by 80011, a monitor at 1280 by 8001
Buffers in 10 seconds1, in memory2, in memory18, DMA-BUF9, DMA-BUF

The times are a contrast, taken on a virtual machine: A person answering a dialog against a start the portal allowed without one. The buffer counts are low on GNOME because the screen wasn't changing, and a compositor sends a buffer when the screen changes. The capture never holds a token's text. It records the token's length and SHA-256, and the text is only in the file named with --restore-token. dsitell timing lists a start with a token as portal_screencast.open.start_with_token and never pools it with a start through the dialog.

Here's what the health summary said of GNOME's run with the token, verbatim:

  route: ScreenCast portal and PipeWire                     working
      a ScreenCast session was started through the portal, which answered with 1 stream(s)  [records 6-7]
      2 buffers arrived from node 59 (0 % DMA-BUF, 100 % memory)  [records 24-25]
      2 of 2 buffer(s) carried cursor metadata, 0 of them naming a cursor: The position changed in 0 buffer(s) and the image 0 time(s), among 0 bitmap(s)  [records 24-25]
      a restore token was sent and Start was answered after 63.9 ms: No dialog was shown (judged by time, on an assumption of this tool: A person is taken to need at least 1000 ms to answer a dialog, and the capture cannot see the dialog itself)  [records 4, 6, 8]
      persist mode `until_revoked` was asked for, and Start answered with a restore token, which is in the file named with --restore-token  [records 4, 6, 8]

Note how it words the token run. It doesn't claim to have seen that no dialog appeared: It judged so by the time, and it names the assumption. Each token run raised PORTAL-010 (info), "A restore token was accepted: The session started without a dialog", and the runs through the dialog raised none. This is what these two desktops did on this day. The portal decides whether a token skips the dialog, so it doesn't always.

How to check it with lamco-dsi-tools

dsisee portal diagnose --wake-portal                       # interfaces, versions, backends and properties; no dialog
dsisee observe --wake-portal --out capture.json            # every dissector that shows no dialog
dsisee capture observe --route portal --out cast.json      # open a ScreenCast session: shows the dialog
dsisee capture probe --route portal --duration 10 --out probe.json   # time the stream's buffers; needs a full build
dsitell health cast.json                                   # the capture function and its routes, with findings

portal diagnose records who owns the portal's bus name, every interface it exports with its version, the backends found, and the ScreenCast properties with the bits of the bitmasks named. A portal nobody has called yet is not examined unless you add --wake-portal, which starts it and records that the instrument did. capture observe records each step of the session with its length, what was asked for, and each stream the portal answered with, and keeps the time a person took to answer the dialog apart from the time the stack took. In dsitell health, the ScreenCast route is working when the capture holds buffers, broken when a session opened and none arrived or opening failed, and present when the stream wasn't read. --source-types virtual asks for a virtual monitor, and --persist permanent --restore-token <file> asks for a restore token and sends it next time.

Driving it with dsido

dsido screen animate --duration 20 --out animate.json &                    # a window that presents marked frames
dsisee capture probe --route portal --read-markers --duration 15 --out cast.json   # capture it, and read each marker
dsitell glass animate.json cast.json                                         # which presented frames the cast didn't deliver

A still screen may give one buffer and no more. The animation gives the cast something to deliver.

Findings

  • PORTAL-001: The portal frontend isn't running and nothing would start it.
  • PORTAL-004: The portal has no ScreenCast interface.
  • PORTAL-008: The portal frontend hadn't been started, so its routes aren't examined.
  • CAP-001: No screen capture route was found.
  • CAP-004: A screen cast through the portal delivered no buffer.
  • CAP-005: Opening the screen cast through the portal failed.
  • CAP-006: The screen cast's PipeWire stream wasn't read.
  • CAP-010: A virtual monitor was asked for and the portal gave none.
  • PORTAL-009: A restore token was sent and the permission dialog was shown all the same.

Related