Menu ▾ ▴

#32 macOS tray: left-click should toggle the window (not show a Quit-only menu); show unread count beside the icon

closed
nobody
2026-07-20
2026-06-30
Anonymous
No

Originally created by: kristofferR

On macOS the menu-bar (tray) icon misbehaves in two ways.

1. Left-click opens a pointless "Quit Carrier" menu instead of toggling the window

build_tray (src-tauri/src/lib.rs:327) is written to toggle the window on left-click and only show the Quit menu on right-click:

.menu(&menu)                     // menu = just "Quit Carrier"
.show_menu_on_left_click(false)
.on_tray_icon_event(|tray, event| {
    if let TrayIconEvent::Click { button: MouseButton::Left, button_state: Up, .. } = event {
        toggle_main(tray.app_handle());
    }
})

But on macOS, attaching a .menu() makes a left-click open the menu anyway — show_menu_on_left_click(false) doesn't suppress it reliably, and the TrayIconEvent::Click for the left button often never fires because the menu intercepts it. Result: clicking the icon just shows a menu whose only entry is "Quit Carrier" (see screenshot), and there's no way to show/hide the window from the tray.

Expected: left-click toggles (focus if hidden/unfocused, hide if it's the focused window) — toggle_main() already exists and does exactly this. Right-click (or ctrl-click) shows the Quit menu.

Likely fix: on macOS, don't attach the menu unconditionally — either drop .menu() and open a menu manually on MouseButton::Right, or use menu_on_left_click(false) semantics that actually hold on macOS. (Windows/Linux already behave: left toggles, right shows the menu.)

2. Show the unread count as a visible badge next to the icon (not just the tooltip)

Today the unread count from the page (carrier:unread) only updates the tray tooltip (lib.rs:1813-1826) — invisible until you hover. The count should be shown inline, to the right of the menu-bar icon, like other macOS menu-bar apps.

Expected:

  • When unread_badge is enabled (and per badge_mode = messages/conversations), set the tray title to the unread number on macOS via tray.set_title(Some(n)) so it renders next to the icon; clear it (empty/None) when the count is 0 or the setting is off.
  • Reuse the existing carrier:unread listener — it already has the number and the tray handle.
  • Optional: swap to an "unread" variant of the tray icon when count > 0, reverting when it hits 0.

Gate all of this on the existing unread_badge / badge_mode settings so it follows the user's preference, consistent with the Dock badge.

Notes

  • macOS-specific. set_title next-to-icon text is a macOS menu-bar affordance; on Windows/Linux the count stays in the tooltip (no inline title slot).
  • Relates to the Dock badge work in [#5].

Related

Tickets: #36
Tickets: #5

Discussion

  • Anonymous

    Anonymous - 2026-07-20

    Originally posted by: kristofferR

    Completed in [#140] and shipped in v1.4.0. On macOS, the tray menu is no longer attached unconditionally: left-click toggles the window, while right-click opens the menu manually. The unread listener also sets and clears the tray title according to the existing unread-badge setting.

     

    Related

    Tickets: #140

  • Anonymous

    Anonymous - 2026-07-20

    Ticket changed by: kristofferR

    • status: open --> closed
     

Log in to post a comment.