-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement MacOSProperties.IsTemplateIcon attached property on TrayIcon #14348
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maxkatz6
added
backport-candidate-11.0.x
Consider this PR for backporting to 11.0 branch
customer-priority
Issue reported by a customer with a support agreement.
labels
Jan 25, 2024
You can test this PR using the following package version. |
kekekeks
approved these changes
Feb 9, 2024
maxkatz6
changed the title
Implement MacOS.IsTemplateIcon attached property on TrayIcon
Implement MacOSProperties.IsTemplateIcon attached property on TrayIcon
Feb 20, 2024
You can test this PR using the following package version. |
maxkatz6
removed
the
backport-candidate-11.0.x
Consider this PR for backporting to 11.0 branch
label
Feb 20, 2024
grokys
added
the
backport-candidate-11.0.x
Consider this PR for backporting to 11.0 branch
label
Jun 11, 2024
grokys
pushed a commit
that referenced
this pull request
Jun 11, 2024
#14348) * Implement MacOS.IsTemplateIcon attached property on TrayIcon * Use MacOS.IsTemplateIcon in the ControlCatalog * Rename MacOS to MacOSProperties * Extract IsTemplateIcon to ITrayIconWithIsTemplateImpl
grokys
added
backported-11.0.x
and removed
backport-candidate-11.0.x
Consider this PR for backporting to 11.0 branch
labels
Jun 11, 2024
grokys
pushed a commit
that referenced
this pull request
Jun 12, 2024
#14348) * Implement MacOS.IsTemplateIcon attached property on TrayIcon * Use MacOS.IsTemplateIcon in the ControlCatalog * Rename MacOS to MacOSProperties * Extract IsTemplateIcon to ITrayIconWithIsTemplateImpl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
We need an API to allow theme aware TrayIcon icons on MacOS.
On other platforms, it is already somewhat possible by handling system theme changes and replacing whole icon. Though this approach is limited, when you have to reuse single icon for both Window and taskbar, that might have a different theme variant (see #12107 (comment)).
On macOS, unfortunately, this approach wouldn't work at all. Nor
ThemedWindowIcon
as a concept can be used there.MacOS tray icon color depends on the background wallpaper image. If it's dark, macOS will invert colors of the tray icon (assuming this icon has IsTemplate=true set). System or application theme can be completely different from these. With that, we don't have flexibility to have a different solution, but implement MacOS.IsTemplateIcon that maps directly on the native
[image setTemplate]
call.On both screenshots System theme is Dark, and App theme is Light, but status bar icon is independent from there, changing only with the wallpaper:
Alternative solutions
Only thing that could be different is naming. MacOS uses "IsTemplate", Qt uses "IsMark", UWP used "ShowAsMonochrome" (BitmapIcon.ShowAsMonochrome, which is unrelated to the status bar/tray icon. Since it's a MacOS specific attached property, I chouse MacOS naming.
Also, another option was to add this property to the WindowIcon class. But it would affect way too much class usage, and WindowIcon can't have attached properties.
Checklist
Fixed issues
Related #12107 cc @TomEdwardsEnscape
Fixes #12954 cc @pixsperdavid
Part of #11384