You are not logged in.

#1 2022-01-03 19:25:44

SolarBoyMatt
Member
Registered: 2012-01-07
Posts: 263

gobbl - A Bluetooth Battery Level Indicator Written in Go

AUR
Github

gobbl, short for Go Bluetooth Battery Level, is little utility I wrote few months back after getting a bluetooth keyboard and wanted to see it's current battery level in my WM's panel (and wanted an excuse to practice programming in Go wink ), and figured I'd share it!

It simply reads the available battery level via dbus for every bluetooth device that's both paired and connected, and prints it to STDOUT. Right now it only outputs info in either plaintext, or a JSON string that can be interpreted by Waybar, but it could be used with any bar or widget that can take input from a shell command! And I'd gladly merge in any additional formatting options, should anyone find this useful and want to contribute them.

Screenshot of the Waybar integration is on the github page

Offline

#2 2022-01-04 09:24:27

solstice
Member
Registered: 2006-10-27
Posts: 217
Website

Re: gobbl - A Bluetooth Battery Level Indicator Written in Go

hi. I have tried goggl.

First, I know nothing about go I had to make a search to know that I needed to run `go build` to compile it. May be add that to the README.md or a makefile but this is over-kill, here.

And otherwise, gobbl is giving me -1% for 2 of my bluetooth devices. I have not tested others so far;

$ ./gobbl 
JBL GO: -1%
$ ./gobbl -f Waybar
{"text":"JBL GO ?","tooltip":"JBL GO: ?","class":"$class"}
# disconnect that one and connect a sesh headphone wireless
$ ./gobbl 
Sesh: -1%
$ ./gobbl -f Waybar
{"text":"Sesh ?","tooltip":"Sesh: ?","class":"$class"}

Offline

#3 2022-01-13 23:00:22

SolarBoyMatt
Member
Registered: 2012-01-07
Posts: 263

Re: gobbl - A Bluetooth Battery Level Indicator Written in Go

solstice wrote:

hi. I have tried goggl.

First, I know nothing about go I had to make a search to know that I needed to run `go build` to compile it. May be add that to the README.md or a makefile but this is over-kill, here.

And otherwise, gobbl is giving me -1% for 2 of my bluetooth devices. I have not tested others so far;

$ ./gobbl 
JBL GO: -1%
$ ./gobbl -f Waybar
{"text":"JBL GO ?","tooltip":"JBL GO: ?","class":"$class"}
# disconnect that one and connect a sesh headphone wireless
$ ./gobbl 
Sesh: -1%
$ ./gobbl -f Waybar
{"text":"Sesh ?","tooltip":"Sesh: ?","class":"$class"}

Noted, will add that to the repo. I have provided an AUR package as well, in the main post!

as for the issue, '-1%' or '?' means that blueZ isn't reporting a readable battery level to dbus. I run into this issue occasionally too, sometimes after resuming from suspend, or after my keyboard goes to sleep. I don't know if it's my onboard bluetooth, or something in blueZ that causes this.  It could be that your BT devices just aren't reporting or can't report battery levels at all to dbus

When it happens to me, I just recycle bluetooth.service, and dbus can see battery levels again

# systemctl restart bluetooth.service

Let me know if that helps or not. Thanks for the feedback!

Last edited by SolarBoyMatt (2022-01-13 23:11:50)

Offline

#4 2022-10-28 12:22:04

meth_demon
Member
Registered: 2021-01-22
Posts: 1

Re: gobbl - A Bluetooth Battery Level Indicator Written in Go

SolarBoyMatt wrote:

Let me know if that helps or not. Thanks for the feedback!

unfortunately, it doesn't.

Offline

Board footer

Powered by FluxBB