Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth not able to retrieve battery percentage #91

Closed
cafetestrest opened this issue Sep 11, 2023 · 14 comments
Closed

Bluetooth not able to retrieve battery percentage #91

cafetestrest opened this issue Sep 11, 2023 · 14 comments

Comments

@cafetestrest
Copy link

Hi @Aylur ,
From the last couple of commits, Bluetooth is unable to display batteryPercentage. This worked before, can you replicate it?
If not, I will try to debug it by downgrading ags to the version that it used to work before.

Also, unrelated to this, how would I be able to retrieve RAM usage in GB instead of percentage wise?

@Aylur
Copy link
Owner

Aylur commented Sep 11, 2023

I am not sure how to replicate it since, it never worked for me, I always assumed that my devices just don't send information about battery, but now that you mention it I know for a fact my earphones do
I don't remember touching that part of the code, but it would help if you could pinpoint the commit

@Aylur
Copy link
Owner

Aylur commented Sep 11, 2023

Also, unrelated to this, how would I be able to retrieve RAM usage in GB instead of percentage wise?

I would use free get the used amount and divide it by 1024

@cafetestrest
Copy link
Author

Hi @Aylur ,
Alright, after some trial and error I got Bluetooth battery percent to appear with latest ags version. So the problem is not with ags but in fact due to me getting rid of gnome.

When I install gnome I get bluetooth battery percent to work. So I guess it is tied with something in the gnome to make it work?

@cafetestrest
Copy link
Author

I would use free get the used amount and divide it by 1024

I know that, trying to make it work with the new addition of the SysProgress to show ram used not by the percentage but by the GB.

I can do a execAsync to retrieve a bash command for "free --giga -h | grep 'Mem' | awk '{print $3}'" that does the trick, but wondering how it can be incorporated with SysProgress?

@Aylur
Copy link
Owner

Aylur commented Sep 12, 2023

I can do a execAsync to retrieve a bash command for "free --giga -h | grep 'Mem' | awk '{print $3}'" that does the trick, but wondering how it can be incorporated with SysProgress?

You mean the CircularProgresses? They represent a percentage show I am not sure what you are trying to accomplish

@Aylur
Copy link
Owner

Aylur commented Sep 12, 2023

When I install gnome I get bluetooth battery percent to work. So I guess it is tied with something in the gnome to make it work?

I also have gnome installed and they don't work for me. Maybe there is a depndency of gnome-bluetooth that I am missing

@cafetestrest
Copy link
Author

You mean the CircularProgresses? They represent a percentage show I am not sure what you are trying to accomplish

You know that you implemented a tooltip for a DateColumn's SysProgress box. That tool-tip shows percentage used by by ram and cpu. I would like it to show GB used instead.

@cafetestrest
Copy link
Author

cafetestrest commented Sep 12, 2023

Hi @Aylur ,

I also have gnome installed and they don't work for me. Maybe there is a depndency of gnome-bluetooth that I am missing

Does this snippet work for you - this is in SystemIndicators.js?

const BluetoothDevicesIndicator = () => Box({
    connections: [[Bluetooth, box => {
        box.children = Bluetooth.connectedDevices
            .map(({ iconName, batteryPercentage }) => HoverRevealer({
                indicator: Icon(iconName + '-symbolic'),
                child: Label(batteryPercentage.toString()),
            }));

        box.visible = Bluetooth.connectedDevices.length > 0;
    }]],
});

@Aylur
Copy link
Owner

Aylur commented Sep 12, 2023

You know that you implemented a tooltip for a DateColumn's SysProgress box. That tool-tip shows percentage used by by ram and cpu. I would like it to show GB used instead.

you can use another ags.Variable and bind the tooltipText to it, or have a polling connection on the widget, there are a few options

@Aylur
Copy link
Owner

Aylur commented Sep 12, 2023

Does this snippet work for you - this is in SystemIndicators.js?

no, the batteryPercent is undefined for me

@cafetestrest
Copy link
Author

no, the batteryPercent is undefined for me

Hm, this is weird. For me it gathers battery percentage just fine for a mouse. For a keyboard it needs to be restarted (turn off and back on) a few times but it does work. Unsure what makes it tick.

Anyhow, I will create a bash script that gathers the data from the bluetoothctl and make ags service to display it in place of BluetoothDevicesIndicator and make it run every 10 seconds or so which is fine solution for me.

@Aylur
Copy link
Owner

Aylur commented Oct 4, 2023

turns out, it is an experimental feature and you have to enable it in /etc/bluetooth/main.conf by setting Experimental = true
or on NixOS hardware.bluetooth.settings.General.Experimental = true

@cafetestrest
Copy link
Author

Hi @Aylur ,

I'm unable to get it working on NixOS, even when enabled, no battery percentage shows up.

This is the content of /etc/bluetooth/main.conf (using hardware.bluetooth.settings.General.Experimental = true):

[General]
ControllerMode=dual
Experimental=true

[Policy]
AutoEnable=true

@cafetestrest
Copy link
Author

I figured it out, seems that some service provides this info, I think it is upower but could be any of these:
https://github.com/Aylur/dotfiles/blob/668f8bd87d88ae249cb6e20892f956e3d74dabe2/nixos/hyprland.nix#L53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants