aboutsummaryrefslogtreecommitdiff
path: root/swaybar
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-07-08 13:16:11 +0200
committerSimon Ser <contact@emersion.fr>2021-07-26 16:58:28 +0200
commita71bbdd3220540b56848f10739ccb2226e2b8f97 (patch)
tree58ef4d23ff073a2fcfa164e3588ab1d841e1aabe /swaybar
parent2e03a61262746b882e82033914afae950a9fa2b2 (diff)
swaybar: exit cleanly when disconnected from IPC
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/bar.c7
1 files changed, 7 insertions, 0 deletions
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);
}