Skip to content

Show connected Bluetooth devices and their battery #220

Closed

Description

@Seb-GRAF

Scope, as narrowed in the comments below: a bluetooth provider that reads system_profiler SPBluetoothDataType -json and needs no permission, with lists.devices (name, kind, icon, battery, level, fraction), fields.summary, values.lowestBattery and text. Power, addresses, connect and disconnect events, and Bluetooth access stay out: they need IOBluetooth and its access prompt.

Problem

The bar can't show which Bluetooth devices are connected or how charged they are. You learn that a Magic Mouse or AirPods are low only when macOS warns you. Stats, iStat Menus and Waybar's bluetooth module show both. The battery provider covers only the Mac's own battery.

Proposal

  • A bluetooth provider: fields.power (on or off), fields.connected (the number of connected devices), and lists.devices with name, address, kind (such as headphones, mouse, keyboard, trackpad) and battery when the device reports one. values.lowestBattery (0–1) lets rules warn when any device runs low.
  • It updates on connect and disconnect notifications and polls battery levels every interval, and sends bluetoothChange and bluetoothDeviceChange events.
  • Its registry entry declares Bluetooth access, so setup lists it, and Info.plist gains NSBluetoothAlwaysUsageDescription. Packages can already declare "permissions": ["bluetooth"]; no store package uses it yet.
  • Connecting or disconnecting a device from a popup row is a possible follow-up.

APIs, and what I could and couldn't verify:

  • Connected devices: IOBluetoothDevice.pairedDevices() with isConnected(), and IOBluetoothDevice.register(forConnectNotifications:selector:), are public in IOBluetooth. On recent macOS, apps using IOBluetooth need Bluetooth access; I didn't verify whether reading paired devices alone prompts.
  • Magic Mouse, Keyboard and Trackpad battery: the BatteryPercent property on their HID services in the IORegistry, read with public IOKit calls (IOServiceGetMatchingServices, IORegistryEntryCreateCFProperty). No access needed, as far as I know.
  • AirPods and other headphones: per-bud and case levels aren't in a public API. They're in private IOBluetoothDevice methods (such as batteryPercentLeft), which conflicts with the public-API stance, and in system_profiler SPBluetoothDataType output, which is slow to run. Open question: show headphone battery only where a public source exists, or leave it to packages.

Possible today

Partly. A script can parse system_profiler SPBluetoothDataType -json for connected devices and AirPods battery, and ioreg -r -k BatteryPercent for Magic accessories. system_profiler takes about a second each run, and nothing tells the script when a device connects.

Related

Triaged by Claude Code via T3 Code (Claude Opus 5.5).

Activity

  1. added
    enhancement
    on Oct 22, 2026
  2. added
    P3
    on Nov 8, 2026
  3. Seb-GRAF commented on Nov 11, 2026

    @Seb-GRAF
    CollaboratorAuthor

    needs Bluetooth access, and AirPods battery is private API. not worth it for now

  4. Seb-GRAF commented on Nov 16, 2026

    @Seb-GRAF
    CollaboratorAuthor

    reopening for the part that needs no permission: an accessories provider that lists Apple keyboards, mice and trackpads with their battery, read from BatteryPercent on their HID services with public IOKit. No IOBluetooth, so no Bluetooth access

    • lists.devices with name, kind (keyboard, mouse, trackpad) and battery as a whole percentage
    • values.lowestBattery (0–1) so rules can warn when one runs low
    • it reads again every interval

    AirPods and other headphones stay out, their battery is only in private API. A script can still read them from system_profiler SPBluetoothDataType. The full bluetooth provider above stays a follow-up

  5. Seb-GRAF commented on Nov 16, 2026

    @Seb-GRAF
    CollaboratorAuthor

    changing the approach: Apple's BatteryPercent only covers Magic accessories, and most keyboards and mice people use (and AirPods) don't publish it. system_profiler SPBluetoothDataType -json lists every connected device with the battery macOS knows, AirPods per bud included, without any permission, and answers in about 0.1 s here

    so the provider becomes bluetooth, reading that output natively so packages can use it:

    • lists.devices with name, kind (keyboard, mouse, trackpad, headphones, other), icon, battery (such as 100% or 76% · 77%) and level (the lowest, as a whole percentage)
    • fields.summary, the devices with a battery in one line, values.lowestBattery, and text the number of connected devices
    • it reads again every interval, off the main thread

    it's the first native provider that runs a tool instead of calling an API, so DECISIONS.md gets an entry for it. Its JSON keys aren't documented by Apple, so a missing key just leaves that device's battery empty

  6. stablebar-releases commented on Nov 16, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.17.0 🎉

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3enhancementreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions