From dffe1e1a5ab39682ce4b279144ad1d1e774f00d7 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Mon, 30 Apr 2018 11:57:25 +0300 Subject: [PATCH] Fix dunst losing on-top status on WM restart Subscribe to receive window creation events on the root window and raise the window when that happens to ensure dunst is on top. We do not raise the window when another override redirect window is created to avoid being on top of things like screen lockers. Fixes #160 --- src/x11/x.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/x11/x.c b/src/x11/x.c index de6dc38..010a779 100644 --- a/src/x11/x.c +++ b/src/x11/x.c @@ -225,6 +225,11 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer case FocusOut: wake_up(); break; + case CreateNotify: + if (xctx.win.visible && + ev.xcreatewindow.override_redirect == 0) + XRaiseWindow(xctx.dpy, xctx.win.xwin); + break; case PropertyNotify: fullscreen_now = have_fullscreen_window(); scr = get_active_screen(); @@ -485,10 +490,12 @@ static void x_win_setup(void) (unsigned long)((100 - settings.transparency) * (0xffffffff / 100))); + + long root_event_mask = SubstructureNotifyMask; if (settings.f_mode != FOLLOW_NONE) { - long root_event_mask = FocusChangeMask | PropertyChangeMask; - XSelectInput(xctx.dpy, root, root_event_mask); + root_event_mask |= FocusChangeMask | PropertyChangeMask; } + XSelectInput(xctx.dpy, root, root_event_mask); } /*