summaryrefslogtreecommitdiffstats
path: root/src/detection/wmtheme/wmtheme_haiku.cpp
blob: 243eaa43e426ff9a2ffc70d33443d001832a2d45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
extern "C" {
#include "fastfetch.h"
#include "wmtheme.h"
}

#include <Application.h>
#include <private/interface/DecorInfo.h>

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;
}