tilmanginzel / alfred-bluetooth-workflow

Yet another Alfred workflow to connect / disconnect Bluetooth devices
MIT License
189 stars 8 forks source link

Add back battery level display #17

Closed cgjosephlee closed 3 years ago

cgjosephlee commented 4 years ago

Is it possible?

tilmanginzel commented 4 years ago

Hi @cgjosephlee, unfortunately this is currently not possible (despite the screenshots claiming it). We had to drop this feature in favor of a couple of other improvements, see https://github.com/tilmanginzel/alfred-bluetooth-workflow/pull/14. blueutil does not expose the battery percentage, and after a quick check of the underlying IOBluetooth API, MacOS itself does not expose this via the API.

On the other hand, @trietsch referenced a couple of possible workarounds. So we might be able to re-add this in the future. :)

I probably won't have time in the coming weeks, but I will keep the issue open.

trietsch commented 4 years ago

I've also checked ioreg, which directly checks devices linked to macOS, though for many devices, the BatteryPercent is just not exposed. Hence, it's also not shown in the bluetooth menu bar dropdown. There doesn't seem a generic way for Bluetooth devices to expose this information to macOS. My guess is, that there is no simple way to bring this back. Also, the system_profiler SPBluetoothDataType does not expose battery percentage for e.g. a Logitech MX Master mouse.

@tilmanginzel I'd say, let's drop this issue, even though I'd like to have a battery percentage feature as well.

tilmanginzel commented 4 years ago

Yes as far as I have seen the battery percentage is generally only shown for Apple devices.

The output from ioreg cannot be correlated with the output from blueutil, as ioreg lists a different device name (maybe I missed the device ID?). system_profiler on the other hand would work for some devices, this was used previously. Unfortunately system_profiler was a lot slower than just using blueutil. Additionally, the XML output has a very weird structure so parsing it with default python 2.7 libraries was kinda annoying.

So both ioreg and system_profiler are no viable option as far as I can see.

I would propose to keep this issue open a couple of weeks (I want to investigate further and maybe someone else has an idea). If no viable option is found until then, we can close it.

tilmanginzel commented 3 years ago

As mentioned above, closed for a lack of viable solutions.