bbidulock / icewm

A window manager designed for speed, usability, and consistency
Other
570 stars 97 forks source link

Some battery does'nt have information about full charge. #746

Closed diegoroversi closed 9 months ago

diegoroversi commented 9 months ago

Some battery have no information about full charge.

This fix it's just use "capacity" which is expressed as a percentage, just in this case.

gijsbers commented 9 months ago

Why the last change that prevents acpiACName if "/capacity" exists?

Please always surround assignment symbols with a space on either side.

Fix your language errors: "percentual" -> percentage, not "does'nt".

The test for if (BATcapacity_full == -1) { is actually bogus since at that point BATcapacity_full always has the initialized value of -1.

diegoroversi commented 9 months ago

Thanks for the review.

The last change is needed for another bug. The old code assume that any power_supply that contains a online file is an AC. But it's not true, battery can have it also, so the code can select a battery as AC, if the power_supply are in the "wrong" order.

I added a check that "capacity" file is not present to be sure is really an AC.

I fixed the other issues and tested on a couple of laptop, to be sure there are no regression.

gijsbers commented 9 months ago

@diegoroversi If you like, you can review/test my commit. It reduces the amount of code spent on opening and reading files and improves readability.

Battery device documentation.

diegoroversi commented 9 months ago

@diegoroversi If you like, you can review/test my commit. It reduces the amount of code spent on opening and reading files and improves readability.

The changes look fine to me, and I see no regression after testing on two laptop.

Thanks!