From 093f56a03d8658ade3edf2c104f587cfc6245b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 29 Sep 2025 09:25:24 +0800 Subject: [PATCH] Theme (macOS): moves macOS theme detection logic from DE to dedicated module The old behavior was inherited from neofetch. However `Aqua` and `Liquid Glass` are actually design language, not a DE. There is no DE on macOS. --- CMakeLists.txt | 2 +- .../displayserver/displayserver_apple.c | 16 ------------- src/detection/theme/theme_apple.c | 24 +++++++++++++++++++ 3 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 src/detection/theme/theme_apple.c diff --git a/CMakeLists.txt b/CMakeLists.txt index daded92cd..baef303d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -974,7 +974,7 @@ elseif(APPLE) src/detection/terminalfont/terminalfont_apple.m src/detection/terminalshell/terminalshell_linux.c src/detection/terminalsize/terminalsize_linux.c - src/detection/theme/theme_nosupport.c + src/detection/theme/theme_apple.c src/detection/tpm/tpm_apple.c src/detection/uptime/uptime_bsd.c src/detection/users/users_linux.c diff --git a/src/detection/displayserver/displayserver_apple.c b/src/detection/displayserver/displayserver_apple.c index 4ef8d0520..7cf41204d 100644 --- a/src/detection/displayserver/displayserver_apple.c +++ b/src/detection/displayserver/displayserver_apple.c @@ -196,21 +196,5 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds) } } - const FFOSResult* os = ffDetectOS(); - - char* str_end; - const char* version = os->version.chars; - unsigned long osNum = strtoul(version, &str_end, 10); - if (str_end != version) - { - if (osNum > 15) { // Tahoe - ffStrbufSetStatic(&ds->dePrettyName, "Liquid Glass"); - } else if (osNum < 10) { - ffStrbufSetStatic(&ds->dePrettyName, "Platinum"); - } else { - ffStrbufSetStatic(&ds->dePrettyName, "Aqua"); - } - } - detectDisplays(ds); } diff --git a/src/detection/theme/theme_apple.c b/src/detection/theme/theme_apple.c new file mode 100644 index 000000000..b46d5afbf --- /dev/null +++ b/src/detection/theme/theme_apple.c @@ -0,0 +1,24 @@ +#include "theme.h" + +#include "detection/os/os.h" + +const char* ffDetectTheme(FFThemeResult* result) +{ + const FFOSResult* os = ffDetectOS(); + + char* str_end; + const char* version = os->version.chars; + unsigned long osNum = strtoul(version, &str_end, 10); + if (str_end != version) + { + if (osNum > 15) { // Tahoe + ffStrbufSetStatic(&result->theme1, "Liquid Glass"); + } else if (osNum < 10) { + ffStrbufSetStatic(&result->theme1, "Platinum"); + } else { + ffStrbufSetStatic(&result->theme1, "Aqua"); + } + } + + return NULL; +}