Some notebooks do not provide power usage data. This code tries
to estimate the current power usage by measuring the battery level
difference in a specific time interval.
The Kernel sends notifications for AC (un)plug and some
other important power supply events, so that we can
instantly update the widget. Apart from that it sends
notifications for any added or removed power supplies,
so that the battery support can be reinitialized (useful
on systems with removable batteries).
This add two new config options "ac_connected_cmd" and
"ac_disconnected_cmd". These commands are executed when
AC (mains supply) is connected or disconnected.
This removes all operating system specific code from the main
battery file into their own source files. CMake will add the
correct implementation automatically.
Add initial support for mains/ac adapters. This adds the
state only to the tooltip, but the code has been prepared
to update AC state together with normal battery updates,
so that it's possible to forward the state to the normal
panel area or trigger something on AC (dis)connection.
Only Linux provides detailed energy statistics. The BSDs directly
provide percentage values. This change makes it easier to split
out the BSD code and reduces code overhead on BSD systems.
Instead of returning a const string, that is fed into strdup, tooltip
functions are now supposed to return allocated strings. This fixes a
memory leak in the battery tooltip.
This is used instead of simply freeing the memory in the battery
tooltip function, since it also avoids a uselesss strdup().
Multi battery support
Hi ,
I have a couple of patches for the battery widget
making it actually useful on my ThinkPad X250.
-- Sebastian
See merge request !6
This adds a new config option 'battery_tooltip' (enabled
by default), which can be used to enable a tooltip for
the battery widget providing details for all installed
batteries.