From 06f3b9a96d1fcb63bde8900f245747dc915664db Mon Sep 17 00:00:00 2001 From: Carter Li Date: Wed, 3 Jul 2024 09:09:06 +0800 Subject: [PATCH] DE (Linux): improve Cinnamon version detection Fix #1068 --- src/detection/de/de_linux.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/detection/de/de_linux.c b/src/detection/de/de_linux.c index ab6a93b7c..7b31160ed 100644 --- a/src/detection/de/de_linux.c +++ b/src/detection/de/de_linux.c @@ -74,7 +74,20 @@ static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options) static void getCinnamon(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options) { - ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result); + ffStrbufSetS(result, getenv("CINNAMON_VERSION")); + + if (result->length == 0) + ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result); + + if (!result->length == 0 && options->slowVersionDetection) + { + if (ffProcessAppendStdOut(result, (char* const[]){ + "cinnamon", + "--version", + NULL + }) == NULL) // Cinnamon 6.2.2 + ffStrbufSubstrAfterLastC(result, ' '); + } } static void getMate(FFstrbuf* result, FFDEOptions* options)