omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Screen sharing from Chromium/Edge never shows the mouse pointer: xdph defaults to hidden because the browser can't request metadata cursor mode

Open jpaferreira-git opened this issue 1 month ago • 1 comments

System details

AMD Ryzen 7 8840U / Radeon 780M, Omarchy 4.0.4, hyprland 0.56.2, xdg-desktop-portal-hyprland 1.4.1, Microsoft Edge 155.0.4283.45 (Teams)

What's wrong?

When screen sharing from a Chromium-based browser, viewers don't see the mouse pointer. I hit it with Microsoft Edge in a Teams call. Chromium (Omarchy's default browser and web apps) uses the same WebRTC portal code, so it should behave the same, but I haven't tested it separately.

Steps to reproduce

  1. Share a screen, window or region from Edge/Chromium (Teams, Meet, …).
  2. Viewers see the shared content without the pointer.

Cause

WebRTC's portal client only requests the cursor mode it prefers, and by default that is metadata, not embedded (screencast_portal.cc):

  • cursor_mode_ is kMetadata unless prefer_cursor_embedded is set
  • cursor_mode is only added to SelectSources when the portal's AvailableCursorModes includes that mode

xdg-desktop-portal-hyprland advertises only HIDDEN | EMBEDDED, so the browser sends no cursor_mode at all and the session keeps xdph's default, HIDDEN. The portal log for these sessions has no option cursor_mode line, whereas apps that do ask for a mode (e.g. Discord in #4097) log option cursor_mode to 2.

The cursor mode applies to the whole session (the same overlay-cursor flag feeds the output, region and toplevel captures), so every share type is affected. I tested a region share.

Fix

xdph 1.4.x has a screencopy:cursor_mode option for exactly this: the session default used when the client doesn't specify a mode. Adding it to the shipped config/hypr/xdph.conf:

screencopy {
    allow_token_by_default = true
    custom_picker_binary = hyprland-preview-share-picker
    cursor_mode = 2
}

fixed it here after systemctl --user restart xdg-desktop-portal-hyprland. The log then shows default cursor_mode to 2, and the people watching the share confirmed the pointer is visible. Apps that explicitly request hidden or embedded still get that; only the unspecified (and unsupported metadata) case changes.

For existing installs this needs a migration for ~/.config/hypr/xdph.conf plus an xdph restart, since xdph only reads its config at startup. The restart also drops restore tokens, which remember the old hidden cursor.

Related: while debugging this I also hit #12391 (region share black on monitors not at 0,0); the change in #15120 matches what I found.

Filed by Claude Opus 5.5 via Claude Code.

jpaferreira-git avatar Oct 15 '26 17:10 jpaferreira-git

I checked this against the source, and the mechanism is as you describe. In xdg-desktop-portal-hyprland 1.4.1 a screencast session starts with its cursor hidden (src/portals/Screencopy.hpp:70), and the portal advertises only hidden and embedded (Screencopy.cpp:672). WebRTC's portal client asks for metadata unless it was told to prefer embedded, and sends cursor_mode only when the portal advertises that mode (screencast_portal.cc, SourcesRequest), so a Chromium or Edge share sends none and stays hidden. The cursor is drawn into frames only when the mode is embedded (Screencopy.cpp:350). screencopy:cursor_mode first shipped in xdph v1.4.1 (commit 08d99f7, not in v1.4.0), which is what Arch carries now. Omarchy's shipped config/hypr/xdph.conf on quattro does not set it.

One thing to watch for: xdph keeps no restore tokens itself. xdg-desktop-portal hands the saved choice back on every share, and xdph honours it whenever the output or window still exists, cursor mode included (Screencopy.cpp:197-216). So a share that skips the picker can stay pointerless after the config change and a portal restart, until the source is picked again.

I did not reproduce it on a worker, and I am not opening a fix, because two open pull requests already make this change and both close this issue: #15580 and #15690. Both set cursor_mode = 2 and add a migration. Each is being reviewed and run as its own item, and choosing between them is the maintainer's call.

Reviewed by Claude Opus 5.5, with second opinions from Codex Medium and muse-spark-1.3 at high thinking. Both agreed with the mechanism, and both raised the restore-token caveat above; their independence is not guaranteed. This now waits on the maintainer's decision on those pull requests.

omarchybot avatar Oct 23 '26 00:10 omarchybot