Skip to content

fix(linux/kwin): retry init with fully dropped elevated privileges in case KWin is missing CAP_SYS_NICE on linux#5212

Merged
ReenigneArcher merged 1 commit into
LizardByte:masterfrom
Kishi85:kwingrab-check-kwin-caps-and-drop-accordingly
May 29, 2026
Merged

fix(linux/kwin): retry init with fully dropped elevated privileges in case KWin is missing CAP_SYS_NICE on linux#5212
ReenigneArcher merged 1 commit into
LizardByte:masterfrom
Kishi85:kwingrab-check-kwin-caps-and-drop-accordingly

Conversation

@Kishi85
Copy link
Copy Markdown
Contributor

@Kishi85 Kishi85 commented May 28, 2026

Description

Archlinux/CachyOS packaged kwin-6.6.5-3 is not assigning CAP_SYS_NICE to KWin therefore breaking kwingrab which was allowed to retain the capability to improve streaming performance as part of #5075. Although this is likely a bug on the packaging end it should be properly handled in Sunshine.

This PR adds handling for KWin missing CAP_SYS_NICE by checking if init succeeded in binding the screencast extension. Should that not be the case it's logging a warning, dropping ALL elevated capabilities and doing a full reinit of the screencast instance on the display object before continuing with starting the stream.

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

@Kishi85 Kishi85 changed the title fix(linux/kwingrab): retry init with fully dropped elevated privileges in case KWin is missing CAP_SYS_NICE fix(linux/kwin): retry init with fully dropped elevated privileges in case KWin is missing CAP_SYS_NICE May 28, 2026
@Kishi85 Kishi85 force-pushed the kwingrab-check-kwin-caps-and-drop-accordingly branch from 2418305 to 0fcb425 Compare May 28, 2026 20:32
@Kishi85 Kishi85 changed the title fix(linux/kwin): retry init with fully dropped elevated privileges in case KWin is missing CAP_SYS_NICE fix(linux/kwin): retry init with fully dropped elevated privileges in case KWin is missing CAP_SYS_NICE on linux May 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Bundle Report

Bundle size has no change ✅

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@1a6fb5f). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/kwingrab.cpp 0.00% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #5212   +/-   ##
=========================================
  Coverage          ?   17.82%           
=========================================
  Files             ?      111           
  Lines             ?    24173           
  Branches          ?    10695           
=========================================
  Hits              ?     4310           
  Misses            ?    15489           
  Partials          ?     4374           
Flag Coverage Δ
Archlinux 11.22% <0.00%> (?)
FreeBSD-amd64 13.35% <ø> (?)
Homebrew-ubuntu-22.04 13.57% <0.00%> (?)
Linux-AppImage 12.15% <0.00%> (?)
Windows-AMD64 14.85% <ø> (?)
Windows-ARM64 13.19% <ø> (?)
macOS-arm64 18.86% <ø> (?)
macOS-x86_64 18.34% <ø> (?)

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

Files with missing lines Coverage Δ
src/platform/linux/kwingrab.cpp 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a6fb5f...b50fba6. Read the comment docs.

@Kishi85 Kishi85 force-pushed the kwingrab-check-kwin-caps-and-drop-accordingly branch from 0fcb425 to e6f7abd Compare May 29, 2026 14:37
@sonarqubecloud
Copy link
Copy Markdown

@ReenigneArcher ReenigneArcher force-pushed the kwingrab-check-kwin-caps-and-drop-accordingly branch from e6f7abd to b50fba6 Compare May 29, 2026 17:22
@ReenigneArcher ReenigneArcher merged commit a682ab0 into LizardByte:master May 29, 2026
72 checks passed
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.

2 participants