diff options
author | Nicolás Reynolds <fauno@endefensadelsl.org> | 2014-06-04 04:00:35 +0000 |
---|---|---|
committer | Nicolás Reynolds <fauno@endefensadelsl.org> | 2014-06-04 04:00:35 +0000 |
commit | 8faa42b28f39ace5fc2c3ec8a054fa0a5b246eab (patch) | |
tree | e904cb1dcc6423b414bae5d134c3ea83ac01efa1 /extra/icewm/icewm-1.3.8-remain_power.patch | |
parent | 11196316291f49af2bacd1b4531e0a548729dea2 (diff) |
Wed Jun 4 03:57:00 UTC 2014
Diffstat (limited to 'extra/icewm/icewm-1.3.8-remain_power.patch')
-rw-r--r-- | extra/icewm/icewm-1.3.8-remain_power.patch | 32 |
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? |