Misc battery updates
Hi,
So here are a couple of more patches. I did only minimal testing for the battery BSD stuff
(basically compilation under Linux and check, that only sensible errors appear). The second
patch (remove static clock tooltip buffer) is independent of the remaining changes, but
depends on the first patch.
I guess the battery code for Linux could be further improved by using libudev
to handle kernel events for added batteries and AC plug changes.
-- Sebastian
See merge request !8
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.
reset color after systray existing message
Currently all messages following the "another systray is running"
message are also printed in red. Fix this by reseting the color
at the end of the message.
See merge request !7
Currently all messages following the "another systray is running"
message are also printed in red. Fix this by reseting the color
at the end of the message.
Some notebooks, like the ThinkPad X240 and X250 have two batteries
installed. So far only one of the batteries have been checked by
the tint2 widget making it more or less useless on those systems.
After this patch tint2 will aggregate the data from all batteries
instead.
Moreclicks
The two commits in this merge request would allow the user to set up as many as eight extra custom actions via tint2rc.
I've been running these changes (minus the up/down wheel actions) for many months without any obvious issues, mainly to adjust laptop screen brightness via a couple of scripts.
I've just tested the wheel actions and they appeared to work fine. The clock commit should solve issue #505.
I have merely augmented the work of two other people, and appropriate credits/references are indicated in the individual commit messages.
See merge request !5