Skip to content

Conversation

@ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Nov 12, 2025

Description

This PR replaces #2507 ... Thanks to @garnacho for the initial work on this!

This PR adds a new "grab" implementation to use XDG desktop portals and Pipewire.

TODO:

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

This is not present in the glad version imported in Sunshine,
plug the holes so that these functions may be used.
Add a new portal "grab" implementation that will request the necessary
permissions over XDG portals and use Pipewire for video data streaming.
This supports DMA-Buf buffer exchange for hardware accelerated encoding
(VAAPI, nvenc), software encoding will only work with memory buffers.
@codecov
Copy link

codecov bot commented Nov 12, 2025

Bundle Report

Bundle size has no change ✅

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 9.67742% with 364 lines in your changes missing coverage. Please review.
✅ Project coverage is 13.15%. Comparing base (a2e6fc9) to head (70a1b64).
⚠️ Report is 22 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/portalgrab.cpp 8.90% 341 Missing and 17 partials ⚠️
src/platform/linux/misc.cpp 40.00% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4417      +/-   ##
==========================================
- Coverage   14.23%   13.15%   -1.08%     
==========================================
  Files          89       92       +3     
  Lines       18936    18172     -764     
  Branches     8677     8349     -328     
==========================================
- Hits         2696     2391     -305     
- Misses      12963    14936    +1973     
+ Partials     3277      845    -2432     
Flag Coverage Δ
FreeBSD-14.3-aarch64 ?
FreeBSD-14.3-amd64 ?
Homebrew-ubuntu-latest 13.41% <3.56%> (?)
Linux-AppImage 8.60% <9.42%> (-2.95%) ⬇️
Windows-AMD64 13.37% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/linux/misc.cpp 11.44% <40.00%> (-3.02%) ⬇️
src/platform/linux/portalgrab.cpp 8.90% <8.90%> (ø)

... and 60 files with indirect coverage changes

Require GIO and PIPEWIRE packages for portal support and use SYSTEM include directories. Also, clarify the fatal error message order for missing dependencies.
Pipewire has been added to the dependency lists for FreeBSD, Arch, Fedora, Homebrew, and Debian-based packaging and build scripts. This ensures proper support and integration for systems using Pipewire.
@ReenigneArcher ReenigneArcher force-pushed the feat/linux/add-xdg-portal-grab branch from f7173e3 to d65baf5 Compare November 15, 2025 03:28
A value of 2 indicates "Remember this Selection".

Co-authored-by: Carson Katri <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 6, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
111 New issues
111 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@joeknock90
Copy link

I've been playing with this branch a bit and I can't seem to get the pipewire screen selection pop up to work on KDE Plasma. I know this was previously mentioned in the superceded pull request. After unsetting the required cap for KMS, the following occurs

Encoder [vaapi] failed
Info: Trying encoder [software]
Info: Screencasting with XDG portal
Info: Found display [wayland-0]
Error: Could not select sources: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Invalid session

Not sure if there's something that I need to configure.

@ReenigneArcher
Copy link
Member Author

I've been playing with this branch a bit and I can't seem to get the pipewire screen selection pop up to work on KDE Plasma. I know this was previously mentioned in the superceded pull request. After unsetting the required cap for KMS, the following occurs

I haven't done much with this branch other than rebasing and getting it up to our new linting standards.

Does it work if you keep the setcap enabled?

@joeknock90
Copy link

I haven't done much with this branch other than rebasing and getting it up to our new linting standards.

Understood! Just excited for the feature I suppose.

Does it work if you keep the setcap enabled?

It does not, however it throws a different error:

Error: Could not create session: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Portal operation not allowed: Unable to open /proc/<pid>/root

@Traine9
Copy link

Traine9 commented Dec 15, 2025

Error: Could not create session: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Portal operation not allowed: Unable to open /proc/<pid>/root
yo, managed to run wayland portal on debian 13 kde plasma 6.3.6, though absolute mouse movement (moonlight optimize mouse for desktop) not work, only relative, code created with Claude Code opus 4.5 step by step with manual reviewing every change so feel free to review&change it or throw to dumpster (i didnt code on C++ long time so idk about standarts), setup tested for 3 days every day 8h+ use desktop usage for webdevelopment host is intel IGPU + 2060 mobile

#4510

cc @garnacho @ReenigneArcher i changed only one file so if you dont mind you can review/fix it and make one more step closer to implement this in master branch

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.

6 participants