]> git.sur5r.net Git - i3/i3status/commitdiff
Display the information we have
authorMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 9 Apr 2009 17:15:18 +0000 (19:15 +0200)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 9 Apr 2009 17:15:18 +0000 (19:15 +0200)
wmiistatus.c

index cba4d8b78e1c4df7348f2eea2fa2bb85498bbdf0..e1b8097836529fb7f1d959b356c900f780490fd0 100644 (file)
@@ -307,7 +307,10 @@ static char *get_battery_info() {
                        last = walk+1;
        (void)close(fd);
 
-       if ((full_design != -1) && (remaining != -1) && (present_rate > 0)) {
+       if ((full_design != 1) && (remaining != -1))
+               return part;
+
+       if (present_rate > 0) {
                float remaining_time;
                int seconds, hours, minutes;
                if (status == CS_CHARGING)
@@ -327,6 +330,11 @@ static char *get_battery_info() {
                         (status == CS_DISCHARGING ? "BAT" : "FULL")),
                        (((float)remaining / (float)full_design) * 100),
                        hours, minutes, seconds);
+       } else {
+               (void)snprintf(part, sizeof(part), "%s %.02f%%",
+                       (status == CS_CHARGING ? "CHR" :
+                        (status == CS_DISCHARGING ? "BAT" : "FULL")),
+                       (((float)remaining / (float)full_design) * 100));
        }
        return part;
 }