summaryrefslogtreecommitdiff
path: root/desktop/icewm/patches/aapm_power.patch
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/icewm/patches/aapm_power.patch')
-rw-r--r--desktop/icewm/patches/aapm_power.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/desktop/icewm/patches/aapm_power.patch b/desktop/icewm/patches/aapm_power.patch
new file mode 100644
index 0000000000..292cdf4b8f
--- /dev/null
+++ b/desktop/icewm/patches/aapm_power.patch
@@ -0,0 +1,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");