valr / cbatticon

A lightweight and fast battery icon that sits in your system tray
GNU General Public License v2.0
170 stars 40 forks source link

Add support for batteries w/ only percentage capacity #58

Closed mxsasha closed 2 years ago

mxsasha commented 4 years ago

My Pinebook Pro battery does not have energy_now or charge_now available in /sys - it only has capacity which is a percentage. Current cbatticon therefore can't detect my battery charge.

This patch checks for capacity of energy_now/charge_now fail, then uses that to recalculate the actual charge based on the full charge (which is available on my machine).

There may be a much prettier way to do this, but it's a start and it works.