mirror of
https://github.com/kolunmi/dwlb.git
synced 2025-12-17 03:23:18 +00:00
make status_commands variable functional
This commit is contained in:
parent
23bf1d2bb0
commit
d25242c299
6
dwlb.c
6
dwlb.c
@ -269,7 +269,6 @@ draw_text(char *text,
|
|||||||
uint32_t color_ind = 0;
|
uint32_t color_ind = 0;
|
||||||
|
|
||||||
for (char *p = text; *p; p++) {
|
for (char *p = text; *p; p++) {
|
||||||
/* Check for color changes */
|
|
||||||
if (state == UTF8_ACCEPT) {
|
if (state == UTF8_ACCEPT) {
|
||||||
if (colors && (draw_fg || draw_bg)) {
|
if (colors && (draw_fg || draw_bg)) {
|
||||||
while (color_ind < colors_l && p == colors[color_ind].start) {
|
while (color_ind < colors_l && p == colors[color_ind].start) {
|
||||||
@ -1017,6 +1016,7 @@ set_status(Bar *bar, char *text)
|
|||||||
bar->status_colors_l = 0;
|
bar->status_colors_l = 0;
|
||||||
bar->status_buttons_l = 0;
|
bar->status_buttons_l = 0;
|
||||||
|
|
||||||
|
if (status_commands) {
|
||||||
size_t str_pos = 0;
|
size_t str_pos = 0;
|
||||||
uint32_t codepoint;
|
uint32_t codepoint;
|
||||||
uint32_t state = UTF8_ACCEPT;
|
uint32_t state = UTF8_ACCEPT;
|
||||||
@ -1096,8 +1096,10 @@ set_status(Bar *bar, char *text)
|
|||||||
bar->status[str_pos++] = *p;
|
bar->status[str_pos++] = *p;
|
||||||
utf8decode(&state, &codepoint, *p);
|
utf8decode(&state, &codepoint, *p);
|
||||||
}
|
}
|
||||||
|
|
||||||
bar->status[str_pos] = '\0';
|
bar->status[str_pos] = '\0';
|
||||||
|
} else {
|
||||||
|
snprintf(bar->status, sizeof bar->status, "%s", text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user