From f88deb928a0f7dc02f427473f8c29e8f2bed14a3 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 17 Dec 2025 19:26:10 +0000 Subject: [PATCH] compositor: warn on start via a log about start-hyprland --- src/Compositor.cpp | 3 ++- src/Compositor.hpp | 2 +- src/main.cpp | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 00e5a2d86..f4e92ee9b 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -142,8 +142,9 @@ static void aqLog(Aquamarine::eBackendLogLevel level, std::string msg) { Debug::log(aqLevelToHl(level), "[AQ] {}", msg); } -void CCompositor::setWatchdogFd(int fd) { +bool CCompositor::setWatchdogFd(int fd) { m_watchdogWriteFd = Hyprutils::OS::CFileDescriptor{fd}; + return m_watchdogWriteFd.isValid() && !m_watchdogWriteFd.isClosed(); } void CCompositor::bumpNofile() { diff --git a/src/Compositor.hpp b/src/Compositor.hpp index ca65a12d1..7671d8f0e 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -67,7 +67,7 @@ class CCompositor { void cleanup(); void bumpNofile(); void restoreNofile(); - void setWatchdogFd(int fd); + bool setWatchdogFd(int fd); bool m_readyToProcess = false; bool m_sessionActive = true; diff --git a/src/main.cpp b/src/main.cpp index ed436934e..49d44a09a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -211,10 +211,16 @@ int main(int argc, char** argv) { reapZombieChildrenAutomatically(); + bool watchdogOk = watchdogFd > 0; + if (watchdogFd > 0) - g_pCompositor->setWatchdogFd(watchdogFd); + watchdogOk = g_pCompositor->setWatchdogFd(watchdogFd); if (safeMode) g_pCompositor->m_safeMode = true; + + if (!watchdogOk) + Debug::log(WARN, "WARNING: Hyprland is being launched without start-hyprland. This is highly advised against."); + g_pCompositor->initServer(socketName, socketFd); if (verifyConfig)