Battery format fixes
o9000 mrovi9000@gmail.com
1 files changed,
6 insertions(+),
7 deletions(-)
jump to
M
src/battery/battery.c
→
src/battery/battery.c
@@ -170,7 +170,9 @@ (battery_state.state == BATTERY_CHARGING)
? "Charging" : (battery_state.state == BATTERY_DISCHARGING) ? "Discharging" - : (battery_state.state == BATTERY_FULL) ? "Full" : "Unknown", + : (battery_state.state == BATTERY_FULL || battery_state.percentage >= 100) + ? "Full" + : "Unknown", BATTERY_BUF_SIZE); break; case 'm':@@ -186,7 +188,8 @@ snprintf(buf, sizeof(buf), "%d%%", battery_state.percentage);
strnappend(dest, buf, BATTERY_BUF_SIZE); break; case 't': - if (battery_state.state == BATTERY_FULL) { + if (battery_state.state == BATTERY_FULL || + (battery_state.state == BATTERY_UNKNOWN && battery_state.percentage >= 100)) { snprintf(buf, sizeof(buf), "Full"); strnappend(dest, buf, BATTERY_BUF_SIZE); } else {@@ -386,11 +389,7 @@
int battery_compute_desired_size(void *obj) { Battery *battery = (Battery *)obj; - return text_area_compute_desired_size(&battery->area, - buf_bat_line1, - buf_bat_line2, - bat1_font_desc, - bat2_font_desc); + return text_area_compute_desired_size(&battery->area, buf_bat_line1, buf_bat_line2, bat1_font_desc, bat2_font_desc); } gboolean resize_battery(void *obj)