For the %percentage display of batteries, drop the leading '0' for values < 10.

This commit is contained in:
jasper 2014-03-09 20:03:43 +00:00
parent f5f0d95820
commit fce3013ec9
2 changed files with 17 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.31 2014/01/30 13:19:40 jasper Exp $
# $OpenBSD: Makefile,v 1.32 2014/03/09 20:03:43 jasper Exp $
ONLY_FOR_ARCHS= ${APM_ARCHS}
COMMENT= generate a statusbar for use with i3/xmobar/dzen2
DISTNAME= i3status-2.8
REVISION= 0
CATEGORIES= x11 sysutils
HOMEPAGE= http://i3wm.org/i3status/

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-src_print_battery_info_c,v 1.10 2014/03/09 20:03:43 jasper Exp $
For the %percentage display of batteries, drop the leading '0' for values < 10.
--- src/print_battery_info.c.orig Sun Jan 5 12:34:07 2014
+++ src/print_battery_info.c Sat Feb 15 14:41:43 2014
@@ -284,7 +284,7 @@ void print_battery_info(yajl_gen json_gen, char *buffe
}
(void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status));
- (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%", apm_info.battery_life);
+ (void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00d%%", apm_info.battery_life);
if (status == CS_DISCHARGING && low_threshold > 0) {
if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0