Repository navigation
Description
What happens
After closing the lid, or after the Mac has slept, StableBar is sometimes no longer running when the Mac wakes. No crash report is written. The process got a Quit through loginwindow, accepted it and exited normally. Nothing relaunches it, so the bar stays off on every wake after that until it's opened by hand. This makes it look like it happens "every time the lid closes".
Steps to reproduce
Not reliable. It happened twice in one day, out of about 15 lid closes and several idle sleeps:
- Run StableBar from /Applications, with the bar on the top edge.
- Close the lid (or let the Mac idle-sleep), then wake it.
- Sometimes StableBar is gone: no bar and no menu-bar icon, and
pgrep -x StableBarprints nothing.
A deliberate lid close (closed for 2 minutes) didn't reproduce it.
Expected
StableBar keeps running through sleep and wake. Failing that, it comes back on its own, or the reason it was quit is logged.
Environment
- StableBar 0.19.0 from /Applications
- macOS 27.2.1 (26B131), MacBook Pro (MacBookPro18,3), built-in display
- Clear theme, bar on the top edge with offset 0, AeroSpace running
Evidence
Unified log (/usr/bin/log show --predicate 'process == "StableBar"', plus loginwindow and backgroundtaskmanagementd):
1. 09:30:04, pid 8592, during a DarkWake. The Mac had idle-slept at 09:20 and nobody was using it.
09:30:02 DarkWake from Deep Idle [CDNP] (pmset)
09:30:04.717 backgroundtaskmanagementd noteUseOfItemWithIdentifier: identifier=2.org.stablebar.app
09:30:04.717 backgroundtaskmanagementd checkTasksAllowedInBackgroundForAppURL: shouldRegister:true ...
09:30:04.820 loginwindow [com.apple.libquit:logging] StableBar [8592] force quit (caller responsible for termination)
09:30:04.824 loginwindow (CrashReporterSupport) Write failed to file ~/Library/Application Support/CrashReporter/StableBar_….plist
09:30:04.824 loginwindow [com.apple.libquit:logging] StableBar [8592] calling back to client to terminate
09:30:04.911 StableBar Handling Quit AppleEvent -> applicationShouldTerminate: NSTerminateNow -> terminate
2. 16:53:52, pid 3307, as the lid closed.
16:53:50.886 StableBar CGSDisplayNotifyProc: got notification kCGSDisplayWillSleep
16:53:51.0 loginwindow shows the lock screen
16:53:52.006 backgroundtaskmanagementd noteUseOfItemWithIdentifier: identifier=2.org.stablebar.app
16:53:52.007 backgroundtaskmanagementd checkTasksAllowedInBackgroundForAppURL: shouldRegister:true ...
16:53:52.107 loginwindow [com.apple.libquit:logging] StableBar [3307] force quit (caller responsible for termination)
16:53:52.110 loginwindow [com.apple.libquit:logging] StableBar [3307] calling back to client to terminate
16:53:52.166 StableBar Handling Quit AppleEvent -> applicationShouldTerminate: NSTerminateNow -> terminate
16:53:55 Entering Sleep state due to 'Clamshell Sleep' (pmset)
Neither quit was done by the user. For comparison, a deliberate Force Quit from the Force Quit Applications window logs -[ProcessPanel serverOptionsSheetDidEnd:returnCode:] | Forcequit confirmed just before the same libquit lines. Neither quit above has that line, and neither has a Dock or Activity Monitor action. Both are StableBar alone; this isn't a logout batch. There was no memory pressure at either time. No sleep hook, LaunchAgent or StableBar configuration action quits apps on this Mac. The only StableBar*.ips is an unrelated dev build that failed to load Sparkle at launch.
Diagnosis
The sender isn't identified. What the code on main shows:
- StableBar doesn't quit itself on sleep.
Sources/StableBar/App/StableBarApp.swift(sleeping,woke,screensSlept,screenLocked) only pauses scripts and providers and stops the window-clearance and menu-bar timers. NSApp.terminateis reached only from Quit menus,--quit(RuntimeCommands.swift) and a failed runtime-control start.terminate()of other copies happens only in Uninstall (Uninstall.swift). The system monitor's quit action (WidgetActions.swift,confirmQuit) always asks first.applicationShouldTerminatereturns.terminateNow, so any Quit Apple Event ends the bar at once. No log of StableBar's own records why it quit.- Both quits come right after backgroundtaskmanagementd checks StableBar's background-task registration (
2.org.stablebar.app), which points at macOS's login-item / background-item handling rather than StableBar code. That's not confirmed.
Two things in StableBar could make this visible or recoverable: log the sender of a Quit Apple Event (keySenderPIDAttr on the current Apple Event in applicationShouldTerminate), and decide whether a bar quit during sleep should come back on wake, for example through a launchd KeepAlive helper or SMAppService relaunch.
Related
- Pause scripts and providers while the displays sleep or the screen is locked #219 / feat: pause scripts and providers while the displays sleep or the screen is locked #538 added the pause on display sleep and screen lock. That's related, but they don't quit the app.
- Turn on Open at login when setup replaces the menu bar #459 / feat: turn on Open at login when setup replaces the menu bar #507 turn on Open at login, which only starts StableBar at login.
- After the screen locks, clicks on the bar on a notched display show the menu bar again on macOS 27 #374 / fix: put the bar back above the menu bar strip after the screen locks #375 cover the bar after the screen locks on macOS 27, a different problem.
Triaged by Claude Code (Claude Opus 5.5).
Activity
M4n0x commentedon Nov 27, 2026
Dug into it, nothing in StableBar quits on sleep, the Quit comes from loginwindow right after backgroundtaskmanagementd checks the login item so it smells like a macOS thing. #953 logs who sends a quit and shows it in Settings → Status → Unexpected quits (and in
StableBar --report), once it's out could you paste what it says next time it happens, then we'll see if bringing the bar back on wake makes sensechore(release): 0.20.0 [skip ci]
stablebar-releases commentedon Nov 29, 2026
🎉 This issue has been resolved in version 0.20.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀
MaHofseth commentedon Nov 30, 2026
@M4n0x 0.20.0 caught it twice on 29 Nov. Both are in Settings → Status → Unexpected quits:
com.apple.loginwindow, pid 440, parent launchd (1))com.apple.loginwindow, pid 440, parent launchd (1))The unified log around both quits runs the same way as the two cases in the report, so that's four out of four:
So it's always loginwindow, always during a maintenance DarkWake while the Mac is asleep and locked, and always about 100 ms after backgroundtaskmanagementd checks StableBar's background-item entry. The log still doesn't say why loginwindow decides to quit it, and the bar stays off until it's opened by hand.
This was closed when 0.20.0 shipped the diagnostics, but the quit itself still happens. Could you reopen it so we can decide whether the bar should come back after a wake?
Posted by Claude Code (Claude Opus 5.5).
MaHofseth commentedon Nov 30, 2026
Likely cause found: on this Mac, "Allow in the Background" is off for StableBar, and macOS quits the app when it checks that setting during a maintenance wake.
sudo sfltool dumpbtmhas one StableBar entry and one child entry. Both point at the release build (/Applications, release Team ID), so there are no stray dev builds involved:8192.org.stablebar.app, and 20:36:27 is when StableBar exited.So the likely chain: during a maintenance wake, macOS counts something StableBar does as background activity, finds the item disallowed, and loginwindow quits the app to enforce it. That fits all four quits: only while asleep and locked, about 100 ms after the background-item check, and rare (4 in about 200 dark wakes since 27 Nov).
Ruled out along the way: Sparkle's hourly check (the 20:36 quit came 17 minutes after launch), device management (no MDM, no profiles), and logout, restart or shutdown (the records have no quit reason).
Next: run a few days with "Allow in the Background" turned on. If the quits stop, this is confirmed. I'll report back either way.
StableBar only registers
SMAppService.mainApp, so the8192.item is one macOS creates on its own. Two things StableBar could do, if it's confirmed:Posted by Claude Code (Claude Opus 5.5).