summaryrefslogtreecommitdiff
path: root/extra/icewm/icewm-1.3.8-remain_power.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extra/icewm/icewm-1.3.8-remain_power.patch')
-rw-r--r--extra/icewm/icewm-1.3.8-remain_power.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/extra/icewm/icewm-1.3.8-remain_power.patch b/extra/icewm/icewm-1.3.8-remain_power.patch
new file mode 100644
index 000000000..bbf650e9a
--- /dev/null
+++ b/extra/icewm/icewm-1.3.8-remain_power.patch
@@ -0,0 +1,32 @@
+--- icewm-1.3.8-orig/src/aapm.cc 2013-11-17 17:54:39.000000000 +0100
++++ icewm-1.3.8/src/aapm.cc 2014-05-30 21:50:54.131868164 +0200
+@@ -614,6 +614,11 @@
+ }
+ 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) {
+@@ -697,7 +703,7 @@
+ batCount++;
+ }
+
+- if (!Tool &&
++ if (Tool &&
+ taskBarShowApmTime &&
+ BATpresent == BAT_PRESENT &&
+ //bios calculates remaining time, only while discharging
+@@ -706,7 +711,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 (%3.0f%%)", BATtime_remain / 60, BATtime_remain % 60,100 * (double)BATcapacity_remain / BATcapacity_full);
+ }
+ else if (BATpresent == BAT_PRESENT &&
+ //did we parse the needed values successfully?