slackbuilds_ponce/desktop/icewm/patches/aapm_power.patch
Robby Workman d711d31700 desktop/icewm: Reverted to 1.3.7 plus some more patches
Thanks again to Janusz Kuśnierek for assistance with this
and for noting a couple of fairly major bugs wrt usability
that make the revert desirable.

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2014-04-12 13:59:48 -05:00

31 lines
1.5 KiB
Diff

--- 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");