Skip to content

feat(config): configure cursor capture per application - #6200

Open
medialaxis wants to merge 1 commit into
SunshineStream:masterfrom
medialaxis:feat/app-cursor-capture
Open

medialaxis wants to merge 1 commit into
SunshineStream:masterfrom
medialaxis:feat/app-cursor-capture

Conversation

@medialaxis

Copy link
Copy Markdown

Description

Add a global default and per-application override for the initial mouse-cursor capture state when starting a stream:

  • Global default (capture_cursor in sunshine.conf): Defaults to enabled (preserving current behavior), initializes display_cursor, is exposed as Capture mouse cursor by default in Configuration → Advanced, and is documented in docs/configuration.md.
  • Per-application override (capture-cursor in apps.json): Optional boolean field exposed in Applications as Capture mouse cursor (Use global default / On / Off). POST /api/apps strips "capture-cursor": null via normalize_optional_app_fields(), and Apps.vue omits null from the save payload without mutating editForm.
  • Session lifecycle: Launching an application sets display_cursor = _app.capture_cursor.value_or(config::video.capture_cursor). Terminating an active application restores display_cursor to config::video.capture_cursor (while an idle terminate() leaves display_cursor unchanged). Ctrl+Alt+Shift+N still toggles cursor capture during a session (retained across resuming the same app), and mouse/keyboard input remain available when cursor capture is disabled.

This enables setups such as keeping the host cursor visible for Desktop while starting controller-driven apps (e.g. Steam Big Picture) or fullscreen games (e.g. for NvFBC direct capture) with cursor capture disabled by default.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

  • Tests added/updated:
    • tests/unit/test_config.cpp (AppliesCaptureCursorDefaultAndOverrides): verifies default and enabled/disabled parsing updates both config::video.capture_cursor and display_cursor.
    • tests/unit/test_process.cpp (ParsesAndAppliesAppCursorCapture): verifies optional capture-cursor parsing from apps.json, idle terminate() not clobbering display_cursor, execute() applying unset/false/true overrides, and post-run terminate() restoring config::video.capture_cursor.
    • tests/unit/test_confighttp.cpp (SaveAppOmitsNullOptionalFieldsAndPreservesConfiguredValues): verifies POST /api/apps omits "capture-cursor": null and preserves "capture-cursor": false.
    • tests/web/Apps.optional-fields.test.js: verifies Apps.vue defaults 'capture-cursor' to null, omits it from the POST payload without mutating editForm, and preserves false.
    • tests/web/Configuration.test.js: verifies #capture_cursor in Advanced.vue defaults to 'enabled' from config_tabs.json and toggles between 'disabled' and 'enabled'.
  • Commands/checks run (Linux):
    • uv run --locked --no-sync lb-update-clang-format — clean (no formatting diffs).
    • npm test — 13/13 test files, 220/220 tests passed.
    • cmake-build-test/tests/test_sunshine (ConfigConsistencyTest.*, LocaleConsistencyTest.*, ConfigPersistenceTest.*, ConfigDefaultsTest.*, ConfigParsingTest.*, ConfigHttpTest.*, ProcessTest.*, ProcessRefreshTest.*) — all passed (100/100 before final doc/test trims; ConfigConsistencyTest.* 8/8 and ConfigPersistenceTest.*:ProcessTest.* 24/24 re-run and passed after final edits).
  • Manual validation & checks not run:
    • Earlier local Linux build verified capture_cursor = false starts a stream with cursor capture disabled.
    • End-to-end live-stream switching between per-app On/Off entries and non-Linux (Windows/macOS/FreeBSD) builds were not run locally.

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
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR
  • Codex (GPT-6 Sol) assisted with the initial implementation of the global and per-app cursor capture configuration and Web UI controls.
  • Antigravity (Gemini 4 Neon, high thinking level) assisted with code review, normalizing null optional fields, expanding/consolidating tests, trimming the diff, and drafting this PR description.

This pull request was generated with Codex (GPT-6 Sol) for initial implementation and Antigravity (Gemini 4 Neon, high thinking level) for review, cleanup/tests, and PR drafting

@medialaxis

Copy link
Copy Markdown
Author

This pull request was generated with Codex (GPT-6 Sol) for initial implementation and Antigravity (Gemini 4 Neon, high thinking level) for review, cleanup/tests, and PR drafting

Comment thread tests/unit/test_process.cpp Fixed
@medialaxis
medialaxis force-pushed the feat/app-cursor-capture branch from ad1c66f to 4abaa24 Compare November 28, 2026 17:15
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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