summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2020-11-12 09:29:22 -0700
committerAaron Ball <nullspoon@oper.io>2020-11-12 09:29:22 -0700
commitb6dffdf3fa31028bb7f4097e62411ba679a7545a (patch)
tree856185bb4aedf5ff6cac3c46effa98107bf599f2
parenteb5988f3084d22aaeae29a7db21d90221b879c8f (diff)
downloadi3cstat-b6dffdf3fa31028bb7f4097e62411ba679a7545a.tar.gz
i3cstat-b6dffdf3fa31028bb7f4097e62411ba679a7545a.tar.xz
Fix battery is charging label printing
This was previously printing too much whitespace. It was also doing a strlen comparison to determine where to write the label text, but it always resolved to index 0, so is not needed.
-rw-r--r--src/config_bat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/config_bat.c b/src/config_bat.c
index b25f1cc..e55ecec 100644
--- a/src/config_bat.c
+++ b/src/config_bat.c
@@ -68,13 +68,13 @@ int config_bat_load(struct node* n) {
}
if(_bat_is_charging(batstatus) == 1) {
- sprintf(n->text + strlen(n->text), "%lc", 0x26A1);
+ sprintf(n->text, "%lc", 0x26A1);
} else {
- strcat(n->text, " ");
+ strcpy(n->text, " ");
}
if(strcmp(n->display, "bar") == 0) {
- print_bar(12, (float) level / 100, &n->text[3]);
+ print_bar(12, (float) level / 100, &n->text[strlen(n->text)]);
} else {
sprintf(n->text, "%02d%%", (int)(level / 100));
}

Generated by cgit