diff options
author | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2015-10-04 21:01:49 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2015-10-04 21:01:49 +0200 |
commit | 974f95702efbf1ae15882777d191c7fde99bfb9b (patch) | |
tree | b17acf7436a8b9de6c6d27aa4d82f01f6b8821aa /src/print_battery_info.c | |
parent | f3125fdfded91144cb9f5b9ea3bf406598f17321 (diff) | |
parent | a13b2e7288e943359ccb37be86efb716efbe98c8 (diff) |
Merge pull request #68 from bsvh/master
Added support for lemonbar
Diffstat (limited to 'src/print_battery_info.c')
-rw-r--r-- | src/print_battery_info.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/print_battery_info.c b/src/print_battery_info.c index 0853e18..f65090a 100644 --- a/src/print_battery_info.c +++ b/src/print_battery_info.c @@ -146,9 +146,9 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char percentage_remaining = 100; } if (integer_battery_capacity) { - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00f%%", percentage_remaining); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00f%s", percentage_remaining, pct_mark); } else { - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.02f%%", percentage_remaining); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.02f%s", percentage_remaining, pct_mark); } if (present_rate > 0) { @@ -245,8 +245,8 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char (void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status)); - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%", - present_rate); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%s", + present_rate, pct_mark); if (state == 1) { int hours, minutes; @@ -304,7 +304,7 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char (void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status)); /* integer_battery_capacity is implied as battery_life is already in whole numbers. */ - (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00d%%", apm_info.battery_life); + (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00d%s", apm_info.battery_life, pct_mark); if (status == CS_DISCHARGING && low_threshold > 0) { if (strcasecmp(threshold_type, "percentage") == 0 && apm_info.battery_life < low_threshold) { @@ -494,13 +494,13 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char if (integer_battery_capacity) (void)snprintf(percentagebuf, sizeof(percentagebuf), - "%d%%", - (int)percentage_remaining); + "%d%s", + (int)percentage_remaining, pct_mark); else (void)snprintf(percentagebuf, sizeof(percentagebuf), - "%.02f%%", - percentage_remaining); + "%.02f%s", + percentage_remaining, pct_mark); /* * Handle percentage low_threshold here, and time low_threshold when |