master ohmu/fastfetch-openbsd / src / detection / wmtheme / wmtheme_haiku.cpp
ohmu  ·  2026-10-15
 1extern "C" {
 2#include "fastfetch.h"
 3#include "wmtheme.h"
 4}
 5
 6#include <Application.h>
 7#include <private/interface/DecorInfo.h>
 8
 9bool ffDetectWmTheme(FFstrbuf* themeOrError)
10{
11    // We need a valid be_app to query the app_server here.
12    BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
13
14    DecorInfoUtility *util = new DecorInfoUtility();
15    DecorInfo* decor = nullptr;
16
17    if (util) {
18        decor = util->CurrentDecorator();
19        if (decor) {
20            ffStrbufAppendS(themeOrError, decor->Name().String());
21        }
22        delete util;
23        if (decor) {
24            return true;
25        }
26    }
27
28    ffStrbufAppendS(themeOrError, "Failed to get DecorInfo");
29    return false;
30}