From 53116d65f10fea8a7f0c2264abb707c82608d65e Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sun, 28 Dec 2025 19:13:46 +0800 Subject: [PATCH] WM (Linux): supports niri version detection Fixes #2121 --- src/detection/wm/wm_linux.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/detection/wm/wm_linux.c b/src/detection/wm/wm_linux.c index 4697976e8..25abcc4da 100644 --- a/src/detection/wm/wm_linux.c +++ b/src/detection/wm/wm_linux.c @@ -162,6 +162,22 @@ static const char* getLabwc(FFstrbuf* result) return "Failed to run command `labwc --version`"; } +static const char* getNiri(FFstrbuf* result) +{ + if (ffProcessAppendStdOut(result, (char* const[]){ + "niri", + "--version", + NULL + }) == NULL) + { // niri 25.11 (b35bcae) + ffStrbufSubstrBeforeLastC(result, ' '); + ffStrbufSubstrAfterFirstC(result, ' '); + return NULL; + } + + return "Failed to run command `niri --version`"; +} + #ifdef __linux__ static const char* getWslg(FFstrbuf* result) { @@ -299,6 +315,9 @@ const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE if (ffStrbufEqualS(wmName, "labwc")) return getLabwc(result); + if (ffStrbufEqualS(wmName, "niri")) + return getNiri(result); + #if __linux__ if (ffStrbufEqualS(wmName, "WSLg")) return getWslg(result);