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 000000000000..b7a6a41dc2d6 Binary files /dev/null and b/apps/linux/src-tauri/icons/tray-template.png differ 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();