Fix macOS tray icon visibility on light menu bars#1580
Open
gupsammy wants to merge 3 commits intoCapSoftware:mainfrom
Open
Fix macOS tray icon visibility on light menu bars#1580gupsammy wants to merge 3 commits intoCapSoftware:mainfrom
gupsammy wants to merge 3 commits intoCapSoftware:mainfrom
Conversation
apps/desktop/src-tauri/src/tray.rs
Outdated
|
|
||
| let _ = TrayIconBuilder::with_id("tray") | ||
| .icon(initial_icon) | ||
| .icon_as_template(true) |
Contributor
There was a problem hiding this comment.
.icon_as_template(true) is now unconditional. The previous code used cfg!(target_os = "macos") to conditionally apply this only on macOS. While this doesn't cause runtime issues (the method exists on all platforms), using an unconditional true is slightly less clear than the previous version. Consider keeping the cfg! macro for clarity.
Previous:
Suggested change
| .icon_as_template(true) | |
| .icon_as_template(cfg!(target_os = "macos")) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/tray.rs
Line: 669:669
Comment:
`.icon_as_template(true)` is now unconditional. The previous code used `cfg!(target_os = "macos")` to conditionally apply this only on macOS. While this doesn't cause runtime issues (the method exists on all platforms), using an unconditional `true` is slightly less clear than the previous version. Consider keeping the `cfg!` macro for clarity.
Previous:
```suggestion
.icon_as_template(cfg!(target_os = "macos"))
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.Use cfg!(target_os = "macos") for icon_as_template builder call and only set template flag when set_icon succeeds.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
set_tray_template_iconhelper that re-applies the template flag after everyset_iconcall (needed because the upstreamtray-iconcrate resets it).icon_as_template(cfg!(target_os = "macos"))toTrayIconBuilderfor the initial icontray-default-icon.pnguntouched, template logic gated behind#[cfg(target_os = "macos")])Test plan