Skip to content

feat(desktop): close to the notification area on Windows - #3452

Open
jhedlund wants to merge 2 commits into
block:mainfrom
jhedlund:feat/windows-close-to-tray
Open

jhedlund wants to merge 2 commits into
block:mainfrom
jhedlund:feat/windows-close-to-tray

Conversation

@jhedlund

Copy link
Copy Markdown

Why

On Windows, closing the Buzz window quits the app, which stops every local agent. I run my agents on a Windows desktop, so an accidental close takes them all offline.

What

Closing the window on Windows now hides it, as it already does on macOS. Buzz adds a notification-area icon: left click opens Buzz, and its menu offers Open Buzz and Quit Buzz.

How

  • New src-tauri/src/tray.rs; the tray-icon feature is enabled for Windows builds only.
  • Quit takes the same exit as the app menu, so agents still stop with Buzz.
  • Launching Buzz again shows the hidden window through the existing single-instance handler.

This ports my 0.x PR block/buzz#6893 to the 1.0 codebase, where another Windows user tested it and asked for it to land. It's a narrower take on #1632: Windows only, and it leaves Ctrl+W and Linux alone. Happy to close this in favour of #1632 if that's the direction prefered.

Risk

Changes window lifetime on Windows. macOS and Linux are untouched.

Testing

I've been running this daily in a Windows 11 build: close to tray, reopen from the icon and from a second launch, Quit from the tray menu, agents keep answering while hidden. Not tested on Windows 10 or ARM.

Built with help from a Claude agent.

Closing Buzz's window on Windows quit the app and stopped every running
agent. It now hides the window, as on macOS, and Buzz adds an icon to the
notification area: a left click opens Buzz, and its menu offers Open Buzz
and Quit Buzz. Quit takes the same exit as the app menu, so agents stop
with Buzz. Opening Buzz again also shows the hidden window, through the
existing single-instance handler.

The tray-icon feature is enabled only for Windows builds.

Ports block/buzz#6893. Refs block#1632.

Co-authored-by: Engineer <f79d52bb0d4ab12c7affaf2235c113a7fc797a9da8f9707757123b67cfafa6c6@buzz.matrixsoftwareinc.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jeff Hedlund <jhedlund@gmail.com>

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Not approving: this account doesn't approve UI changes, and this PR needs a design or core-team reviewer. It changes window-close behavior on Windows, adds a notification-area icon and menu ("Open Buzz", "Quit Buzz", tooltip), and updates in-app help.

What I checked:

  • Other platforms: the tray module, the CloseRequested handler and the tauri tray-icon dependency are all cfg(windows) or in the Windows target section. macOS and Linux close behavior is unchanged. Cargo.lock already lists tray-icon under tauri.
  • Quitting: the tray's Quit calls app.exit(0), which runs RunEvent::Exit and shut_down, so host processes stop. Update install and the restart after an update or sign-out go through exit/request_restart, not a window close, so the hidden window doesn't stop them. Relaunching Buzz shows the hidden window through the single-instance handler (not active in dev builds, where only the tray gets it back). The titlebar Close button and Alt+F4 now hide instead of quit.

Findings: one P2, inline: a tray failure aborts startup.

Not reviewed or run: I didn't run this on Windows. I did not verify how Windows logoff or shutdown interacts with a prevented close, whether the tray icon comes back after an Explorer restart, or whether a hidden WebView2 window keeps agents responsive over long periods. The icon can also land in the overflow area, and nothing tells a first-time user that Close now keeps Buzz running. That is a design call. CI shows only Semgrep, zizmor and DCO, so no tests have run on this head.

Comment thread src-tauri/src/lib.rs Outdated
reshow::install(app.handle());
// Before any close hides the window: the icon is the way back.
#[cfg(windows)]
tray::install(app.handle())?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 P2: ? here makes any tray failure (for example the shell's notification area being unavailable at launch) abort setup, so Buzz won't start at all on that machine. The close handler below also hides the window whether or not the icon exists, so a failure that was only logged would leave a hidden app with no way back except relaunching. Consider logging the error and keeping close-to-quit unless the icon was created.

Adding the Windows tray icon used `?` during setup, so any failure (for
example the notification area being unavailable at launch) stopped Buzz
from starting. The error is now logged instead, and closing the window
hides it only while the icon exists; without one, Close quits as before,
so the window is never hidden with no way back.

Co-authored-by: Engineer <f79d52bb0d4ab12c7affaf2235c113a7fc797a9da8f9707757123b67cfafa6c6@buzz.matrixsoftwareinc.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jeff Hedlund <jhedlund@gmail.com>

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Re-review at 3c6f96f. This account isn't approving UI changes, so this needs a design or core-team reviewer.

Fixed: tray install failure is now logged instead of aborting setup, and the close handler only hides the window when the tray icon exists (tray::installed), so a failed install falls back to close-to-quit. New unit test covers installed() before/after install.

Still open: nothing from the earlier review. No new findings.

I haven't run this on Windows; the failure fallback path (install error then Alt+F4 quits) is untested.

This branch has not been deployed

No deployments
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.

2 participants