1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

extra displayoptions for battery_short and make sure full isn't handled as unknown

This commit is contained in:
Nikolas Garofil 2009-06-08 21:15:18 +02:00
parent 3361596592
commit c392152d3a
3 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2009-06-08
* $battery_short can now also display F (full), N (not present),E (empty),
U (unknown)
* Fix problem that $battery and $battery_short displayed unknown on some
systems when the battery wasn't unknown but full
2009-06-06
* Add support for membar,swapbar,cpubar,fs_bar,fs_bar_free,battery_bar,
execbar,execibar,lua_bar,entropy_bar,mpd_bar,apcupsd_loadbar and

View File

@ -433,8 +433,9 @@
<listitem>Battery status and remaining percentage capacity
of ACPI or APM battery. ACPI battery number can be given as
argument (default is BAT0). This mode display a short
status, which means that C is displayed instead of charging
and D is displayed instead of discharging.
status, which means that C is displayed instead of charging,
D for discharging, F for full, N for not present, E for empty
and U for unknown.
<para /></listitem>
</varlistentry>
<varlistentry>

View File

@ -1643,7 +1643,7 @@ void get_battery_stuff(char *buffer, unsigned int n, const char *bat, int item)
}
/* charged */
/* thanks to Lukas Zapletal <lzap@seznam.cz> */
else if (strncmp(charging_state, "Charged", 64) == 0) {
else if (strncmp(charging_state, "Charged", 64) == 0 || strncmp(charging_state, "Full", 64) == 0) {
/* Below happens with the second battery on my X40,
* when the second one is empty and the first one
* being charged. */
@ -1849,6 +1849,18 @@ void get_battery_short_status(char *buffer, unsigned int n, const char *bat)
} else if (0 == strncmp("discharging", buffer, 11)) {
buffer[0] = 'D';
memmove(buffer + 1, buffer + 11, n - 11);
} else if (0 == strncmp("charged", buffer, 7)) {
buffer[0] = 'F';
memmove(buffer + 1, buffer + 7, n - 7);
} else if (0 == strncmp("not present", buffer, 11)) {
buffer[0] = 'N';
memmove(buffer + 1, buffer + 11, n - 11);
} else if (0 == strncmp("empty", buffer, 5)) {
buffer[0] = 'E';
memmove(buffer + 1, buffer + 5, n - 5);
} else if (0 != strncmp("AC", buffer, 2)) {
buffer[0] = 'U';
memmove(buffer + 1, buffer + 11, n - 11);
}
}