From a71bbdd3220540b56848f10739ccb2226e2b8f97 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 8 Jul 2021 13:16:11 +0200 Subject: [PATCH] swaybar: exit cleanly when disconnected from IPC --- swaybar/bar.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/swaybar/bar.c b/swaybar/bar.c index 74c1924f..2b11065f 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -468,6 +468,13 @@ static void display_in(int fd, short mask, void *data) { static void ipc_in(int fd, short mask, void *data) { struct swaybar *bar = data; + if (mask & (POLLHUP | POLLERR)) { + if (mask & POLLERR) { + sway_log(SWAY_ERROR, "IPC poll error"); + } + bar->running = false; + return; + } if (handle_ipc_readable(bar)) { set_bar_dirty(bar); }