Files
fastfetch/src/fastfetch.h
T

215 lines
4.9 KiB
C
Raw Normal View History

2021-02-18 22:25:36 +01:00
#pragma once
#ifndef FASTFETCH_INCLUDED
#define FASTFETCH_INCLUDED
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-03-07 16:13:53 +08:00
#include "modules/options.h"
#include "options/logo.h"
2021-11-09 15:14:25 +01:00
2022-08-26 16:02:04 +02:00
typedef enum FFBinaryPrefixType
{
FF_BINARY_PREFIX_TYPE_IEC, // 1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ... (standard)
FF_BINARY_PREFIX_TYPE_SI, // 1000 Bytes = 1 KB, 1000 KB = 1 MB, ...
FF_BINARY_PREFIX_TYPE_JEDEC, // 1024 Bytes = 1 kB, 1024 K = 1 MB, ...
} FFBinaryPrefixType;
typedef enum FFTemperatureUnit
{
FF_TEMPERATURE_UNIT_CELSIUS,
FF_TEMPERATURE_UNIT_FAHRENHEIT,
FF_TEMPERATURE_UNIT_KELVIN,
} FFTemperatureUnit;
2021-02-27 18:30:05 +01:00
typedef struct FFconfig
2021-02-18 22:25:36 +01:00
{
FFLogoOptions logo;
2021-06-13 14:23:35 +02:00
2022-09-07 19:50:10 +02:00
//If one of those is empty, ffLogoPrint will set them
FFstrbuf colorKeys;
FFstrbuf colorTitle;
2023-08-04 16:05:25 +08:00
bool brightColor;
FFstrbuf keyValueSeparator;
2022-04-02 14:35:43 +02:00
2021-02-19 16:23:41 +01:00
bool showErrors;
2021-05-09 21:41:17 +02:00
bool allowSlowOperations;
2021-06-17 13:49:25 +02:00
bool disableLinewrap;
bool hideCursor;
2022-06-02 23:06:49 +02:00
bool escapeBedrock;
2022-08-26 16:02:04 +02:00
FFBinaryPrefixType binaryPrefixType;
uint8_t sizeNdigits;
uint8_t sizeMaxPrefix;
FFTemperatureUnit temperatureUnit;
FFstrbuf barCharElapsed;
FFstrbuf barCharTotal;
2023-08-16 16:46:21 +08:00
uint8_t barWidth;
bool barBorder;
2023-08-24 09:35:17 +08:00
uint8_t percentType;
uint8_t percentNdigits;
2022-06-06 14:02:21 +02:00
bool pipe; //disables logo and all escape sequences
2022-07-25 15:01:11 +02:00
bool multithreading;
2022-12-14 11:30:50 +08:00
bool stat;
2023-06-13 11:08:49 +08:00
bool noBuffer;
2023-07-10 22:12:07 +08:00
int32_t processingTimeout;
2023-08-15 17:10:09 +08:00
uint32_t keyWidth;
2021-03-03 21:03:12 +01:00
2023-06-12 15:42:26 +08:00
// Module options that cannot be put in module option structure
2023-06-12 15:22:46 +08:00
#if defined(__linux__) || defined(__FreeBSD__)
FFstrbuf playerName;
2023-06-12 15:42:26 +08:00
FFstrbuf osFile;
2023-07-31 23:11:39 +08:00
bool dsForceDrm;
2023-06-25 14:33:13 +08:00
#elif defined(_WIN32)
int32_t wmiTimeout;
2023-06-12 15:22:46 +08:00
#endif
FFBatteryOptions battery;
2023-03-10 14:48:09 +08:00
FFBiosOptions bios;
FFBluetoothOptions bluetooth;
2023-03-13 18:54:57 +08:00
FFBoardOptions board;
FFBreakOptions break_;
2023-03-14 15:29:47 +08:00
FFBrightnessOptions brightness;
FFCPUOptions cpu;
FFCPUUsageOptions cpuUsage;
2023-06-09 10:08:04 +08:00
FFChassisOptions chassis;
FFColorsOptions colors;
2023-03-07 19:27:49 +08:00
FFCommandOptions command;
2023-03-20 14:57:46 +08:00
FFCursorOptions cursor;
2023-03-20 15:46:00 +08:00
FFCustomOptions custom;
FFDEOptions de;
FFDateTimeOptions dateTime;
2023-04-02 00:13:11 +08:00
FFDiskOptions disk;
2023-10-08 16:30:09 +08:00
FFDiskIOOptions diskIo;
FFDisplayOptions display;
FFFontOptions font;
FFGPUOptions gpu;
FFGamepadOptions gamepad;
FFHostOptions host;
FFIconsOptions icons;
FFKernelOptions kernel;
2023-06-20 23:01:18 +08:00
FFLMOptions lm;
2023-04-04 20:46:50 +08:00
FFLocalIpOptions localIP;
FFLocaleOptions locale;
2023-06-07 16:10:14 +08:00
FFMediaOptions media;
FFMemoryOptions memory;
2023-08-17 10:56:54 +08:00
FFMonitorOptions monitor;
2023-09-27 00:05:37 +08:00
FFNetIOOptions netIo;
FFOSOptions os;
2023-06-07 15:10:44 +08:00
FFOpenCLOptions openCL;
FFOpenGLOptions openGL;
FFPackagesOptions packages;
FFPlayerOptions player;
FFPowerAdapterOptions powerAdapter;
FFProcessesOptions processes;
FFPublicIpOptions publicIP;
2023-03-09 17:00:37 +08:00
FFSeparatorOptions separator;
FFShellOptions shell;
2023-04-12 14:05:09 +08:00
FFSoundOptions sound;
FFSwapOptions swap;
FFTerminalFontOptions terminalFont;
FFTerminalOptions terminal;
FFTerminalSizeOptions terminalSize;
FFThemeOptions theme;
FFTitleOptions title;
FFUptimeOptions uptime;
FFUsersOptions users;
2023-08-21 09:19:16 +08:00
FFVersionOptions version;
FFVulkanOptions vulkan;
FFWMOptions wm;
FFWMThemeOptions wmTheme;
FFWallpaperOptions wallpaper;
FFWeatherOptions weather;
FFWifiOptions wifi;
2021-03-27 18:14:19 +01:00
2021-03-19 20:57:07 +01:00
FFstrbuf libPCI;
2021-11-13 18:25:35 +01:00
FFstrbuf libVulkan;
2021-04-16 16:49:33 +02:00
FFstrbuf libWayland;
2022-01-05 14:40:57 +01:00
FFstrbuf libXcbRandr;
FFstrbuf libXcb;
FFstrbuf libXrandr;
FFstrbuf libX11;
2021-05-02 18:52:42 +02:00
FFstrbuf libGIO;
2021-04-05 23:42:07 +02:00
FFstrbuf libDConf;
2022-02-13 23:51:13 +01:00
FFstrbuf libDBus;
2021-05-11 20:06:17 +02:00
FFstrbuf libXFConf;
2022-05-23 19:30:02 +02:00
FFstrbuf libSQLite3;
2022-05-24 13:36:33 +02:00
FFstrbuf librpm;
2022-04-06 14:02:05 +02:00
FFstrbuf libImageMagick;
2022-04-14 15:11:14 +02:00
FFstrbuf libZ;
2022-04-28 19:15:46 +02:00
FFstrbuf libChafa;
2022-06-04 15:21:34 +02:00
FFstrbuf libEGL;
FFstrbuf libGLX;
2022-06-04 19:30:26 +02:00
FFstrbuf libOSMesa;
2022-06-05 00:18:40 +02:00
FFstrbuf libOpenCL;
2022-09-26 23:07:18 +08:00
FFstrbuf libfreetype;
2023-01-26 15:48:28 +01:00
FFstrbuf libPulse;
FFstrbuf libnm;
FFstrbuf libDdcutil;
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;
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;
yyjson_mut_doc* migrateConfigDoc;
2021-06-20 21:04:55 +02:00
} FFstate;
typedef struct FFinstance
{
FFconfig config;
FFstate state;
} FFinstance;
extern FFinstance instance; // Defined in `common/init.c`
extern FFModuleBaseInfo** ffModuleInfos[];
2021-06-20 21:04:55 +02:00
2022-04-02 14:35:43 +02:00
//////////////////////
2022-07-25 15:01:11 +02:00
// Init functions //
2022-04-02 14:35:43 +02:00
//////////////////////
2021-04-09 14:07:05 +02:00
//common/init.c
void ffInitInstance();
void ffStart();
void ffFinish();
void ffDestroyInstance();
2021-04-09 14:07:05 +02:00
2022-02-13 23:51:13 +01:00
void ffListFeatures();
2022-04-02 14:35:43 +02:00
////////////////////
// Logo functions //
////////////////////
void ffLogoPrint();
void ffLogoPrintRemaining();
void ffLogoPrintLine();
2022-04-02 14:35:43 +02:00
void ffLogoBuiltinPrint();
2022-06-08 10:59:33 +02:00
void ffLogoBuiltinList();
void ffLogoBuiltinListAutocompletion();
2022-04-02 14:35:43 +02:00
2021-03-27 18:14:19 +01:00
#endif