core: remove libsystemd dependency (#5660)

* remove libsystemd dependency

as per Lennart Poettering's advice:
https://github.com/systemd/systemd/issues/32028#issuecomment-2031366922

* fix naming for systemd helper functions

* rename vars according to code style

* Nix: update meson patch

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
This commit is contained in:
Yaroslav
2024-04-20 22:50:07 +05:00
committed by GitHub
parent ea47e8c92a
commit a945346064
7 changed files with 76 additions and 31 deletions

View File

@@ -8,7 +8,7 @@
#include "debug/HyprCtl.hpp"
#include "debug/CrashReporter.hpp"
#ifdef USES_SYSTEMD
#include <systemd/sd-daemon.h> // for sd_notify
#include <helpers/SdDaemon.hpp> // for SdNotify
#endif
#include <ranges>
#include "helpers/VarList.hpp"
@@ -385,8 +385,8 @@ void CCompositor::cleanup() {
Debug::shuttingDown = true;
#ifdef USES_SYSTEMD
if (sd_booted() > 0 && !envEnabled("HYPRLAND_NO_SD_NOTIFY"))
sd_notify(0, "STOPPING=1");
if (Systemd::SdBooted() > 0 && !envEnabled("HYPRLAND_NO_SD_NOTIFY"))
Systemd::SdNotify(0, "STOPPING=1");
#endif
// unload all remaining plugins while the compositor is
@@ -615,10 +615,10 @@ void CCompositor::startCompositor() {
g_pHyprRenderer->setCursorFromName("left_ptr");
#ifdef USES_SYSTEMD
if (sd_booted() > 0) {
if (Systemd::SdBooted() > 0) {
// tell systemd that we are ready so it can start other bond, following, related units
if (!envEnabled("HYPRLAND_NO_SD_NOTIFY"))
sd_notify(0, "READY=1");
Systemd::SdNotify(0, "READY=1");
} else
Debug::log(LOG, "systemd integration is baked in but system itself is not booted à la systemd!");
#endif