Fix battery indicator
authorStiletto <blasux@blasux.ru>
Sat, 17 Aug 2019 15:23:15 +0400
changeset 16 e08bdbec1843
parent 15 163e96e2b941
child 17 5b6294779007
Fix battery indicator
status-bat/bat.c
status-bat/config.def.h
--- a/status-bat/bat.c	Mon Oct 17 14:23:58 2016 +0400
+++ b/status-bat/bat.c	Sat Aug 17 15:23:15 2019 +0400
@@ -135,24 +135,25 @@
         char *status = catfile(filename);
 
         int remtime = 0;
-        char *arrow;
+        char *arrow = "—";
 
-        remtimes_color = color_none;
+        arrow_color = color_none;
+        remtimes_color = color_green;
+
         if (!strcmp(status,"Charging")) {
-            if (current_now != 0)
+            if (current_now != 0) {
                 remtime = (charge_full-charge_now) / (current_now/60);
-            arrow = "↑";
-            arrow_color = color_orange;
+                arrow = "↑";
+                arrow_color = color_orange;
+            }
         }
         else if (!strcmp(status,"Discharging")) {
-            if (current_now != 0)
+            if (current_now != 0) {
                 remtime = charge_now / (current_now/60);
-            arrow = down_arrow;
-            arrow_color = color_none;
-            remtimes_color = color(20,120,0,remtime);
-        } else {
-            arrow = "—";
-            arrow_color = color_green;
+                arrow = down_arrow;
+                arrow_color = color_none;
+                remtimes_color = color(20,120,0,remtime);
+            }
         }
         free(status);
 
--- a/status-bat/config.def.h	Mon Oct 17 14:23:58 2016 +0400
+++ b/status-bat/config.def.h	Sat Aug 17 15:23:15 2019 +0400
@@ -3,4 +3,5 @@
 /* Uncomment this if you want status-bat to drain the fuck out of your already 
    dying battery by flashing remaining time indicator */
 //#define DRAIN_THE_FUCK
+
 //#define PANGO_MARKUP // use second argument instead