diff --git a/dwlb.c b/dwlb.c index 8359f20..e7580f1 100644 --- a/dwlb.c +++ b/dwlb.c @@ -209,8 +209,6 @@ static uint32_t height, textpadding, buffer_scale; static bool run_display; -static char *last_logged_title = NULL; - #include "config.h" static void @@ -1222,7 +1220,6 @@ read_stdin(void) if (!(bar->window_title = strdup(wordend))) EDIE("strdup"); bar->redraw = true; - last_logged_title = strdup(wordend); } else if (!strcmp(wordbeg, "selmon")) { ADVANCE(); if ((val = atoi(wordbeg)) != bar->sel) { @@ -1552,11 +1549,10 @@ read_socket(void) hide_bar(bar); } } else if (!strcmp(wordbeg, "printinfo")) { - const char *info = last_logged_title ? last_logged_title : "(none)"; - ssize_t len = strlen(info); - if (send(cli_fd, info, len, 0) != len) { + const char *info = (bar->window_title && bar->window_title[0] != '\0') ? bar->window_title : "(none)"; + if (send(cli_fd, info, strlen(info), 0) == -1) { perror("send"); - } + } } else if (!strcmp(wordbeg, "toggle-visibility")) { if (all) { wl_list_for_each(bar, &bar_list, link)