Skip to content

Commit fc3891c

Browse files
committed
DE: implement --de-slow-version-detection
1 parent cd07354 commit fc3891c

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/detection/de/de_linux.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "common/processing.h"
66
#include "detection/displayserver/displayserver.h"
77

8-
static void getKDE(FFstrbuf* result)
8+
static void getKDE(FFstrbuf* result, FFDEOptions* options)
99
{
1010
ffParsePropFileValues("/usr/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
1111
{"X-KDE-PluginInfo-Version =", result}
@@ -25,7 +25,7 @@ static void getKDE(FFstrbuf* result)
2525
if(result->length == 0)
2626
ffParsePropFileData("wayland-sessions/plasmawayland5.desktop", "X-KDE-PluginInfo-Version =", result);
2727

28-
if(result->length == 0 && instance.config.general.allowSlowOperations)
28+
if(result->length == 0 && options->slowVersionDetection)
2929
{
3030
if (ffProcessAppendStdOut(result, (char* const[]){
3131
"plasmashell",
@@ -36,7 +36,7 @@ static void getKDE(FFstrbuf* result)
3636
}
3737
}
3838

39-
static void getGnome(FFstrbuf* result)
39+
static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
4040
{
4141
ffParsePropFileData("gnome-shell/org.gnome.Extensions", "version :", result);
4242

@@ -51,12 +51,12 @@ static void getGnome(FFstrbuf* result)
5151
}
5252
}
5353

54-
static void getCinnamon(FFstrbuf* result)
54+
static void getCinnamon(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
5555
{
5656
ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result);
5757
}
5858

59-
static void getMate(FFstrbuf* result)
59+
static void getMate(FFstrbuf* result, FFDEOptions* options)
6060
{
6161
FF_STRBUF_AUTO_DESTROY major = ffStrbufCreate();
6262
FF_STRBUF_AUTO_DESTROY minor = ffStrbufCreate();
@@ -70,7 +70,7 @@ static void getMate(FFstrbuf* result)
7070

7171
ffParseSemver(result, &major, &minor, &micro);
7272

73-
if(result->length == 0 && instance.config.general.allowSlowOperations)
73+
if(result->length == 0 && options->slowVersionDetection)
7474
{
7575
ffProcessAppendStdOut(result, (char* const[]){
7676
"mate-session",
@@ -83,7 +83,7 @@ static void getMate(FFstrbuf* result)
8383
}
8484
}
8585

86-
static void getXFCE4(FFstrbuf* result)
86+
static void getXFCE4(FFstrbuf* result, FFDEOptions* options)
8787
{
8888
ffParsePropFileData("gtk-doc/html/libxfce4ui/index.html", "<div><p class=\"releaseinfo\">Version", result);
8989

@@ -104,7 +104,7 @@ static void getXFCE4(FFstrbuf* result)
104104
}
105105
#endif
106106

107-
if(result->length == 0 && instance.config.general.allowSlowOperations)
107+
if(result->length == 0 && options->slowVersionDetection)
108108
{
109109
//This is somewhat slow
110110
ffProcessAppendStdOut(result, (char* const[]){
@@ -119,7 +119,7 @@ static void getXFCE4(FFstrbuf* result)
119119
}
120120
}
121121

122-
static void getLXQt(FFstrbuf* result)
122+
static void getLXQt(FFstrbuf* result, FFDEOptions* options)
123123
{
124124
ffParsePropFileData("gconfig/lxqt.pc", "Version:", result);
125125

@@ -128,7 +128,7 @@ static void getLXQt(FFstrbuf* result)
128128
if(result->length == 0)
129129
ffParsePropFileData("cmake/lxqt/lxqt-config-version.cmake", "set ( PACKAGE_VERSION", result);
130130

131-
if(result->length == 0 && instance.config.general.allowSlowOperations)
131+
if(result->length == 0 && options->slowVersionDetection)
132132
{
133133
//This is really, really, really slow. Thank you, LXQt developers
134134
ffProcessAppendStdOut(result, (char* const[]){
@@ -142,27 +142,27 @@ static void getLXQt(FFstrbuf* result)
142142
}
143143
}
144144

145-
static void getBudgie(FFstrbuf* result)
145+
static void getBudgie(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
146146
{
147147
ffParsePropFileData("budgie/budgie-version.xml", "<str>", result);
148148
}
149149

150-
const char* ffDetectDEVersion(const FFstrbuf* deName, FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
150+
const char* ffDetectDEVersion(const FFstrbuf* deName, FFstrbuf* result, FFDEOptions* options)
151151
{
152152
if (ffStrbufEqualS(deName, FF_DE_PRETTY_PLASMA))
153-
getKDE(result);
153+
getKDE(result, options);
154154
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME) || ffStrbufEqualS(deName, FF_DE_PRETTY_GNOME))
155-
getGnome(result);
155+
getGnome(result, options);
156156
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_CINNAMON))
157-
getCinnamon(result);
157+
getCinnamon(result, options);
158158
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_XFCE4))
159-
getXFCE4(result);
159+
getXFCE4(result, options);
160160
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_MATE))
161-
getMate(result);
161+
getMate(result, options);
162162
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_LXQT))
163-
getLXQt(result);
163+
getLXQt(result, options);
164164
else if (ffStrbufEqualS(deName, FF_DE_PRETTY_BUDGIE))
165-
getBudgie(result);
165+
getBudgie(result, options);
166166
else
167167
return "Unsupported DE";
168168
return NULL;

src/modules/de/de.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ bool ffParseDECommandOptions(FFDEOptions* options, const char* key, const char*
5151
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
5252
return true;
5353

54-
if (ffStrEqualsIgnCase(key, "slow-version-detection"))
54+
if (ffStrEqualsIgnCase(subKey, "slow-version-detection"))
5555
{
5656
options->slowVersionDetection = ffOptionParseBoolean(value);
5757
return true;

0 commit comments

Comments
 (0)