Skip to content

xfce4-battery-plugin: Fix battery capacity detection

Daniele Debernardi requested to merge feature/xfce4-battery-plugin-fix into master

I've noticed that on some devices the battery plugin wasn't working properly (no battery icon on the panel), so I've investigated and noticed how the percentage was calculated.

https://github.com/xfce-mirror/xfce4-battery-plugin/blob/69820c22a0a15bc953f2d02200366b2f3ecd9bda/panel-plugin/libacpi.c#L562

It basically expect to find the last_full_capacity with the total amount of mAh of the battery and energy_now or charge_now with the current amount of remaining mAh.

Since I've almost never seen those values in my devices, but most of them (if not all) have the capacity with the actual remaining percentage, I've decided to patch it to read and use that information.

I've tried to not break the actual logic, so if a device have both last_full_capacity and energy_now or charge_now it will continue use the old logic.

If someone also noticed the missing battery icon in the xfce4 panel, please test with this patched plugin and report back. Thanks

Merge request reports