Skip to content

System tray icon not appearing — TrayIconBuilder has no icon set #501

@amiable-dev

Description

@amiable-dev

Description

The system tray (menu bar on macOS) icon does not appear when running cargo run -p conductor-gui. The tray menu is registered and functional if accessed, but no icon is visible because none is set on the builder.

Root Cause

menu_bar.rs lines 110-128 — TrayIconBuilder is called without .icon():

let _tray = TrayIconBuilder::new()
    .menu(&menu)
    .on_menu_event(...)
    .on_tray_icon_event(...)
    .build(app)?;
    // ← no .icon() call

Additionally, the update_icon() function (lines 274-287) is entirely commented out / dead code — the state-based icon switching was stubbed but never implemented. Only a single icon.png (128×128) exists in icons/, and the state-specific icons referenced in comments (icon_running.png, icon_stopped.png, icon_error.png, icon_paused.png) don't exist.

Recommendation

1. Add a default tray icon

Create a small monochrome tray icon suitable for macOS menu bar (22×22 @1x, 44×44 @2x — template image style). Add it to the builder:

let _tray = TrayIconBuilder::new()
    .icon(app.default_window_icon().cloned().unwrap())
    // or: .icon(tauri::image::Image::from_path("icons/tray-icon.png")?)
    .menu(&menu)
    .on_menu_event(...)
    .on_tray_icon_event(...)
    .build(app)?;

2. Create state-specific tray icons (future)

As described in the update_icon() comments:

  • tray_running.png — green/active
  • tray_stopped.png — gray/inactive
  • tray_error.png — red/error

3. macOS menu bar considerations

  • Icons should be template images (monochrome with alpha) for proper dark/light menu bar adaptation
  • Recommended size: 22×22 @1x (44×44 @2x) for macOS
  • Tauri v2 supports .set_icon_as_template(true) for macOS template image rendering

4. Cross-platform

  • The tray-icon feature is already enabled in Cargo.toml
  • Linux and Windows tray icons work similarly but may need different sizes

Priority

P2 — Implemented feature is invisible to users. The tray menu exists but can't be accessed without a visible icon.

Acceptance Criteria

  • System tray icon appears in macOS menu bar when running the app
  • Icon is a proper macOS template image (adapts to light/dark menu bar)
  • Left-click on tray icon shows/focuses the main window
  • Right-click (or click on macOS) shows the tray menu
  • Icon appears on Linux and Windows system trays
  • (Stretch) State-specific icons show daemon status (running/stopped/error)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggui

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions