Skip to content

feat(macos): add opt-in template icons for the menu bar - #219

Merged
ReenigneArcher merged 1 commit into
LizardByte:masterfrom
kjm0202:codex/macos-tray-template-opt-in
Nov 17, 2026
Merged

ReenigneArcher merged 1 commit into
LizardByte:masterfrom
kjm0202:codex/macos-tray-template-opt-in

Conversation

@kjm0202

@kjm0202 kjm0202 commented Nov 17, 2026

Copy link
Copy Markdown

Description

Add tray_init_with_options() and TRAY_OPTION_TEMPLATE_ICON so applications can request native template rendering for file-backed macOS menu bar icons. The option applies at initialization and when the tray icon changes. tray_init() uses the default options, and notification icons use the regular image lookup.

This provides the opt-in discussed in #218 and supports SunshineStream/Sunshine#6107.

Screenshot

The Sunshine prototype captures show the same template rendering on a light menu bar and a dark menu bar.

Issues Fixed or Closed

Roadmap Issues

Testing

  • Built tray and test_tray with macOS SDK 27.2 and Qt 6.12.0.
  • test_tray --gtest_filter='TrayQtCoverageTest.*:TrayQtPlatformTest.*' passed all 18 tests. The new cases exercise default rendering and the explicit option at initialization and after an icon update.
  • Sunshine's macOS tray integration tests also passed. They check the template flag through state changes and the colored artwork selected for notifications.

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

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.33%. Comparing base (713c49a) to head (83f9b31).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/QtTrayMenu.cpp 70.00% 1 Missing and 2 partials ⚠️
src/tray_qt.cpp 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #219      +/-   ##
==========================================
+ Coverage   63.91%   64.33%   +0.41%     
==========================================
  Files           5        5              
  Lines         546      558      +12     
  Branches      212      216       +4     
==========================================
+ Hits          349      359      +10     
- Misses        129      136       +7     
+ Partials       68       63       -5     
Flag Coverage Δ
Linux-qt5 61.39% <57.14%> (-0.13%) ⬇️
Linux-qt6 60.93% <57.14%> (-0.12%) ⬇️
Windows-qt6 57.79% <64.28%> (+0.16%) ⬆️
macOS-qt6 56.90% <64.70%> (+0.46%) ⬆️

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

Files with missing lines Coverage Δ
src/QtTrayMenu.h 100.00% <100.00%> (ø)
src/tray_qt.cpp 72.61% <83.33%> (+0.83%) ⬆️
src/QtTrayMenu.cpp 67.22% <70.00%> (-0.02%) ⬇️

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 713c49a...83f9b31. Read the comment docs.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Last Updated 2026-11-17 20:05:32 UTC
Source Run CI Run #883
Commit 83f9b31b98211b72e47d47211743b0fcdb52865f

Screenshot Comparison

PR #219 screenshots vs screenshots baseline.

Matrix: Linux-qt5

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png
tray_tooltip_hover.png

Matrix: Linux-qt6

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png
tray_tooltip_hover.png

Matrix: Windows-qt6

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png
tray_tooltip_hover.png

Matrix: macOS-qt6

Image Baseline PR
tray_icon_ico.png
tray_icon_initial.png
tray_icon_png.png
tray_icon_svg.png
tray_icon_themed.png
tray_icon_update_ico.png
tray_icon_update_png.png
tray_icon_update_svg.png
tray_icon_update_themed.png
tray_menu_checkbox_checked.png
tray_menu_checkbox_unchecked.png
tray_menu_left_click.png
tray_menu_shown.png
tray_notification_ico_icon.png
tray_notification_png_icon.png
tray_notification_svg_icon.png
tray_notification_themed_icon.png
tray_tooltip_hover.png

@ReenigneArcher
ReenigneArcher merged commit c7b35bb into LizardByte:master Nov 17, 2026
23 of 24 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