WM (Linux): supports niri version detection

Fixes #2121
This commit is contained in:
Carter Li authored and 李通洲 committed 2025-12-28 23:16:45 +08:00
1 parent 01917b781b
commit 53116d65f1
1 file changed
+19
+19
View File
@@ -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);