Skip to content

fix: Claude widget auto-connects on launch and survives sleep#23

Merged
bottlebrushes merged 1 commit intomainfrom
bettercoderthanyou/claude-widget-refresh
Feb 23, 2026
Merged

fix: Claude widget auto-connects on launch and survives sleep#23
bottlebrushes merged 1 commit intomainfrom
bettercoderthanyou/claude-widget-refresh

Conversation

@bottlebrushes
Copy link
Copy Markdown
Owner

Summary

  • Sleep/wake fix: Changed NotificationCenter.default to NSWorkspace.shared.notificationCenter for didWakeNotification. The previous observer never fired because workspace notifications are posted to the workspace's own notification center, not the default one.
  • Auto-connect on launch: startUpdating(config:) now calls reconnectIfNeeded(), so the widget fetches usage data as soon as it appears in the menu bar instead of waiting for the user to open the popup.
  • Refresh button fix: refresh() now attempts connectAndFetch() when credentials aren't cached, instead of silently doing nothing.

Test plan

  • Launch Barik — Claude widget should show usage ring immediately without opening popup
  • Click refresh button in popup — should update the "Updated X sec ago" timestamp
  • Sleep and wake the Mac — widget should refresh data automatically

🤖 Generated with Claude Code

- Use NSWorkspace.shared.notificationCenter for didWakeNotification
  (was incorrectly using NotificationCenter.default, which never fires)
- Call reconnectIfNeeded() from startUpdating() so widget fetches data
  as soon as it appears in the menu bar, not only when popup is opened
- Refresh button now attempts connectAndFetch() when credentials aren't
  cached instead of silently failing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bottlebrushes bottlebrushes merged commit 57d5772 into main Feb 23, 2026
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