From 0c8cb9e8eb252e35f84211a37f808a84d9f1b82c Mon Sep 17 00:00:00 2001 From: ozymandiashh <234437643+ozymandiashh@users.noreply.github.com> Date: Tue, 4 Aug 2026 02:24:23 +0300 Subject: [PATCH 1/2] experiment(menubar): activate before setupStatusItem, no policy transition Test build for #868. Keeps the activation policy pinned at .accessory (LSUIElement makes the :92-96 call a no-op in packaged builds anyway) and restores only the NSApp.activate(ignoringOtherApps: true) half of the #147 fix, immediately before the status item is created. --- mac/Sources/CodeBurnMenubar/CodeBurnApp.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift index befaf027..3f126995 100644 --- a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift +++ b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift @@ -120,6 +120,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate, NSM // interaction (popover open, wake) refreshes immediately. restorePersistedCurrency() + // #868 experiment: restore only the activation half of the #147 fix. + // Packaged builds ship LSUIElement=true, so the policy is .accessory + // before main() runs and never transitions (the transition is what + // plausibly caused the ghost item). Accessory apps can still activate, + // which registers the app with the window server before the status + // item is created - the effect #147 actually needed for #146. + NSApp.activate(ignoringOtherApps: true) setupStatusItem() setupPopover() observeStore() From 1ba09dc423654d7d0e3bf94b6eed9a656480c9e4 Mon Sep 17 00:00:00 2001 From: iamtoruk Date: Mon, 10 Aug 2026 06:21:37 -0700 Subject: [PATCH 2/2] docs(menubar): correct the activation-policy comment the #868 probe disproved --- mac/Sources/CodeBurnMenubar/CodeBurnApp.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift index 3f126995..f33f0516 100644 --- a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift +++ b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift @@ -90,9 +90,15 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate, NSM } func applicationWillFinishLaunching(_ notification: Notification) { - // Set accessory policy before the app's focus chain forms. On macOS Tahoe - // (26.x), setting it after didFinishLaunching causes ghost status items - // because the policy gets baked into the initial focus chain. + // Belt-and-suspenders for dev runs only: packaged builds ship + // LSUIElement=true (package-app.sh / build-local.sh), so LaunchServices + // starts the process at .accessory before main() runs and this call is + // a measured no-op there (returns false, no state change — #868 + // analysis). What actually matters is that the policy NEVER + // transitions while a live NSStatusItem exists: the .regular → + // .accessory dance from #147 is what plausibly caused the ghost item + // that 85b5728 fixed. Keep the policy pinned; see the activate() call + // in applicationDidFinishLaunching for the other half of the story. NSApp.setActivationPolicy(.accessory) }