diff --git a/src/dunst.c b/src/dunst.c index 5abd86e..0e98055 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -51,8 +51,12 @@ static gboolean run(void *data) static gint64 next_timeout = 0; - if (!x_win_visible(win) && queues_length_displayed() > 0) { + // Call draw before showing the window to avoid flickering + if (queues_length_displayed() > 0) { draw(); + } + + if (!x_win_visible(win) && queues_length_displayed() > 0) { x_win_show(win); } @@ -60,10 +64,6 @@ static gboolean run(void *data) x_win_hide(win); } - if (x_win_visible(win)) { - draw(); - } - if (x_win_visible(win)) { gint64 now = time_monotonic_now(); gint64 sleep = queues_get_next_datachange(now);