From 71cd713226d8dada36a7dd4abfa3027d526328b4 Mon Sep 17 00:00:00 2001 From: sewn Date: Fri, 25 Oct 2024 12:54:42 +0300 Subject: [PATCH] ignore unnecessary empty title dup --- dam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dam.c b/dam.c index 6621943..4c4a6f3 100644 --- a/dam.c +++ b/dam.c @@ -261,7 +261,7 @@ bar_draw(Bar *bar) } 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_text(bar->drw, x, 0, w, bar->height, bar->lrpad / 2, bar->title, 0); } else { @@ -546,7 +546,9 @@ seat_status_handle_focused_view(void *data, if (selbar->title) free(selbar->title); - selbar->title = strdup(title); + selbar->title = NULL; + if (title[0] != '\0') + selbar->title = strdup(title); bar_frame(selbar); }