]> Dogcows Code - chaz/tint2/blobdiff - src/battery/battery.c
*fix* use XFlush to really make use of the tooltip timeouts and do not rely on some...
[chaz/tint2] / src / battery / battery.c
index c88c3a5b57d8ccdc5b4d42df5cc5062aa4487ede..5c1f6cc8ee814b3f67d84a6eb0fe44bb2b4f15d2 100644 (file)
@@ -31,6 +31,7 @@
 #include "taskbar.h"
 #include "battery.h"
 #include "clock.h"
+#include "timer.h"
 
 PangoFontDescription *bat1_font_desc=0;
 PangoFontDescription *bat2_font_desc=0;
@@ -47,6 +48,14 @@ char *path_energy_full=0;
 char *path_current_now=0;
 char *path_status=0;
 
+void update_batterys()
+{
+       int i;
+       update_battery();
+       for (i=0 ; i < nb_panel ; i++)
+               panel1[i].battery.area.resize = 1;
+}
+
 
 void init_battery()
 {
@@ -120,6 +129,9 @@ void init_battery()
 
        g_free(path1);
        g_free(battery_dir);
+
+       if (battery_enabled)
+               install_timer(0, 1000000, 5, 0, update_batterys);
 }
 
 
@@ -150,7 +162,6 @@ void init_battery_panel(void *p)
 {
        Panel *panel = (Panel*)p;
        Battery *battery = &panel->battery;
-       FILE *fp;
        int bat_percentage_height, bat_percentage_height_ink, bat_time_height, bat_time_height_ink;
 
        if (!battery_enabled)
@@ -194,7 +205,7 @@ void update_battery() {
        FILE *fp;
        char tmp[25];
        int64_t energy_now = 0, energy_full = 0, current_now = 0;
-       int i, seconds = 0;
+       int seconds = 0;
        int8_t new_percentage = 0;
 
        fp = fopen(path_status, "r");
This page took 0.022132 seconds and 4 git commands to generate.