Repository navigation
feat(desktop): keep the app running in the tray when the main window closes - #1712
Merged
github-actions[bot] merged 2 commits intoNov 10, 2026
Conversation
…closes Implements amended local ADR 0043 §5. Closing the main window hides it to a notification-area icon, so the process and its MCP listener keep answering. - MainWindowClosePolicy decides Hide or Quit. - ShellWindows handles AppWindow.Closing: when the policy says Hide, it cancels the close, flushes and hides. ActivateMainWindow shows the window first. - TrayIcon is hand-written Shell_NotifyIcon interop with an Open Backlog / Quit menu, double-click and Enter, a re-add on TaskbarCreated, and removal on exit. - A plain second launch is redirected to the running instance. A start by the sign-in startup task opens to the tray. - The first hide shows a one-time toast. Toast presses go through ActivateMainWindow. - WorkspaceSettingsStore gains KeepRunningInTray and TrayHintShown. - The MCP server settings page gains "Keep running in the tray when closed" and "Start Backlog when I sign in", through IStartupRegistration, which the MSIX StartupTask backs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 10, 2026
…4 embed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 10027f6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This builds amended local ADR 0043 §5: closing the desktop app's main window hides it to the notification area instead of quitting. The process and the MCP listener keep running, so Claude sessions keep the
backlogtools.Backlog.Desktop.UI/Shell/MainWindowClosePolicy.csAppWindow.Closinghandling. On Hide: cancel the close, flush the navigation and bounds stores, hide the window; popped-out windows stay open. On Quit: the existing flush, close every window, quit.ActivateMainWindowshows the window first.RequestQuitis the tray's QuitBacklog.Desktop/Services/ShellWindows.csShell_NotifyIconinterop with no package. It uses the exe's icon and the window title as tooltip. Menu: Open Backlog / Quit. Double-click or Enter opens the window. The icon is re-added onTaskbarCreatedand removed on exitBacklog.Desktop/Services/TrayIcon.cs(new)StartupTaskactivation opens to the trayBacklog.Desktop/Services/BacklogLinkInstance.cs,App.xaml.csActivateMainWindow. The first hide ever shows a one-time toast, recorded per machineBacklog.Desktop/Services/WindowsAppNotifications.csKeepRunningInTray(default true),TrayHintShownandTrayChanged, saved as atrayrow only while either value differs from its defaultWorkspaceSettingsStore.csToggles: Keep running in the tray when closed and Start Backlog when I sign inMcpServerSettingsPage.razor,SettingsPages.csIStartupRegistrationport, backed by the MSIXStartupTask; it answers Unavailable when the process has no package identityShell/IStartupRegistration.cs,Services/WindowsStartupRegistration.csuap5:StartupTaskwith TaskIdBacklogStartup,Enabled="false", DisplayNameBacklogPlatforms/Windows/Package.appxmanifestAcceptance criteria and how each was verified
MainWindowClosePolicyTests(5 cases).WM_CLOSEthe window is hidden and the process is alive. The Quit path is unchanged code (Destroying→Flush+CloseEveryOtherWindowAndQuit).ActivateMainWindowre-shows a hidden window. Desktop smoke: a relaunch and a tray double-click each set the window visible again.NIN_KEYSELECTeach open the window. The right-click menu was not driven (see below).tray.hintShown: trueto settings.json, so the toast path ran.OpenCentrenow goes throughActivateMainWindow; that was checked by reading the code.WorkspaceTraySettingsTests(7 tests).McpServerBackgroundSettingsTests(9 tests) covers default on, saving, a change made elsewhere, sign-in on/off, Unavailable, DisabledByUser and DisabledByPolicy, and the no-port host. The harness screenshot shows the card in a host without the port.Backlog.Desktop_1.0.0.1_x64.msix, so MakeAppx accepted the manifest. The hidden start itself was not run (see below).MsixAppUpdateServiceandBrowserTabShellWindowshave no diff, and the mobile head has none either.Build & Test
dotnet build Backlog.sln(Debug): 0 warnings, 0 errors.dotnet build Backlog.WithoutAppHeads.slnf -c Release -p:TreatWarningsAsErrors=true: 0 warnings, 0 errors.TreatWarningsAsErrors: 0 warnings, 0 errors.AppxPackageSigningEnabled=false): package built. The only warning is the knownmspdbcmf.exeone.dotnet test --solution Backlog.sln: 22,924 total, 22,903 passed, 19 skipped, 2 failed. Both failures areC4WorkspaceTests(No_chapter_carries_a_reference_the_knowledge_index_generator_would_reject,Every_embedded_view_exists_in_the_committed_workspace). They fail on.devbook/arc42/adr/0046-…from the base branchplan/tray-keep-alive, and this PR touches no.devbook/file.mainhas newer C4 fixes (fix(c4-zoom): close the C4 zoom navigation review gaps #1707) that the plan branch does not have yet.Review findings left open
The fresh-context review ran 2 rounds. Round 1 found 2 blockers, both fixed: lock-file churn, and a hide with no tray icon (the policy now requires the icon). The advisories fixed were a cancelled shutdown forcing quit, keyboard select, remembered windows popping up at a sign-in start, and an
NIM_MODIFYfallback onTaskbarCreated. Still open, both advisory:SetKeepRunningInTrayandMarkTrayHintShownwrite the settings file without a lock, like every other setter in the store already does.TaskbarCreatedarrives; a relaunch brings the window back.What could not be proved
Please validate these by hand in the installed (MSIX) app:
backlog://link and press a toast: each brings the main window back.open_windowfrom a session still opens a pop-out.Assumptions
TaskbarCreated, which the entry also asks for, and the sign-out and shutdown messages are all broadcasts.WM_QUERYENDSESSION) only flushes. The confirmed end (WM_ENDSESSION) makes the next close quit, so a shutdown another app cancels does not change ✕.IStartupRegistration(the web harness) shows a note instead of switches. This keepsSettingsSection.CardTitlestrue everywhere.tray.hintShown: truein the shared%LOCALAPPDATA%\Backlog.Debug\settings.json, so other Debug worktrees will not show the first-hide toast.Opened by an unattended
execute-planrun (plantray-keep-alive, entry7105f152-42dd-4b92-8d53-72cdfe58850d). Personal Validation is still pending; this draft stands in for that gate.🤖 Generated with Claude Code