Skip to content

Commit

Permalink
Daemon: do not timeout when running under wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
lukefromdc committed Aug 7, 2023
1 parent 7da955f commit 24afeb4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/daemon/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,22 @@ static gboolean do_exit(gpointer user_data)

static void add_exit_timeout(NotifyDaemon* daemon)
{
GdkDisplay *display = gdk_screen_get_display (gdk_screen_get_default());
/*Do not timeout if not running in X11
*As wayland sessions are usually controlled
*by the wayland compositor. We need to keep
*the daemon running on wayland
*/
if (!(GDK_IS_X11_DISPLAY (display)))
return;

g_assert (daemon != NULL);

if (daemon->exit_timeout_source > 0)
if (daemon->exit_timeout_source == 0)
return;

daemon->exit_timeout_source = g_timeout_add_seconds(IDLE_SECONDS, do_exit, NULL);
g_source_remove(daemon->exit_timeout_source);
daemon->exit_timeout_source = 0;
}

static void remove_exit_timeout(NotifyDaemon* daemon)
Expand Down

0 comments on commit 24afeb4

Please sign in to comment.