From ee7240469583e9ab5124ba6c3df12c91050f177e Mon Sep 17 00:00:00 2001 From: Swagtoy Date: Wed, 27 May 2026 17:57:33 -0400 Subject: [PATCH] shell: elogind support to avoid stubbed sd_notify sd_notify is supported by elogind (with such an unfortunate name) and openrc's supervise-daemon is able to get at READY=1. Unfortunately, it is stubbed, so let's start using it if -Dsystemd=off and elogind is found. Signed-off-by: Swagtoy --- config.h.meson | 3 +++ meson.build | 6 +++++- src/shell-util.c | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config.h.meson b/config.h.meson index a357e1c1f..2c4923617 100644 --- a/config.h.meson +++ b/config.h.meson @@ -28,6 +28,9 @@ /* Define if we have systemd */ #mesondefine HAVE_SYSTEMD +/* Define if we have elogind */ +#mesondefine HAVE_ELOGIND + /* Define if _NL_TIME_FIRST_WEEKDATE is available */ #mesondefine HAVE__NL_TIME_FIRST_WEEKDAY diff --git a/meson.build b/meson.build index 14ba11953..05d0bc910 100644 --- a/meson.build +++ b/meson.build @@ -129,9 +129,12 @@ if get_option('systemd') systemd_dep = dependency('systemd', version: systemd_req) systemduserunitdir = systemd_dep.get_variable('systemduserunitdir', pkgconfig_define: ['prefix', prefix]) + have_elogind = false have_systemd = true else - libsystemd_dep = [] + # elogind isn't required either, but reap the benefits if it does exists + libsystemd_dep = dependency('libelogind', required: false) + have_elogind = libsystemd_dep.found() have_systemd = false endif @@ -154,6 +157,7 @@ cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name()) cdata.set_quoted('VERSION', meson.project_version()) cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) +cdata.set('HAVE_ELOGIND', have_elogind) cdata.set('HAVE_NETWORKMANAGER', have_networkmanager) cdata.set('HAVE_PIPEWIRE', have_pipewire) cdata.set('HAVE_SYSTEMD', have_systemd) diff --git a/src/shell-util.c b/src/shell-util.c index 21fe7a7f4..ecc3c169c 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -35,11 +35,13 @@ #ifdef HAVE_SYSTEMD #include #include +#elif defined(HAVE_ELOGIND) +#include #else /* So we don't need to add ifdef's everywhere */ #define sd_notify(u, m) do {} while (0) #define sd_notifyf(u, m, ...) do {} while (0) -#endif +#endif /* HAVE_SYSTEMD */ static void stop_pick (ClutterActor *actor) -- 2.53.0