summaryrefslogtreecommitdiff
path: root/desktop/icewm/patches/aapm_power.patch
blob: 292cdf4b8f97c0201dd8cace455cb1a34d20457c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- b/icewm-1.3.7/src/aapm.cc	2010-10-31 17:09:36.000000000 +0300
+++ icewm-1.3.7/src/aapm.cc	2013-06-02 14:24:04.778299294 +0400
@@ -614,6 +614,10 @@
         }
         strcat3(buf, "/sys/class/power_supply/", BATname, "/current_now", sizeof(buf));
         fd = fopen(buf, "r");
+        if (fd == NULL) {
+            strcat3(buf, "/sys/class/power_supply/", BATname, "/power_now", sizeof(buf));
+            fd = fopen(buf, "r");
+	}
         if (fd != NULL && fgets(buf, sizeof(buf), fd)) {
                 //In case it contains non-numeric value
                 if (sscanf(buf,"%d", &BATrate) <= 0) {
@@ -706,7 +710,7 @@
             //did we parse the needed values successfully?
             BATcapacity_full >= 0 && BATcapacity_remain >= 0 && BATrate > 0) {
             BATtime_remain = (int) (60 * (double)(BATcapacity_remain) / BATrate);
-            sprintf(bat_info, "%d:%02d", BATtime_remain / 60, BATtime_remain % 60);
+            sprintf(bat_info, "%d:%02d %.1fW", BATtime_remain / 60, BATtime_remain % 60, (double) BATrate / 1000000);
         }
         else if (BATpresent == BAT_PRESENT &&
                  //did we parse the needed values successfully?
@@ -1075,7 +1079,7 @@
         if ((mode == ACPI || mode == SYSFS) && acpiBatteries[i]->present == BAT_ABSENT)
             continue;
         if (taskBarShowApmTime)
-            strcat(buf, "0:00");
+            strcat(buf, "0:00 0.0W");
         else
             strcat(buf, "100%");
         strcat(buf, "C");