Commit c53116a8ee912bc6dff8706f515841c72bf1022c
1 parent
fe335ad2
Exists in
master
fix charging icon on freebsd
Showing
1 changed file
with
8 additions
and
8 deletions
Show diff stats
battery.c
... | ... | @@ -78,23 +78,23 @@ int main() { |
78 | 78 | battery_state(&nbats, life, state); |
79 | 79 | for (int i = 0; i < nbats; i++) { |
80 | 80 | |
81 | - if (life[i] >= 50) | |
82 | - color = "colour028"; /* green */ | |
83 | - else if (life[i] >= 25) | |
84 | - color = "colour172"; /* yellow */ | |
85 | - else | |
86 | - color = "colour088"; /* red */ | |
87 | - | |
88 | 81 | switch (state[i]) { |
89 | 82 | case CHARGED: /* fully charged */ |
90 | 83 | printf("%s %d%% ", icon[life[i] / 10], life[i]); |
91 | 84 | break; |
92 | 85 | case DISCHARGING: /* discharging */ |
86 | + if (life[i] >= 50) | |
87 | + color = "colour028"; /* green */ | |
88 | + else if (life[i] >= 25) | |
89 | + color = "colour172"; /* yellow */ | |
90 | + else | |
91 | + color = "colour088"; /* red */ | |
92 | + | |
93 | 93 | printf("#[fg=%s]%s#[fg=default] %d%% ", color, icon[life[i] / 10], |
94 | 94 | life[i]); |
95 | 95 | break; |
96 | 96 | case CHARGING: /* charging */ |
97 | - printf("#[fg=yellow]\uf583#[fg=default] %d%%\n ", life[i]); | |
97 | + printf("#[fg=yellow]\uf583#[fg=default] %d%% ", life[i]); | |
98 | 98 | break; |
99 | 99 | case DISCONNECTED: /* disconnected */ |
100 | 100 | printf("\uf492 "); | ... | ... |