Hotplug
Hi,
So I went on and added the hotplug stuff. It's currently used for two things:
1. reconfigure battery if a power_supply add/remove event has been received (e.g. new battery)
2. update battery if a power_supply change event has been received (e.g. sent for AC connect/disconnect)
The second one is useful to make "ac_connect_cmd" and "ac_disconnect_cmd"
react instantly. Otherwise they are only executed when the battery update
routine is scheduled again. It does not introduce any new library dependencies
and the kernel interface is considered as ABI, so there won't be any frequent changes.
I also added a little fix on top, that prevents ac_connect_cmd execution
during tint2 startup (with AC connected).
-- Sebastian
See merge request !10
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).
Avoid linking against disabled features
If rsvg or startup-notification features are disabled, the
binary should not be linked against the associated libraries.
See merge request !9
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.