ignore unnecessary empty title dup

This commit is contained in:
sewn 2024-10-25 12:54:42 +03:00
parent 0c5c0dba96
commit 71cd713226
No known key found for this signature in database

4
dam.c
View file

@ -261,7 +261,7 @@ bar_draw(Bar *bar)
} }
if ((w = bar->width - tw - x) > bar->height) { if ((w = bar->width - tw - x) > bar->height) {
if (bar->title && *bar->title != '\0') { if (bar->title) {
drwl_setscheme(bar->drw, colors[bar == selbar ? SchemeSel : SchemeNorm]); drwl_setscheme(bar->drw, colors[bar == selbar ? SchemeSel : SchemeNorm]);
drwl_text(bar->drw, x, 0, w, bar->height, bar->lrpad / 2, bar->title, 0); drwl_text(bar->drw, x, 0, w, bar->height, bar->lrpad / 2, bar->title, 0);
} else { } else {
@ -546,6 +546,8 @@ seat_status_handle_focused_view(void *data,
if (selbar->title) if (selbar->title)
free(selbar->title); free(selbar->title);
selbar->title = NULL;
if (title[0] != '\0')
selbar->title = strdup(title); selbar->title = strdup(title);
bar_frame(selbar); bar_frame(selbar);
} }