Show Bluetooth accessory connections with battery level

LU
1mo ago
+336-0

Summary

Shows Bluetooth accessories in the closed notch when they connect or disconnect, with their battery level when available.

  • Connection banner with the device icon, name and battery level (separate left/right levels for AirPods when they differ); disconnections show "Disconnected".
  • Battery comes from IOBluetooth (AirPods, Beats, most headsets). For Magic Keyboard, Mouse and Trackpad it falls back to the AppleDeviceManagementHIDEventService registry entry.
  • Devices that are already connected when monitoring starts are not announced. Battery values are refreshed shortly after connecting, since they're often published a moment after the link comes up.
  • Opt-in from Settings > Battery > Accessories, because macOS asks for Bluetooth access. That way existing users don't get a permission prompt on update.

Project changes: adds the com.apple.security.device.bluetooth sandbox entitlement and NSBluetoothAlwaysUsageDescription.

Note: the per-earbud battery values use IOBluetooth selectors that aren't publicly documented (batteryPercentLeft/Right/Case/Single). They're accessed defensively (responds(to:) + range check), so if they ever go away the banner simply shows "Connected" without a percentage.

Closes #206, closes #1387

Testing

  • Built and ran on macOS 26 (Apple Silicon) with AirPods Pro: the notch shows "AirPods Pro · 100%" on connect.
  • No translation changes (new strings will sync to Crowdin).

Screenshots

Recording added in the comments below.

🤖 Generated with Claude Code