Skip to content

feat(desktop): add close-to-tray option - #3157

Open
Cvv9 wants to merge 1 commit into
block:mainfrom
Cvv9:feat/close-to-tray
Open

feat(desktop): add close-to-tray option#3157
Cvv9 wants to merge 1 commit into
block:mainfrom
Cvv9:feat/close-to-tray

Conversation

@Cvv9

@Cvv9 Cvv9 commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Adds a Keep Buzz running when the window closes setting under General settings.
When enabled, closing the main window hides it instead of quitting. Windows and
Linux users can reopen or quit Buzz from a lazily-created system tray icon;
macOS continues to use the standard Dock reopen and application Quit behavior.

Why

Closing the only Buzz window currently exits the desktop process, which also
stops notifications and locally managed agents. Users who want Buzz to continue
working in the background need an explicit, persistent close-to-tray option
without changing the default quit path when native tray setup fails.

Implementation

  • Persists the machine-local preference in localStorage and applies it to the
    Tauri backend on launch and whenever the toggle changes.
  • Creates the Windows/Linux tray icon only while the feature is enabled.
  • Fails closed: if tray creation fails, the preference is turned back off so
    closing the window still exits normally.
  • Keeps the two process-wide close/quit lifecycle flags in the dedicated tray
    module rather than adding more community-agnostic state to AppState.
  • Marks genuine application exits before teardown so the close handler never
    traps an explicit Quit or restart.

Validation

  • cargo check --manifest-path desktop/src-tauri/Cargo.toml
  • cargo test --manifest-path desktop/src-tauri/Cargo.toml tray::tests --lib
    — 4 passed
  • pnpm -C desktop check:file-sizes
  • Biome check for all six changed frontend files
  • Rust formatting and git diff --check

The branch was refreshed onto current block/buzz main.

Add a "Keep Buzz running in the tray" General setting. When enabled,
closing the main window hides it to a system tray icon instead of
quitting; left-click or the tray menu reopens it, and "Quit Buzz"
exits. The preference is persisted in localStorage and pushed to the
backend, which decides at window-close time whether to hide or quit.

The tray icon is created lazily only while the feature is enabled, so
users who never opt in never see it. Enabling fails closed: if the tray
icon cannot be built the setting stays off, so the close button always
has a way to quit. A genuine app exit marks the window as quitting so
teardown is not trapped by the hide-to-tray handler, the macOS dock
icon re-shows a hidden window, and Linux opens the tray menu on
left-click where activation events are unreliable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: benthecarman <benthecarman@live.com>
Signed-off-by: Cvv9 <Varun.cumbamangalam@oralens.com>
Signed-off-by: Cvv <varun.cumbamangalam@oralens.com>
@Cvv9
Cvv9 force-pushed the feat/close-to-tray branch from e9622af to af26209 Compare July 30, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant