2021-02-18 22:25:36 +01:00
#pragma once
2022-06-18 14:25:31 +02:00
#include "fastfetch_config.h"
2021-02-18 22:25:36 +01:00
#include <stdint.h>
#include <stdbool.h>
2023-08-14 20:00:04 +08:00
2023-08-19 11:10:14 +08:00
#ifdef FF_USE_SYSTEM_YYJSON
#include <yyjson.h>
#else
#include "3rdparty/yyjson/yyjson.h"
#endif
2022-06-18 14:25:31 +02:00
2023-09-26 20:09:41 +08:00
#ifdef _MSC_VER
#define __attribute__(x)
#endif
2021-03-19 20:57:07 +01:00
#include "util/FFstrbuf.h"
2021-04-24 13:05:43 +02:00
#include "util/FFlist.h"
2023-01-15 15:57:26 +01:00
#include "util/platform/FFPlatform.h"
2023-07-25 16:01:38 +08:00
#include "util/unused.h"
2021-04-09 14:07:05 +02:00
2023-10-25 10:44:34 +08:00
#include "options/logo.h"
2023-10-26 10:26:15 +08:00
#include "options/display.h"
2023-10-25 13:39:13 +08:00
#include "options/general.h"
2021-11-09 15:14:25 +01:00
2024-10-18 21:07:50 +08:00
#ifdef __has_builtin
2025-04-30 14:47:37 +08:00
#if __has_builtin(__is_array)
#define ARRAY_SIZE(x) ({ static_assert(__is_array(__typeof__(x)), "Must be an array"); (uint32_t) (sizeof(x) / sizeof(*(x))); })
#elif __has_builtin(__builtin_types_compatible_p)
2024-10-25 14:48:11 +08:00
#define ARRAY_SIZE(x) ({ static_assert(!__builtin_types_compatible_p(__typeof__(x), __typeof__(&*(x))), "Must not be a pointer"); (uint32_t) (sizeof(x) / sizeof(*(x))); })
2024-10-18 21:07:50 +08:00
#endif
#endif
#ifndef ARRAY_SIZE
2024-10-25 14:48:11 +08:00
#define ARRAY_SIZE(x) ((uint32_t) (sizeof(x) / sizeof(*(x))))
2024-10-18 16:15:48 +08:00
#endif
2021-02-27 18:30:05 +01:00
typedef struct FFconfig
2021-02-18 22:25:36 +01:00
{
2023-10-25 14:43:46 +08:00
FFOptionsLogo logo ;
2023-10-26 10:26:15 +08:00
FFOptionsDisplay display ;
2023-10-25 14:37:48 +08:00
FFOptionsGeneral general ;
2021-02-27 18:30:05 +01:00
} FFconfig ;
2021-02-19 16:23:41 +01:00
2021-06-20 21:04:55 +02:00
typedef struct FFstate
{
2022-04-06 14:02:05 +02:00
uint32_t logoWidth ;
2022-04-02 14:35:43 +02:00
uint32_t logoHeight ;
uint32_t keysHeight ;
2024-06-04 14:23:30 +08:00
bool terminalLightTheme ;
2025-08-14 13:30:02 +08:00
bool titleFqdn ;
2021-06-20 21:04:55 +02:00
2023-01-15 15:57:26 +01:00
FFPlatform platform ;
2023-06-10 21:34:41 +08:00
yyjson_doc * configDoc ;
2023-08-29 11:13:55 +08:00
yyjson_mut_doc * resultDoc ;
2023-11-10 15:47:09 +08:00
FFstrbuf genConfigPath ;
2025-08-11 14:49:22 +08:00
bool fullConfig ;
2021-06-20 21:04:55 +02:00
} FFstate ;
typedef struct FFinstance
{
FFconfig config ;
FFstate state ;
} FFinstance ;
2023-06-24 10:59:53 +08:00
extern FFinstance instance ; // Defined in `common/init.c`
2023-08-20 20:51:55 +08:00
extern FFModuleBaseInfo ** ffModuleInfos [];