WmTheme (Apple): don't depend on displayserver detection

This commit is contained in:
李通洲
2023-02-24 17:48:09 +08:00
parent 4f28ae62a7
commit 09ccbca79c
2 changed files with 1 additions and 23 deletions
+1 -22
View File
@@ -1,13 +1,10 @@
#include "fastfetch.h"
#include "detection/displayserver/displayserver.h"
#include "wmtheme.h"
#import <Foundation/Foundation.h>
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;
}
@@ -1,5 +1,4 @@
#include "fastfetch.h"
#include "detection/displayserver/displayserver.h"
#include "wmtheme.h"
bool ffDetectWmTheme(FFinstance* instance, FFstrbuf* themeOrError)