PKGBUILDs/extra/icewm/icewm-1.3.8-remain_power.patch
2018-06-05 23:50:43 +00:00

32 lines
1.4 KiB
Diff

--- 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?