Skip to content

feat: macOS support#276

Merged
ReenigneArcher merged 17 commits into
LizardByte:masterfrom
martona:macos-support
Jun 22, 2026
Merged

feat: macOS support#276
ReenigneArcher merged 17 commits into
LizardByte:masterfrom
martona:macos-support

Conversation

@martona

@martona martona commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Description

As requested, here's the macOS support PR, and a windows+macoOS power-management subfeature aimed at keeping the display awake.

  • macOS display enumeration works for online displays.
  • Active display info works: current mode, resolution, refresh rate, scale, origin, main-display status, friendly name, EDID when available.
  • Stable macOS device_id generation works, with EDID/IOKit metadata first and CoreGraphics fallback.
  • getDisplayName() returns the numeric CGDirectDisplayID capture selector Sunshine needs.
  • verify_only display configuration works on macOS.
  • Resolution/refresh changes work for already-active displays, with persistence and revert.
  • New cross-platform display power API exists: wake request plus scoped keep-awake guard.
  • Windows gets equivalent display power API over SetThreadExecutionState.

Does not work:

  • activating inactive displays
  • enumerating disconnected/remembered displays the way Windows can
  • topology mutation: no reliable public equivalent for enable/disable paths, EnsureActive, EnsurePrimary, or EnsureOnlyDisplay
  • HDR mutation

So in summary, it's useful from day one when it gets integrated into Sunshine (conform to capture resolution, refresh rate, etc) with cross-platform semantics. It is not a 1:1 feature-complete Windows-equivalent implementation because macOS public display APIs do not expose the same topology, inactive-display, and HDR controls.

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

AI was heavily used, especially for tests; all code has been reviewed before committing.

@CLAassistant

CLAassistant commented Jun 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread src/macos/mac_api_layer.cpp Fixed

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, thank you! I didn't test any of this, but the code structure seems generally good and follows the existing patterns in the project.

Could you fix the reported sonar issues and duplication? I normally point the AI to a sonar mcp server to do this, but that may not work if you don't own the project in sonar. I think it will work if you give it the link directly (https://sonarcloud.io/project/issues?id=LizardByte_libdisplaydevice&pullRequest=276&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)... if it's too much trouble, I could also take care of that.

Comment thread MACOS-PLAN.md Outdated
@martona

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.89753% with 507 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.17%. Comparing base (3d7e7ca) to head (9274aba).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/macos/mac_api_layer.cpp 32.76% 193 Missing and 45 partials ⚠️
src/macos/settings_manager_apply.cpp 48.21% 21 Missing and 37 partials ⚠️
src/macos/mac_display_device_modes.cpp 41.42% 10 Missing and 31 partials ⚠️
src/macos/settings_manager_revert.cpp 33.33% 14 Missing and 20 partials ⚠️
src/macos/settings_utils.cpp 64.36% 9 Missing and 22 partials ⚠️
src/macos/mac_display_device_general.cpp 55.10% 3 Missing and 19 partials ⚠️
src/windows/win_api_layer.cpp 0.00% 15 Missing and 3 partials ⚠️
src/macos/mac_display_device_topology.cpp 66.66% 1 Missing and 15 partials ⚠️
src/macos/display_power.cpp 73.07% 3 Missing and 11 partials ⚠️
src/macos/persistent_state.cpp 64.51% 6 Missing and 5 partials ⚠️
... and 8 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #276       +/-   ##
===========================================
- Coverage   93.10%   80.17%   -12.93%     
===========================================
  Files          36       59       +23     
  Lines        2379     3370      +991     
  Branches     1123     1534      +411     
===========================================
+ Hits         2215     2702      +487     
- Misses         56      333      +277     
- Partials      108      335      +227     
Flag Coverage Δ
Linux 93.39% <100.00%> (ø)
Windows-AMD64 91.11% <80.61%> (-0.62%) ⬇️
Windows-ARM64 67.04% <63.47%> (-0.23%) ⬇️
macOS 57.83% <48.94%> (-17.33%) ⬇️

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

Files with missing lines Coverage Δ
...ude/display_device/detail/persistent_state_utils.h 100.00% <100.00%> (ø)
...n/include/display_device/display_power_interface.h 100.00% <100.00%> (ø)
...nclude/display_device/settings_manager_interface.h 100.00% <ø> (ø)
src/common/include/display_device/types.h 100.00% <100.00%> (ø)
...ude/display_device/macos/mac_api_layer_interface.h 100.00% <100.00%> (ø)
...isplay_device/macos/mac_display_device_interface.h 100.00% <100.00%> (ø)
src/macos/json.cpp 100.00% <100.00%> (ø)
src/macos/mac_api_utils.cpp 100.00% <100.00%> (ø)
src/windows/display_power.cpp 100.00% <100.00%> (ø)
...e/display_device/windows/win_api_layer_interface.h 100.00% <ø> (ø)
... and 19 more

Continue to review full report in Codecov by Harness.

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

@ReenigneArcher ReenigneArcher merged commit 269be3e into LizardByte:master Jun 22, 2026
19 of 21 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

libdisplaydevice: macOS support

4 participants