diff --git a/src/detection/wm/wm_linux.c b/src/detection/wm/wm_linux.c index a62a4af9a..35dbeb12e 100644 --- a/src/detection/wm/wm_linux.c +++ b/src/detection/wm/wm_linux.c @@ -169,6 +169,22 @@ static const char* getNiri(FFstrbuf* result) { return "Failed to run command `niri --version`"; } +static const char* getWeston(FFstrbuf* result) { + FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate(); + const char* error = ffFindExecutableInPath("weston", &path); + if (error) { + return "Failed to find weston executable path"; + } + + if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // weston 8.0.0\n... + ffStrbufSubstrBeforeFirstC(result, '\n'); + ffStrbufSubstrAfterLastC(result, ' '); + return NULL; + } + + return "Failed to run command `weston --version`"; +} + #ifdef __linux__ static const char* getWslg(FFstrbuf* result) { if (!ffAppendFileBuffer("/mnt/wslg/versions.txt", result)) { @@ -307,6 +323,10 @@ const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_A_UNU return getNiri(result); } + if (ffStrbufEqualS(wmName, "weston")) { + return getWeston(result); + } + #if __linux__ if (ffStrbufEqualS(wmName, "WSLg")) { return getWslg(result);