commit b3b271b9f280a56f92f17aa5df14d30373ef5dc1
parent c2ee764a27a5dad363abd55a8f821fcdf0aead51
Author: sin <sin@2f30.org>
Date: Sat, 1 Nov 2014 11:24:42 +0000
Allow for bar thickness to be specified at run-time
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/xbattmon.c b/xbattmon.c
@@ -77,6 +77,9 @@ setup(void)
width = DisplayWidth(dpy, screen);
height = DisplayHeight(dpy, screen);
+ if (thickness > height)
+ thickness = height;
+
if (bottom == 1) {
barx = 0;
bary = height - thickness;
@@ -209,8 +212,9 @@ again:
void
usage(void)
{
- fprintf(stderr, "usage: %s [-i interval]\n", argv0);
+ fprintf(stderr, "usage: %s [-i interval] [-t thickness]\n", argv0);
fprintf(stderr, " -i\tbattery poll interval\n");
+ fprintf(stderr, " -t\tbar thickness\n");
exit(1);
}
@@ -227,6 +231,12 @@ main(int argc, char *argv[])
if (errstr)
errx(1, "%s: %s", arg, errstr);
break;
+ case 't':
+ arg = EARGF(usage());
+ thickness = strtonum(arg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(1, "%s: %s", arg, errstr);
+ break;
default:
usage();
} ARGEND;