Skip to content

Fix macOS tray icon visibility on light menu bars#1580

Open
gupsammy wants to merge 3 commits intoCapSoftware:mainfrom
gupsammy:fix/macos-tray-template-icons
Open

Fix macOS tray icon visibility on light menu bars#1580
gupsammy wants to merge 3 commits intoCapSoftware:mainfrom
gupsammy:fix/macos-tray-template-icons

Conversation

@gupsammy
Copy link

@gupsammy gupsammy commented Feb 4, 2026

Summary

  • Invert macOS tray icon PNGs from white to black and mark them as template images so macOS automatically adapts their color for light/dark menu bars
  • Add set_tray_template_icon helper that re-applies the template flag after every set_icon call (needed because the upstream tray-icon crate resets it)
  • Add .icon_as_template(cfg!(target_os = "macos")) to TrayIconBuilder for the initial icon
  • Windows behavior is unchanged (tray-default-icon.png untouched, template logic gated behind #[cfg(target_os = "macos")])

Test plan

  • Build the desktop app on macOS
  • Switch macOS appearance to Light (System Settings > Appearance > Light) and verify tray icon is visible (black)
  • Switch to Dark appearance and verify tray icon is visible (white)
  • Switch recording modes (Studio, Instant, Screenshot) and verify each icon adapts
  • Start a recording and verify the stop icon also adapts
  • Verify Windows build is unaffected (no template logic compiled in)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile


let _ = TrayIconBuilder::with_id("tray")
.icon(initial_icon)
.icon_as_template(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

.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.
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.

1 participant