summaryrefslogtreecommitdiffstats
path: root/src/detection/icons/icons_linux.c
blob: 0ecaa070468df46500461137e067d84f3912c8cb (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
#include "icons.h"
#include "common/parsing.h"
#include "detection/gtk_qt/gtk_qt.h"
#include "detection/displayserver/displayserver.h"

const char* ffDetectIcons(FFIconsResult* result) {
    const FFDisplayServerResult* wmde = ffConnectDisplayServer();

    if (ffStrbufIgnCaseEqualS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY)) {
        return "Icons aren't supported in TTY";
    }

    const FFstrbuf* plasma = &ffDetectQt()->icons;
    const FFstrbuf* gtk2 = &ffDetectGTK2()->icons;
    const FFstrbuf* gtk3 = &ffDetectGTK3()->icons;
    const FFstrbuf* gtk4 = &ffDetectGTK4()->icons;

    if (plasma->length == 0 && gtk2->length == 0 && gtk3->length == 0 && gtk4->length == 0) {
        return "No icons could be found";
    }

    ffParseGTK(&result->icons2, gtk2, gtk3, gtk4);

    if (plasma->length > 0) {
        ffStrbufAppend(&result->icons1, plasma);
        ffStrbufAppendS(&result->icons1, " [Qt]");
    }

    return NULL;
}