From e6a6d478f2325835c165fee61a2f957ce5b403ce Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 26 Jul 2026 21:53:18 -0400 Subject: [PATCH] fix(linux): draw the macOS tray icon from a template silhouette (#114223) * fix(linux): draw the macOS tray icon from a template silhouette AppKit renders menu bar template images from the alpha channel alone, so the opaque rounded-tile 32x32.png painted a solid white square instead of the mascot. Add a dedicated tray-template.svg and its 36px render, a silhouette with the eyes knocked back out, and select it only on macOS. Its geometry mirrors the native macOS app's CritterIconRenderer at rest so both clients wear the same face; other platforms keep the full-color 32x32.png. * chore(linux): drop the root changelog entry from the tray icon fix CHANGELOG.md is release-owned in this repo (AGENTS.md) and `scripts/pr prepare-run` rejects normal PRs that touch it; release generation derives entries from merged PRs. The release-note context lives in the PR body and the preceding commit message instead. --- apps/linux/README.md | 9 +++++ apps/linux/src-tauri/icons/tray-template.png | Bin 0 -> 745 bytes apps/linux/src-tauri/icons/tray-template.svg | 38 +++++++++++++++++++ apps/linux/src-tauri/src/tray.rs | 6 +++ 4 files changed, 53 insertions(+) create mode 100644 apps/linux/src-tauri/icons/tray-template.png create mode 100644 apps/linux/src-tauri/icons/tray-template.svg diff --git a/apps/linux/README.md b/apps/linux/README.md index 9e08b59443a8..6bbd9130dad5 100644 --- a/apps/linux/README.md +++ b/apps/linux/README.md @@ -63,8 +63,17 @@ rsvg-convert -w 128 -h 128 icon-tile.svg -o 128x128.png rsvg-convert -w 256 -h 256 icon-tile.svg -o 128x128@2x.png rsvg-convert -w 512 -h 512 icon-tile.svg -o icon.png magick icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico +rsvg-convert -w 36 -h 36 tray-template.svg -o tray-template.png ``` +macOS gets its own tray asset, `icons/tray-template.svg`. AppKit template images +are drawn from the alpha channel alone, so a colored or edge-to-edge opaque icon +arrives in the menu bar as a featureless blob; the template source is a +silhouette with the eyes knocked back out of it. Its geometry mirrors the native +macOS app's `CritterIconRenderer` at rest so both clients wear the same face, and +the 36px render is the 2× backing store for the 18pt slot `tray-icon` scales +menu bar images into. Non-Apple platforms keep the full-color `32x32.png`. + ## Packaging Build a `.deb` and AppImage locally (the same command CI runs): diff --git a/apps/linux/src-tauri/icons/tray-template.png b/apps/linux/src-tauri/icons/tray-template.png new file mode 100644 index 0000000000000000000000000000000000000000..b7a6a41dc2d64190322f7c2c0d09a1a3fe7830ec GIT binary patch literal 745 zcmV?V3$7GykPDI< zr7gLW8&VF5d#9WV<$}VEl9H{B?NqXraz5pVhOgOZ{qqb9KsmgbL%x;VH0L0 zygzY3n2TR<7at17u1Y%;KZ2szR_!2tN&vkT?zF6aqN9eqTn)wvwSPNt9LJz~Vfy1@ z17PB~fPVD=9cds;9EWR#S=0kCaV#hc(}V}9A|2R=H8@qppy#j_JB1e_dF{U9C8t7j zQw2T?>&Lgm-L(|JJdHk2M&2p-nDWdi19Tvjd?RtZJ@O33_Y9ct_!J$tCTbo{`Sw=> z(hu|SD3#oTgE)qv3ID4MpqE%JJhH_J@2-^ZVKi3mTQ?4OG6v|vnGF9JbY^%vWw$A3 zb86oaT9gW1$w`O@S&{G#j3D#;r!gSmUzr0R$EDa9&-7u!TU0djyKoup!jdq#z)P4v z*D(Q0tEfE!@8T1a3h4hGOZdQ{tT;-DAh|^!9d=b{8hG-fd*8%es zvl|5yYozW?vrK#v7QL!erpX_rvM2tL;Y*(zB)(zAy zY>-K{2~FFJD8AuI%F~HwCB`YGy}IYdd(6!6%#N5Bw86A0M^fb(W b^}2om#ANqN_c)-^00000NkvXXu0mjf@7`DE literal 0 HcmV?d00001 diff --git a/apps/linux/src-tauri/icons/tray-template.svg b/apps/linux/src-tauri/icons/tray-template.svg new file mode 100644 index 000000000000..3d9c7be43b3f --- /dev/null +++ b/apps/linux/src-tauri/icons/tray-template.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/linux/src-tauri/src/tray.rs b/apps/linux/src-tauri/src/tray.rs index e9634557d64c..dbef7569cff8 100644 --- a/apps/linux/src-tauri/src/tray.rs +++ b/apps/linux/src-tauri/src/tray.rs @@ -235,6 +235,12 @@ pub fn build( ]) .build()?; + // macOS draws menu bar icons from the alpha channel alone (see + // icon_as_template below), so it needs the knocked-out silhouette; the + // rounded-tile 32x32.png is opaque edge to edge and renders as a solid blob. + #[cfg(target_os = "macos")] + let tray_icon = tauri::image::Image::from_bytes(include_bytes!("../icons/tray-template.png"))?; + #[cfg(not(target_os = "macos"))] let tray_icon = tauri::image::Image::from_bytes(include_bytes!("../icons/32x32.png"))?; let menu_state = state.clone(); let menu_start_at_login = start_at_login.clone();