Commit graph

27 commits

Author SHA1 Message Date
o9000
33645f9b5a Battery: refactoring 2015-11-23 16:12:42 +01:00
o9000
4a6937826c Cleanup indentation with clang-format and changed a few variable names 2015-11-20 23:28:37 +01:00
o9000
b52f193804 Fix lost settings on battery plug/unplug 2015-10-18 17:28:58 +02:00
Sebastian Reichel
0d0b1249c7 Battery: Handle Linux kernel events
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).
2015-08-08 06:31:01 +02:00
Sebastian Reichel
db490247e0 Battery: support for ac connection event cmd
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.
2015-08-07 05:22:09 +02:00
Sebastian Reichel
3c45cf29c7 Battery: Split operating system specific code
This removes all operating system specific code from the main
battery file into their own source files. CMake will add the
correct implementation automatically.
2015-08-07 05:08:44 +02:00
Sebastian Reichel
d1c22762c4 battery: move percentage calculation to linux code
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.
2015-08-07 04:35:24 +02:00
Sebastian Reichel
edad9bb7f5 Fix memory leak for battery tooltips
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().
2015-08-07 02:09:53 +02:00
Sebastian Reichel
9df55d5ef7 Update copyright info in battery files 2015-08-06 22:01:02 +02:00
Sebastian Reichel
ffd659208a Add battery tooltip support
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.
2015-08-06 22:01:02 +02:00
Sebastian Reichel
ae375ae526 Split out Linux battery implementation and support multiple batteries
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.
2015-08-05 02:07:31 +02:00
berkley4
fd78e6d886 Allow clicking and mousewheeling on the battery panel
This commit is the same as vimishor's original [*] except that I have
added middle-click and up/down mousewheel actions. In order to fix a
ftbs I also added guards to panel.c, panel.h & tint.c

The following configuration settings have been created :-

battery_lclick_command
battery_mclick_command
battery_rclick_command
battery_uwheel_command
battery_dwheel_command

[*] c78732c46a
2015-07-13 04:57:16 +01:00
o9000
1a41159142 Battery: cleanup code and make detection more resilient
git-svn-id: http://tint2.googlecode.com/svn/trunk@739 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2015-03-28 18:08:44 +00:00
thilor77
aabe6b11b9 add comment
git-svn-id: http://tint2.googlecode.com/svn/trunk@545 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2010-09-16 23:24:25 +00:00
thilor77
7ee42e8ca1 SIGUSR1 does now a full restat of tint2
git-svn-id: http://tint2.googlecode.com/svn/trunk@424 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2010-04-18 14:28:45 +00:00
thilor77
c298a39d00 moved initial values in function default_xxx
git-svn-id: http://tint2.googlecode.com/svn/trunk@423 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2010-04-18 12:07:36 +00:00
thilor77
3adb7e2080 cleanup default value on SIGUSR1
git-svn-id: http://tint2.googlecode.com/svn/trunk@421 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2010-04-16 18:50:03 +00:00
thilor77
a5a39b0bb2 lower battery drawing : update to 10s and battery_hide config
git-svn-id: http://tint2.googlecode.com/svn/trunk@364 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2010-01-19 19:29:28 +00:00
Andreas.Fink85
739af13714 *add* more task states (normal, active, iconified, urgent), with each an own background, font and asb
*fix* two memleaks
*fix* some code beautification



git-svn-id: http://tint2.googlecode.com/svn/trunk@327 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2010-01-09 00:11:01 +00:00
lorthiois@bbsoft.fr
c763cf7172 fixed config reload SIGUSR1. added systray = 1 parameter to enable systray
git-svn-id: http://tint2.googlecode.com/svn/trunk@242 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-10-30 17:18:44 +00:00
lorthiois@bbsoft.fr
51b9ce356a fixed battery drawing
git-svn-id: http://tint2.googlecode.com/svn/trunk@241 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-10-28 23:01:32 +00:00
lorthiois@bbsoft.fr
d0799e91dd patch for FULL battery by peter.ebden
git-svn-id: http://tint2.googlecode.com/svn/trunk@240 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-10-28 10:58:12 +00:00
lorthiois@bbsoft.fr
cd5b2b26a9 issue 158 : dissociate object initialization from panel initialization
git-svn-id: http://tint2.googlecode.com/svn/trunk@220 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-10-18 17:54:09 +00:00
lorthiois@bbsoft.fr
a3177fadd9 fixed indentation inconsistency by dmitry
git-svn-id: http://tint2.googlecode.com/svn/trunk@193 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-09-20 20:48:00 +00:00
lorthiois@bbsoft.fr
ce50e9c159 patch by Christian Ruppert, configure option for battery
git-svn-id: http://tint2.googlecode.com/svn/trunk@115 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-06-18 20:26:40 +00:00
lorthiois@bbsoft.fr
e43bf23b67 fixed battery detection
git-svn-id: http://tint2.googlecode.com/svn/trunk@79 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-05-31 12:40:40 +00:00
lorthiois@bbsoft.fr
01b6e81b8c added battery code
git-svn-id: http://tint2.googlecode.com/svn/trunk@74 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
2009-05-15 20:48:55 +00:00