master ohmu/fastfetch-openbsd / src / common / settings.h
ohmu  ·  2026-10-15
 1#pragma once
 2
 3#include "fastfetch.h"
 4
 5typedef enum FFvarianttype: uint8_t {
 6    FF_VARIANT_TYPE_STRING,
 7    FF_VARIANT_TYPE_BOOL,
 8    FF_VARIANT_TYPE_INT,
 9} FFvarianttype;
10
11typedef union FFvariant {
12    const char* strValue;
13    int32_t intValue;
14    struct
15    {
16        bool boolValueSet;
17        bool boolValue;
18    };
19} FFvariant;
20
21#define FF_VARIANT_NULL ((FFvariant) { .strValue = nullptr })
22
23FFvariant ffSettingsGetDConf(const char* key, FFvarianttype type);
24FFvariant ffSettingsGetGSettings(const char* schemaName, const char* path, const char* key, FFvarianttype type);
25FFvariant ffSettingsGetGnome(const char* dconfKey, const char* gsettingsSchemaName, const char* gsettingsPath, const char* gsettingsKey, FFvarianttype type);
26FFvariant ffSettingsGetXFConf(const char* channelName, const char* propertyName, FFvarianttype type);
27typedef bool FFTestXfconfPropCallback(void* data, const char* propertyName); // Return false to break loop
28FFvariant ffSettingsGetXFConfFirstMatch(const char* channelName, const char* propertyPrefix, FFvarianttype type, void* data, FFTestXfconfPropCallback* cb);
29
30int ffSettingsGetSQLite3Int(const char* dbPath, const char* query);
31bool ffSettingsGetSQLite3String(const char* dbPath, const char* query, FFstrbuf* result);
32
33typedef struct {
34    char* theme;
35    char* icon_theme;
36    bool use_e_cursor;
37    int cursor_size;
38    char* desktop_default_background;
39    char* font;
40} ffEnlightenmentSettings;
41bool ffSettingsGetEnlightenmentProperty(ffEnlightenmentSettings* result);
42
43#ifdef __ANDROID__
44bool ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result);
45#elif defined(__FreeBSD__)
46bool ffSettingsGetFreeBSDKenv(const char* propName, FFstrbuf* result);
47#endif