From 09ccbca79c496be410a0d6246a0ec8896d430ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 24 Feb 2023 17:48:09 +0800 Subject: [PATCH] WmTheme (Apple): don't depend on displayserver detection --- src/detection/wmtheme/wmtheme_apple.m | 23 +---------------------- src/detection/wmtheme/wmtheme_nosupport.c | 1 - 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/detection/wmtheme/wmtheme_apple.m b/src/detection/wmtheme/wmtheme_apple.m index 437d6ed97..817a2cd65 100644 --- a/src/detection/wmtheme/wmtheme_apple.m +++ b/src/detection/wmtheme/wmtheme_apple.m @@ -1,13 +1,10 @@ #include "fastfetch.h" -#include "detection/displayserver/displayserver.h" #include "wmtheme.h" #import -static bool detectQuartzCompositor(FFinstance* instance, FFstrbuf* themeOrError) +bool ffDetectWmTheme(FF_MAYBE_UNUSED FFinstance* instance, FFstrbuf* themeOrError) { - FF_UNUSED(instance); - NSError* error; NSString* fileName = [NSString stringWithFormat:@"file://%s/Library/Preferences/.GlobalPreferences.plist", instance->state.platform.homeDir.chars]; NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:[NSURL URLWithString:fileName] @@ -41,21 +38,3 @@ static bool detectQuartzCompositor(FFinstance* instance, FFstrbuf* themeOrError) ffStrbufAppendF(themeOrError, " (%s)", wmTheme ? wmTheme.UTF8String : "Light"); return true; } - -bool ffDetectWmTheme(FFinstance* instance, FFstrbuf* themeOrError) -{ - const FFDisplayServerResult* wm = ffConnectDisplayServer(instance); - - if(wm->wmPrettyName.length == 0) - { - ffStrbufAppendS(themeOrError, "WM Theme needs sucessfull WM detection"); - return false; - } - - if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Quartz Compositor") == 0) - return detectQuartzCompositor(instance, themeOrError); - - ffStrbufAppendS(themeOrError, "Unknown WM: "); - ffStrbufAppend(themeOrError, &wm->dePrettyName); - return false; -} diff --git a/src/detection/wmtheme/wmtheme_nosupport.c b/src/detection/wmtheme/wmtheme_nosupport.c index 5dc5691d3..1f1dca61c 100644 --- a/src/detection/wmtheme/wmtheme_nosupport.c +++ b/src/detection/wmtheme/wmtheme_nosupport.c @@ -1,5 +1,4 @@ #include "fastfetch.h" -#include "detection/displayserver/displayserver.h" #include "wmtheme.h" bool ffDetectWmTheme(FFinstance* instance, FFstrbuf* themeOrError)