From 5647703e4d286dbec6c0784ef3323ca9b84286ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jun 2026 15:42:54 +0800 Subject: [PATCH] WM (Linux): adds weston detection support --- src/detection/wm/wm_linux.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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);