From 70b4582bb650b9eab3a9961447853bd4675e3487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 19 Jan 2026 10:55:30 +0800 Subject: [PATCH] DE (Linux): removes option `slowVersionDetection` It's always true now Fixes #2149 --- src/detection/de/de_linux.c | 35 ++++++++++++++++------------------- src/modules/de/de.c | 6 +----- src/modules/de/option.h | 2 -- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/detection/de/de_linux.c b/src/detection/de/de_linux.c index b4d4e4eb9..344cf5053 100644 --- a/src/detection/de/de_linux.c +++ b/src/detection/de/de_linux.c @@ -44,7 +44,7 @@ static void getKDE(FFstrbuf* result, FFDEOptions* options) if(result->length == 0) ffParsePropFileData("wayland-sessions/plasmawayland5.desktop", "X-KDE-PluginInfo-Version =", result); - if(result->length == 0 && options->slowVersionDetection) + if(result->length == 0) { if (ffProcessAppendStdOut(result, (char* const[]){ "plasmashell", @@ -73,7 +73,7 @@ static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options) { getGnomeByDbus(result); - if (result->length == 0 && options->slowVersionDetection) + if (result->length == 0) { if (ffProcessAppendStdOut(result, (char* const[]){ "gnome-shell", @@ -91,7 +91,7 @@ static void getCinnamon(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options) if (result->length == 0) ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result); - if (result->length == 0 && options->slowVersionDetection) + if (result->length == 0) { if (ffProcessAppendStdOut(result, (char* const[]){ "cinnamon", @@ -102,7 +102,7 @@ static void getCinnamon(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options) } } -static void getMate(FFstrbuf* result, FFDEOptions* options) +static void getMate(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options) { FF_STRBUF_AUTO_DESTROY major = ffStrbufCreate(); FF_STRBUF_AUTO_DESTROY minor = ffStrbufCreate(); @@ -116,7 +116,7 @@ static void getMate(FFstrbuf* result, FFDEOptions* options) ffParseSemver(result, &major, &minor, µ); - if(result->length == 0 && options->slowVersionDetection) + if(result->length == 0) { ffProcessAppendStdOut(result, (char* const[]){ "mate-session", @@ -143,11 +143,11 @@ static const char* getXfce4ByLib(FFstrbuf* result) #endif } -static void getXFCE4(FFstrbuf* result, FFDEOptions* options) +static void getXFCE4(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options) { getXfce4ByLib(result); - if(result->length == 0 && options->slowVersionDetection) + if(result->length == 0) { //This is somewhat slow ffProcessAppendStdOut(result, (char* const[]){ @@ -171,7 +171,7 @@ static void getLXQt(FFstrbuf* result, FFDEOptions* options) if(result->length == 0) ffParsePropFileData("cmake/lxqt/lxqt-config-version.cmake", "set ( PACKAGE_VERSION", result); - if(result->length == 0 && options->slowVersionDetection) + if(result->length == 0) { //This is really, really, really slow. Thank you, LXQt developers ffProcessAppendStdOut(result, (char* const[]){ @@ -218,18 +218,15 @@ static const char* getTrinity(FFstrbuf* result, FFDEOptions* options) if (ffBinaryExtractStrings(path.chars, extractTdeVersion, result, strlen("R0.0.0")) == NULL) return NULL; - if (options->slowVersionDetection) - { - ffStrbufClear(&path); - ffProcessAppendStdOut(&path, (char* const[]){ - "tde-config", - "--version", - NULL - }); + ffStrbufClear(&path); + ffProcessAppendStdOut(&path, (char* const[]){ + "tde-config", + "--version", + NULL + }); - ffParsePropLines(path.chars , "TDE: ", result); - return NULL; - } + ffParsePropLines(path.chars , "TDE: ", result); + return NULL; return "All methods failed"; } diff --git a/src/modules/de/de.c b/src/modules/de/de.c index 04f954464..758d20ef2 100644 --- a/src/modules/de/de.c +++ b/src/modules/de/de.c @@ -55,7 +55,7 @@ void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module) if (unsafe_yyjson_equals_str(key, "slowVersionDetection")) { - options->slowVersionDetection = yyjson_get_bool(val); + ffPrintError(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Key `slowVersionDetection` is deprecated, it's always true"); continue; } @@ -66,8 +66,6 @@ void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module) void ffGenerateDEJsonConfig(FFDEOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) { ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs); - - yyjson_mut_obj_add_bool(doc, module, "slowVersionDetection", options->slowVersionDetection); } bool ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) @@ -93,8 +91,6 @@ bool ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc void ffInitDEOptions(FFDEOptions* options) { ffOptionInitModuleArg(&options->moduleArgs, ""); - - options->slowVersionDetection = false; } void ffDestroyDEOptions(FFDEOptions* options) diff --git a/src/modules/de/option.h b/src/modules/de/option.h index c587a0c96..1c0188b8c 100644 --- a/src/modules/de/option.h +++ b/src/modules/de/option.h @@ -5,8 +5,6 @@ typedef struct FFDEOptions { FFModuleArgs moduleArgs; - - bool slowVersionDetection; } FFDEOptions; static_assert(sizeof(FFDEOptions) <= FF_OPTION_MAX_SIZE, "FFDEOptions size exceeds maximum allowed size");