Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(desktop): use platform-specific tray icons (#692)
Gener4490c7b1d6fc
diff --git a/assets/alook-tray.svg b/assets/alook-tray-macos-template.svgsimilarity index 100%rename from assets/alook-tray.svgrename to assets/alook-tray-macos-template.svgdiff --git a/assets/alook-tray-offline.svg b/assets/alook-tray-offline.svgdeleted file mode 100644index 1245e70ad..000000000--- a/assets/alook-tray-offline.svg+++ /dev/null@@ -1,9 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 1200">- <mask id="face" maskUnits="userSpaceOnUse" x="0" y="0" width="1200" height="1200">- <rect width="1200" height="1200" fill="black"/>- <path d="M73.3744 799.986L80.287 602.034C88.6974 361.193 232.448 217.568 434.621 198.202C507.549 190.84 540.698 92.9006 702.358 98.5459C972.892 107.993 1146.28 345.273 1136.03 638.902L1129.12 836.853C1122.78 1018.31 954.364 1111.52 591.453 1098.85C228.541 1086.18 67.0378 981.442 73.3744 799.986Z" fill="white"/>- <path d="M442 470H556M704 470H818" stroke="black" stroke-width="48" stroke-linecap="round"/>- <path d="M520 640C577 584 665 584 738 640" fill="none" stroke="black" stroke-width="46" stroke-linecap="round"/>- </mask>- <rect width="1200" height="1200" fill="black" mask="url(#face)"/>-</svg>diff --git a/scripts/ci/logo-assets.test.ts b/scripts/ci/logo-assets.test.tsindex b3d909e50..04db05f43 100644--- a/scripts/ci/logo-assets.test.ts+++ b/scripts/ci/logo-assets.test.ts@@ -85,6 +85,16 @@ async function alphaBounds(path: string) {return { width: info.width, height: info.height, bounds: [left, top, right, bottom], opaque }}+async function visibleColors(path: string) {+ const { data, info } = await sharp(path).ensureAlpha().raw().toBuffer({ resolveWithObject: true })+ const colors = new Set<string>()+ for (let offset = 0; offset < data.length; offset += info.channels) {+ if (data[offset + 3] === 0) continue+ colors.add(`${data[offset]},${data[offset + 1]},${data[offset + 2]}`)+ }+ return colors+}+describe("logo asset generator", () => {it("locks the canonical structured transparent SVG", async () => {const canonical = await readFile(resolve(repoRoot, "assets/alook.svg"), "utf8")@@ -106,9 +116,8 @@ describe("logo asset generator", () => {"assets/readme/banner.png",])expect(trayRasterAssets).toEqual([- ["assets/alook-tray.svg", "src/desktop/src-tauri/icons/tray-default.png"],- ["assets/alook-tray.svg", "src/desktop/src-tauri/icons/tray-online.png"],- ["assets/alook-tray-offline.svg", "src/desktop/src-tauri/icons/tray-offline.png"],+ ["assets/alook-tray-macos-template.svg", "src/desktop/src-tauri/icons/tray-macos-template.png"],+ ["assets/alook.svg", "src/desktop/src-tauri/icons/tray-windows-linux-color.png"],])})@@ -131,18 +140,39 @@ describe("logo asset generator", () => {expect(canonicalizeIcns(canonical)).toEqual(canonical)})- it("keeps Retina Tray templates generated from their SVG sources", async () => {+ it("keeps platform tray assets generated from their SVG sources", async () => {for (const [source, destination] of trayRasterAssets) {const svg = await readFile(resolve(repoRoot, source))const expected = await sharp(svg).resize(36, 36).png().toBuffer()expect(await readFile(resolve(repoRoot, destination))).toEqual(expected)- expect(await alphaBounds(resolve(repoRoot, destination))).toEqual({- width: 36,- height: 36,- bounds: [2, 2, 35, 33],- opaque: false,- })}++ const template = resolve(repoRoot, "src/desktop/src-tauri/icons/tray-macos-template.png")+ expect(await alphaBounds(template)).toEqual({+ width: 36,+ height: 36,+ bounds: [2, 2, 35, 33],+ opaque: false,+ })+ expect([...await visibleColors(template)]).toEqual(["0,0,0"])++ const color = resolve(repoRoot, "src/desktop/src-tauri/icons/tray-windows-linux-color.png")+ expect(await alphaBounds(color)).toMatchObject({+ width: 36,+ height: 36,+ opaque: false,+ })+ expect((await visibleColors(color)).size).toBeGreaterThan(5)+ })++ it("locks compile-time tray selection for macOS and Windows/Linux", async () => {+ const source = await readFile(resolve(repoRoot, "src/desktop/src-tauri/src/commands.rs"), "utf8")++ expect(source).toMatch(/#\[cfg\(target_os = "macos"\)\]\nconst TRAY_ICON_BYTES: &\[u8\] = include_bytes!\("\.\.\/icons\/tray-macos-template\.png"\);/)+ expect(source).toMatch(/#\[cfg\(target_os = "macos"\)\]\nconst TRAY_ICON_IS_TEMPLATE: bool = true;/)+ expect(source).toMatch(/#\[cfg\(any\(target_os = "windows", target_os = "linux"\)\)\]\nconst TRAY_ICON_BYTES: &\[u8\] = include_bytes!\("\.\.\/icons\/tray-windows-linux-color\.png"\);/)+ expect(source).toMatch(/#\[cfg\(any\(target_os = "windows", target_os = "linux"\)\)\]\nconst TRAY_ICON_IS_TEMPLATE: bool = false;/)+ expect(source).not.toMatch(/tray-(?:default|online|offline)/)})it("preserves web, platform, and splash canvas contracts", async () => {diff --git a/scripts/generate-logo-assets.mjs b/scripts/generate-logo-assets.mjsindex 4b6010630..8f2d397ed 100644--- a/scripts/generate-logo-assets.mjs+++ b/scripts/generate-logo-assets.mjs@@ -22,9 +22,8 @@ export const preservedAssets = []export const trayRasterAssets = [- ["assets/alook-tray.svg", "src/desktop/src-tauri/icons/tray-default.png"],- ["assets/alook-tray.svg", "src/desktop/src-tauri/icons/tray-online.png"],- ["assets/alook-tray-offline.svg", "src/desktop/src-tauri/icons/tray-offline.png"],+ ["assets/alook-tray-macos-template.svg", "src/desktop/src-tauri/icons/tray-macos-template.png"],+ ["assets/alook.svg", "src/desktop/src-tauri/icons/tray-windows-linux-color.png"],]export const desktopRasterAssets = [diff --git a/src/desktop/src-tauri/icons/tray-default.png b/src/desktop/src-tauri/icons/tray-macos-template.pngsimilarity index 100%rename from src/desktop/src-tauri/icons/tray-default.pngrename to src/desktop/src-tauri/icons/tray-macos-template.pngdiff --git a/src/desktop/src-tauri/icons/tray-offline.png b/src/desktop/src-tauri/icons/tray-offline.pngdeleted file mode 100644index 6b75e9bbb..000000000Binary files a/src/desktop/src-tauri/icons/tray-offline.png and /dev/null differdiff --git a/src/desktop/src-tauri/icons/tray-online.png b/src/desktop/src-tauri/icons/tray-online.pngdeleted file mode 100644index 061e6e319..000000000Binary files a/src/desktop/src-tauri/icons/tray-online.png and /dev/null differdiff --git a/src/desktop/src-tauri/icons/tray-windows-linux-color.png b/src/desktop/src-tauri/icons/tray-windows-linux-color.pngnew file mode 100644index 000000000..821d89f4cBinary files /dev/null and b/src/desktop/src-tauri/icons/tray-windows-linux-color.png differdiff --git a/src/desktop/src-tauri/src/commands.rs b/src/desktop/src-tauri/src/commands.rsindex a393c7279..286025c10 100644--- a/src/desktop/src-tauri/src/commands.rs+++ b/src/desktop/src-tauri/src/commands.rs@@ -580,6 +580,16 @@ fn tray_menu_action(id: &str) -> Option<TrayMenuAction> {}}+#[cfg(target_os = "macos")]+const TRAY_ICON_BYTES: &[u8] = include_bytes!("../icons/tray-macos-template.png");+#[cfg(target_os = "macos")]+const TRAY_ICON_IS_TEMPLATE: bool = true;++#[cfg(any(target_os = "windows", target_os = "linux"))]+const TRAY_ICON_BYTES: &[u8] = include_bytes!("../icons/tray-windows-linux-color.png");+#[cfg(any(target_os = "windows", target_os = "linux"))]+const TRAY_ICON_IS_TEMPLATE: bool = false;+// --- System tray ---#[cfg(desktop)]pub fn setup_tray(app: &tauri::App) -> Result<(), Box<dyn std::error::Error>> {@@ -612,8 +622,8 @@ pub fn setup_tray(app: &tauri::App) -> Result<(), Box<dyn std::error::Error>> {.build()?;let _tray = TrayIconBuilder::new()- .icon(Image::from_bytes(include_bytes!("../icons/tray-default.png")).expect("tray icon"))- .icon_as_template(true)+ .icon(Image::from_bytes(TRAY_ICON_BYTES).expect("tray icon"))+ .icon_as_template(TRAY_ICON_IS_TEMPLATE).menu(&menu).show_menu_on_left_click(false).tooltip("Alook")@@ -712,6 +722,12 @@ mod tests {assert_eq!(tray_menu_action("unknown"), None);}+ #[test]+ fn tray_icon_template_mode_matches_the_current_platform() {+ assert!(!TRAY_ICON_BYTES.is_empty());+ assert_eq!(TRAY_ICON_IS_TEMPLATE, cfg!(target_os = "macos"));+ }+#[test]fn release_pairing_uses_the_exact_published_bin_argv() {let key = "cmt_abcdefghijklmnopqrstuvwxyz012345";