From 576548b15e279b6c2e18f59e363a043da0bd79e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 30 May 2026 22:15:32 +0200 Subject: [PATCH] WMTheme (Haiku): implement --- CMakeLists.txt | 2 +- src/detection/wmtheme/wmtheme_haiku.cpp | 30 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/detection/wmtheme/wmtheme_haiku.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d882d1de..a0acece85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1257,7 +1257,7 @@ elseif(Haiku) src/detection/wifi/wifi_nosupport.c src/detection/wm/wm_nosupport.c src/detection/de/de_nosupport.c - src/detection/wmtheme/wmtheme_nosupport.c + src/detection/wmtheme/wmtheme_haiku.cpp src/detection/camera/camera_nosupport.c ) elseif(GNU) diff --git a/src/detection/wmtheme/wmtheme_haiku.cpp b/src/detection/wmtheme/wmtheme_haiku.cpp new file mode 100644 index 000000000..243eaa43e --- /dev/null +++ b/src/detection/wmtheme/wmtheme_haiku.cpp @@ -0,0 +1,30 @@ +extern "C" { +#include "fastfetch.h" +#include "wmtheme.h" +} + +#include +#include + +bool ffDetectWmTheme(FFstrbuf* themeOrError) +{ + // We need a valid be_app to query the app_server here. + BApplication app("application/x-vnd.fastfetch-cli-fastfetch"); + + DecorInfoUtility *util = new DecorInfoUtility(); + DecorInfo* decor = NULL; + + if (util) { + decor = util->CurrentDecorator(); + if (decor) { + ffStrbufAppendS(themeOrError, decor->Name().String()); + } + delete util; + if (decor) { + return true; + } + } + + ffStrbufAppendS(themeOrError, "Failed to get DecorInfo"); + return false; +}