From c53116a8ee912bc6dff8706f515841c72bf1022c Mon Sep 17 00:00:00 2001 From: Miguel BarĂ£o Date: Tue, 30 Jan 2024 20:14:49 +0000 Subject: [PATCH] fix charging icon on freebsd --- battery.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/battery.c b/battery.c index 2732347..37595b9 100644 --- a/battery.c +++ b/battery.c @@ -78,23 +78,23 @@ int main() { battery_state(&nbats, life, state); for (int i = 0; i < nbats; i++) { - if (life[i] >= 50) - color = "colour028"; /* green */ - else if (life[i] >= 25) - color = "colour172"; /* yellow */ - else - color = "colour088"; /* red */ - switch (state[i]) { case CHARGED: /* fully charged */ printf("%s %d%% ", icon[life[i] / 10], life[i]); break; case DISCHARGING: /* discharging */ + if (life[i] >= 50) + color = "colour028"; /* green */ + else if (life[i] >= 25) + color = "colour172"; /* yellow */ + else + color = "colour088"; /* red */ + printf("#[fg=%s]%s#[fg=default] %d%% ", color, icon[life[i] / 10], life[i]); break; case CHARGING: /* charging */ - printf("#[fg=yellow]\uf583#[fg=default] %d%%\n ", life[i]); + printf("#[fg=yellow]\uf583#[fg=default] %d%% ", life[i]); break; case DISCONNECTED: /* disconnected */ printf("\uf492 "); -- libgit2 0.21.2