From 35bd2d27c0a6bb0d4bd235b21240e5fcb4602f92 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 24 Oct 2011 20:11:32 +0100 Subject: [PATCH] i3bar: put tray icons in the save-set (prevents them from crashing when i3bar exits/crashes) --- i3bar/src/ipc.c | 1 + i3bar/src/xcb.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/i3bar/src/ipc.c b/i3bar/src/ipc.c index 009c276f..c704b4f9 100644 --- a/i3bar/src/ipc.c +++ b/i3bar/src/ipc.c @@ -165,6 +165,7 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) { /* EOF received. Since i3 will restart i3bar instances as appropriate, * we exit here. */ DLOG("EOF received, exiting...\n"); + clean_xcb(); exit(EXIT_SUCCESS); } rec += n; diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index 01caeeea..bb7e5c77 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -499,6 +499,13 @@ static void handle_client_message(xcb_client_message_event_t* event) { (char*)ev); free(event); + /* Put the client inside the save set. Upon termination (whether + * killed or normal exit does not matter) of i3bar, these clients + * will be correctly reparented to their most closest living + * ancestor. Without this, tray icons might die when i3bar + * exits/crashes. */ + xcb_change_save_set(xcb_connection, XCB_SET_MODE_INSERT, client); + if (map_it) { DLOG("Mapping dock client\n"); xcb_map_window(xcb_connection, client); -- 2.39.5