Skip to content

fix(statusbar): make the connected indicator truthful at the edges - #104

Merged
MegaManSec merged 1 commit into
MegaManSec:mainfrom
hotsnow:feat/statusbar-active-indicator
Aug 10, 2026
Merged

fix(statusbar): make the connected indicator truthful at the edges#104
MegaManSec merged 1 commit into
MegaManSec:mainfrom
hotsnow:feat/statusbar-active-indicator

Conversation

@hotsnow

@hotsnow hotsnow commented Aug 9, 2026

Copy link
Copy Markdown

Summary

Review fixes for the connected-state menu-bar indicator that merged in #105. The feature itself is unchanged; these close the windows where the indicator lied and trim redundant work.

Fixes

  • Send-preflight misreportperipheralPresence counts .releasing as still-here: the device stays physically connected through the up-to-5s ping preflight (during which the icon un-filled and the tooltip claimed nothing was connected), and the transfer arrow takes over once the release actually starts.
  • Launch race — a registered peripheral with no connectionStates entry reads as unknown (plain icon), not away (every snapshot writes an entry per registered id, so absence means "no snapshot yet"). The old .poweredOn guard in idlePeripheralPresence() didn't close this race, so the wrapper is gone.
  • Stale "away" after a late radio — connection states are re-fetched on the CoreBluetooth .poweredOn transition; the store's init-time snapshot bails while the radio reads off (e.g. a login-item launch), and already-connected peripherals fire no new connect event, which left a false "away" standing for minutes.
  • Ping bell flash — the 3s bell now survives idle refreshes (connection-state churn triggers them constantly); only a transfer arrow or needs-attention state cuts it short, restoring the original intent.
  • Shared NSImage(named:) mutation — both icons composite from .copy()s of a single statusBarGlyph; the shared cache instance is never mutated.
  • Redundant work — the icon observer maps $peripherals.combineLatest($connectionStates) to the derived presence with removeDuplicates(), so no-op publishes (reconnect probes, peer syncs) don't force redraws; refreshStatusBarIcon() computes the tooltip once and reuses it for toolTip and the accessibility label.

@hotsnow
hotsnow requested a review from MegaManSec as a code owner August 9, 2026 10:17
@hotsnow
hotsnow marked this pull request as draft August 9, 2026 10:20
@MegaManSec

Copy link
Copy Markdown
Owner

I like this idea! Once it's undrafted, I would like to make some changes to the PR, and we can merge.

@MegaManSec

Copy link
Copy Markdown
Owner

See hotsnow#1

@hotsnow

hotsnow commented Aug 10, 2026

Copy link
Copy Markdown
Author

That's great. I also push a bug fix for the icon transparent bug, it's working now. Feel free to close this PR. Thanks.

@MegaManSec

Copy link
Copy Markdown
Owner

Pushed the rework from hotsnow#1 onto this branch (merged with your contentTintColor fix — the filled-background approach removes the dimming code entirely, so that bug can't occur). #105 tracks the same head against main; merging either will close both.

@MegaManSec
MegaManSec marked this pull request as ready for review August 10, 2026 10:05
@MegaManSec
MegaManSec force-pushed the feat/statusbar-active-indicator branch from 6156b59 to 7ec469b Compare August 10, 2026 10:31
Review fixes for the connected-state indicator that merged in MegaManSec#105:

- peripheralPresence now counts .releasing as still-here (the device
  stays physically connected through the up-to-5s send preflight,
  during which the icon previously un-filled and the tooltip claimed
  nothing was connected), and treats a registered peripheral with no
  connectionStates entry as unknown rather than away, so a cold launch
  can't misreport a connected keyboard before the first IOBluetooth
  snapshot lands.
- Re-fetch connection states when CoreBluetooth reaches .poweredOn:
  the init-time snapshot bails while the radio reads off (login-item
  launch), and already-connected peripherals fire no new connect
  event, which left a false "away" standing for minutes.
- The icon observer derives presence via combineLatest +
  removeDuplicates instead of a Void merge, so routine no-op publishes
  (reconnect probes, peer syncs) no longer force a status-item redraw.
- The 3s ping bell flash survives idle refreshes; only a transfer
  arrow or needs-attention state cuts it short, restoring the original
  intent now that connection churn triggers refreshes.
- Both status-bar icons composite from copies of the named image; the
  shared NSImage(named:) cache instance is never mutated.
- refreshStatusBarIcon computes the tooltip once and reuses it for
  toolTip and the accessibility label.
@MegaManSec
MegaManSec force-pushed the feat/statusbar-active-indicator branch from 7ec469b to ec4983f Compare August 10, 2026 10:32
@MegaManSec MegaManSec changed the title feat(statusbar): indicate active peripheral connection status in menu bar icon fix(statusbar): make the connected indicator truthful at the edges Aug 10, 2026
@MegaManSec

Copy link
Copy Markdown
Owner

42b2e9a

@MegaManSec
MegaManSec merged commit 1cacb70 into MegaManSec:main Aug 10, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.25.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants