From 0b22427091b05db98cbf6a54b817483acd497c09 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Tue, 19 May 2026 17:20:56 +0800 Subject: [PATCH] WM (Linux): fixes swayfx version detection on NixOS --- src/detection/wm/wm_linux.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/detection/wm/wm_linux.c b/src/detection/wm/wm_linux.c index 7bf6e5c2d..da4fc68bc 100644 --- a/src/detection/wm/wm_linux.c +++ b/src/detection/wm/wm_linux.c @@ -129,11 +129,9 @@ static const char* getSway(FFstrbuf* result) { return NULL; } - if (ffProcessAppendStdOut(result, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // sway version 1.10 - ffStrbufSubstrAfterLastC(result, ' '); - ffStrbufTrimRight(result, ')'); // swayfx - ffStrbufTrimRightSpace(result); - return NULL; + FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate(); + if (ffProcessAppendStdOut(&buffer, (char* const[]) { path.chars, "--version", NULL }) == NULL) { // sway version 1.10 + return extractSwayVersion(buffer.chars, result->length, result) ? "Failed to parse sway version output" : NULL; } return "Failed to run command `sway --version`";