For the %percentage display of batteries, drop the leading '0' for values < 10.
Patch status: merged
Patch by Jasper Lievisse Adriaanse
To apply this patch, use:
curl http://cr.i3wm.org/patch/463/raw.patch | git am
b/src/print_battery_info.c
14 |
@@ -292,7 +292,8 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char |
15 |
} |
16 |
|
17 |
(void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status)); |
18 |
- (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%", apm_info.battery_life); |
19 |
+ /* integer_battery_capacity is implied as battery_life is already in whole numbers. */ |
20 |
+ (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00d%%", apm_info.battery_life); |
21 |
|
22 |
if (status == CS_DISCHARGING && low_threshold > 0) { |
23 |
if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0 |