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>
|
2022-06-18 14:25:31 +02:00
|
|
|
|
2021-02-18 22:25:36 +01:00
|
|
|
#include <pwd.h>
|
2022-02-12 12:06:16 +01:00
|
|
|
#include <sys/types.h>
|
2021-02-18 22:25:36 +01:00
|
|
|
#include <sys/utsname.h>
|
|
|
|
|
#include <sys/sysinfo.h>
|
2021-04-15 18:59:26 +02:00
|
|
|
|
2021-03-19 20:57:07 +01:00
|
|
|
#include "util/FFstrbuf.h"
|
2021-04-24 13:05:43 +02:00
|
|
|
#include "util/FFlist.h"
|
2022-02-09 15:20:07 +01:00
|
|
|
#include "util/FFvaluestore.h"
|
2021-03-19 20:57:07 +01:00
|
|
|
|
2021-10-19 19:34:55 +02:00
|
|
|
static inline void ffUnused(int dummy, ...) { (void) dummy; }
|
|
|
|
|
#define FF_UNUSED(...) ffUnused(0, __VA_ARGS__);
|
2021-04-09 14:07:05 +02:00
|
|
|
|
2021-02-18 22:25:36 +01:00
|
|
|
#define FASTFETCH_TEXT_MODIFIER_BOLT "\033[1m"
|
2021-02-19 16:23:41 +01:00
|
|
|
#define FASTFETCH_TEXT_MODIFIER_ERROR "\033[1;31m"
|
2021-02-18 22:25:36 +01:00
|
|
|
#define FASTFETCH_TEXT_MODIFIER_RESET "\033[0m"
|
|
|
|
|
|
2021-12-19 22:39:22 +01:00
|
|
|
#define FASTFETCH_LOGO_MAX_COLORS 9 //two digits would make parsing much more complicated (index 1 - 9)
|
|
|
|
|
|
2022-04-02 14:35:43 +02:00
|
|
|
typedef enum FFLogoType
|
2021-11-09 15:14:25 +01:00
|
|
|
{
|
2022-04-02 14:35:43 +02:00
|
|
|
FF_LOGO_TYPE_AUTO, //If something is given, first try builtin, then file. Otherwise detect logo
|
|
|
|
|
FF_LOGO_TYPE_BUILTIN, //Builtin ascii art.
|
|
|
|
|
FF_LOGO_TYPE_FILE, //Raw text file, printed as is.
|
|
|
|
|
FF_LOGO_TYPE_RAW, //Raw text file, printed with color codes replacement.
|
2022-04-06 14:02:05 +02:00
|
|
|
FF_LOGO_TYPE_SIXEL, //Image file, printed as sixel codes.
|
2022-04-28 19:15:46 +02:00
|
|
|
FF_LOGO_TYPE_KITTY, //Image file, printed as kitty graphics protocol
|
|
|
|
|
FF_LOGO_TYPE_CHAFA //Image file, printed as ascii art using libchafa
|
2022-04-02 14:35:43 +02:00
|
|
|
} FFLogoType;
|
2021-11-09 15:14:25 +01:00
|
|
|
|
2022-06-04 15:21:34 +02:00
|
|
|
typedef enum FFGLType
|
|
|
|
|
{
|
|
|
|
|
FF_GL_TYPE_AUTO,
|
|
|
|
|
FF_GL_TYPE_EGL,
|
2022-06-04 19:30:26 +02:00
|
|
|
FF_GL_TYPE_GLX,
|
|
|
|
|
FF_GL_TYPE_OSMESA
|
2022-06-04 15:21:34 +02:00
|
|
|
} FFGLType;
|
|
|
|
|
|
2022-06-17 18:15:36 +02:00
|
|
|
typedef struct FFModuleArgs
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf key;
|
|
|
|
|
FFstrbuf outputFormat;
|
|
|
|
|
FFstrbuf errorFormat;
|
|
|
|
|
} FFModuleArgs;
|
|
|
|
|
|
2021-02-27 18:30:05 +01:00
|
|
|
typedef struct FFconfig
|
2021-02-18 22:25:36 +01:00
|
|
|
{
|
2022-04-22 15:49:50 +02:00
|
|
|
FFstrbuf logoSource;
|
2022-04-02 14:35:43 +02:00
|
|
|
FFLogoType logoType;
|
2021-12-19 22:39:22 +01:00
|
|
|
FFstrbuf logoColors[FASTFETCH_LOGO_MAX_COLORS];
|
2022-04-06 14:02:05 +02:00
|
|
|
uint32_t logoWidth;
|
2022-04-30 11:22:51 +02:00
|
|
|
uint32_t logoHeight;
|
2022-04-02 14:35:43 +02:00
|
|
|
uint32_t logoPaddingLeft;
|
|
|
|
|
uint32_t logoPaddingRight;
|
|
|
|
|
bool logoPrintRemaining;
|
2021-06-13 14:23:35 +02:00
|
|
|
|
2022-06-08 10:59:33 +02:00
|
|
|
FFstrbuf mainColor; //If this is empty, ffLogoPrint will set it to the main color of the logo
|
2021-05-15 12:36:25 +02:00
|
|
|
FFstrbuf separator;
|
2022-04-02 14:35:43 +02:00
|
|
|
|
2021-02-19 16:23:41 +01:00
|
|
|
bool showErrors;
|
2021-02-22 16:52:51 +01:00
|
|
|
bool recache;
|
2021-04-22 21:41:42 +02:00
|
|
|
bool cacheSave;
|
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-06-04 15:21:34 +02:00
|
|
|
FFGLType glType;
|
2022-06-06 14:02:21 +02:00
|
|
|
bool pipe; //disables logo and all escape sequences
|
2021-03-03 21:03:12 +01:00
|
|
|
|
2022-06-17 18:15:36 +02:00
|
|
|
FFModuleArgs os;
|
|
|
|
|
FFModuleArgs host;
|
|
|
|
|
FFModuleArgs kernel;
|
|
|
|
|
FFModuleArgs uptime;
|
|
|
|
|
FFModuleArgs processes;
|
|
|
|
|
FFModuleArgs packages;
|
|
|
|
|
FFModuleArgs shell;
|
|
|
|
|
FFModuleArgs resolution;
|
|
|
|
|
FFModuleArgs de;
|
|
|
|
|
FFModuleArgs wm;
|
|
|
|
|
FFModuleArgs wmTheme;
|
|
|
|
|
FFModuleArgs theme;
|
|
|
|
|
FFModuleArgs icons;
|
|
|
|
|
FFModuleArgs font;
|
|
|
|
|
FFModuleArgs cursor;
|
|
|
|
|
FFModuleArgs terminal;
|
|
|
|
|
FFModuleArgs terminalFont;
|
|
|
|
|
FFModuleArgs cpu;
|
|
|
|
|
FFModuleArgs cpuUsage;
|
|
|
|
|
FFModuleArgs gpu;
|
|
|
|
|
FFModuleArgs memory;
|
|
|
|
|
FFModuleArgs disk;
|
|
|
|
|
FFModuleArgs battery;
|
|
|
|
|
FFModuleArgs locale;
|
|
|
|
|
FFModuleArgs localIP;
|
|
|
|
|
FFModuleArgs publicIP;
|
|
|
|
|
FFModuleArgs player;
|
|
|
|
|
FFModuleArgs song;
|
|
|
|
|
FFModuleArgs dateTime;
|
|
|
|
|
FFModuleArgs date;
|
|
|
|
|
FFModuleArgs time;
|
|
|
|
|
FFModuleArgs vulkan;
|
|
|
|
|
FFModuleArgs openGL;
|
|
|
|
|
FFModuleArgs openCL;
|
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;
|
2021-03-03 21:03:12 +01:00
|
|
|
|
2021-03-28 15:38:52 +02:00
|
|
|
FFstrbuf diskFolders;
|
|
|
|
|
|
2021-04-24 13:05:43 +02:00
|
|
|
FFstrbuf batteryDir;
|
|
|
|
|
|
2021-11-18 18:25:24 +01:00
|
|
|
FFstrbuf separatorString;
|
|
|
|
|
|
2021-10-17 12:42:15 +08:00
|
|
|
bool localIpShowLoop;
|
|
|
|
|
bool localIpShowIpV4;
|
|
|
|
|
bool localIpShowIpV6;
|
|
|
|
|
|
2022-01-10 20:20:18 +01:00
|
|
|
uint32_t publicIpTimeout;
|
|
|
|
|
|
2022-01-18 18:56:37 +01:00
|
|
|
FFstrbuf osFile;
|
|
|
|
|
|
2022-02-13 23:51:13 +01:00
|
|
|
FFstrbuf playerName;
|
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
|
|
|
|
|
|
|
|
struct passwd* passwd;
|
|
|
|
|
struct utsname utsname;
|
|
|
|
|
struct sysinfo sysinfo;
|
|
|
|
|
|
|
|
|
|
FFlist configDirs;
|
|
|
|
|
FFstrbuf cacheDir;
|
|
|
|
|
} FFstate;
|
|
|
|
|
|
|
|
|
|
typedef struct FFinstance
|
|
|
|
|
{
|
|
|
|
|
FFconfig config;
|
|
|
|
|
FFstate state;
|
|
|
|
|
} FFinstance;
|
|
|
|
|
|
2022-06-01 00:04:58 +02:00
|
|
|
typedef struct FFVersion
|
|
|
|
|
{
|
|
|
|
|
uint32_t major;
|
|
|
|
|
uint32_t minor;
|
|
|
|
|
uint32_t patch;
|
|
|
|
|
} FFVersion;
|
|
|
|
|
#define FF_VERSION_INIT ((FFVersion) {0})
|
|
|
|
|
|
2021-06-15 11:04:44 +02:00
|
|
|
typedef struct FFTitleResult
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf userName;
|
|
|
|
|
FFstrbuf hostname;
|
|
|
|
|
} FFTitleResult;
|
|
|
|
|
|
2021-04-22 21:41:42 +02:00
|
|
|
typedef struct FFOSResult
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf systemName;
|
|
|
|
|
FFstrbuf name;
|
|
|
|
|
FFstrbuf prettyName;
|
|
|
|
|
FFstrbuf id;
|
|
|
|
|
FFstrbuf idLike;
|
|
|
|
|
FFstrbuf variant;
|
|
|
|
|
FFstrbuf variantID;
|
|
|
|
|
FFstrbuf version;
|
|
|
|
|
FFstrbuf versionID;
|
|
|
|
|
FFstrbuf codename;
|
|
|
|
|
FFstrbuf buildID;
|
|
|
|
|
FFstrbuf architecture;
|
|
|
|
|
} FFOSResult;
|
|
|
|
|
|
|
|
|
|
typedef struct FFPlasmaResult
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf widgetStyle;
|
|
|
|
|
FFstrbuf colorScheme;
|
|
|
|
|
FFstrbuf icons;
|
|
|
|
|
FFstrbuf font;
|
|
|
|
|
} FFPlasmaResult;
|
|
|
|
|
|
|
|
|
|
typedef struct FFGTKResult
|
2021-04-16 20:22:38 +02:00
|
|
|
{
|
|
|
|
|
FFstrbuf theme;
|
|
|
|
|
FFstrbuf icons;
|
|
|
|
|
FFstrbuf font;
|
2021-06-20 21:04:55 +02:00
|
|
|
FFstrbuf cursor;
|
|
|
|
|
FFstrbuf cursorSize;
|
2021-04-22 21:41:42 +02:00
|
|
|
} FFGTKResult;
|
|
|
|
|
|
2021-06-14 23:22:14 +02:00
|
|
|
typedef struct FFTerminalShellResult
|
2021-04-22 21:41:42 +02:00
|
|
|
{
|
2021-06-14 23:22:14 +02:00
|
|
|
FFstrbuf shellProcessName;
|
|
|
|
|
FFstrbuf shellExe;
|
|
|
|
|
const char* shellExeName; //pointer to a char in shellExe
|
|
|
|
|
FFstrbuf shellVersion;
|
|
|
|
|
|
|
|
|
|
FFstrbuf terminalProcessName;
|
|
|
|
|
FFstrbuf terminalExe;
|
|
|
|
|
const char* terminalExeName; //pointer to a char in terminalExe
|
|
|
|
|
|
|
|
|
|
FFstrbuf userShellExe;
|
|
|
|
|
const char* userShellExeName; //pointer to a char in userShellExe
|
|
|
|
|
FFstrbuf userShellVersion;
|
|
|
|
|
} FFTerminalShellResult;
|
2021-04-22 21:41:42 +02:00
|
|
|
|
2022-06-01 00:04:58 +02:00
|
|
|
typedef struct FFGPUResult
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf vendor;
|
|
|
|
|
FFstrbuf name;
|
|
|
|
|
FFstrbuf driver;
|
2022-06-17 23:38:33 +02:00
|
|
|
double temperature;
|
2022-06-01 00:04:58 +02:00
|
|
|
} FFGPUResult;
|
|
|
|
|
|
|
|
|
|
typedef struct FFVulkanResult
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf driver;
|
|
|
|
|
FFstrbuf apiVersion;
|
|
|
|
|
FFstrbuf conformanceVersion;
|
|
|
|
|
FFlist devices; //List of FFGPUResult
|
|
|
|
|
} FFVulkanResult;
|
|
|
|
|
|
2022-01-02 16:55:26 +01:00
|
|
|
typedef struct FFResolutionResult
|
|
|
|
|
{
|
|
|
|
|
uint32_t width;
|
|
|
|
|
uint32_t height;
|
|
|
|
|
uint32_t refreshRate;
|
|
|
|
|
} FFResolutionResult;
|
|
|
|
|
|
|
|
|
|
typedef struct FFDisplayServerResult
|
2021-04-22 21:41:42 +02:00
|
|
|
{
|
2021-05-01 13:03:30 +02:00
|
|
|
FFstrbuf wmProcessName;
|
|
|
|
|
FFstrbuf wmPrettyName;
|
|
|
|
|
FFstrbuf wmProtocolName;
|
|
|
|
|
FFstrbuf deProcessName;
|
|
|
|
|
FFstrbuf dePrettyName;
|
|
|
|
|
FFstrbuf deVersion;
|
2022-01-02 16:55:26 +01:00
|
|
|
FFlist resolutions; //List of FFResolutionResult
|
|
|
|
|
} FFDisplayServerResult;
|
2021-04-16 20:22:38 +02:00
|
|
|
|
2022-01-16 16:33:15 +01:00
|
|
|
typedef struct FFTempValue
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf name;
|
2022-02-12 12:38:14 +01:00
|
|
|
FFstrbuf deviceClass;
|
2022-06-17 23:38:33 +02:00
|
|
|
double value;
|
2022-01-16 16:33:15 +01:00
|
|
|
} FFTempValue;
|
|
|
|
|
|
|
|
|
|
typedef struct FFTempsResult
|
|
|
|
|
{
|
|
|
|
|
FFlist values; //List of FFTempValue
|
|
|
|
|
} FFTempsResult;
|
|
|
|
|
|
2022-02-13 23:51:13 +01:00
|
|
|
typedef struct FFMediaResult
|
|
|
|
|
{
|
2022-03-22 18:59:04 +01:00
|
|
|
FFstrbuf busNameShort; //e.g. plasma-browser-integration
|
|
|
|
|
FFstrbuf player; // e.g. Google Chrome
|
2022-02-13 23:51:13 +01:00
|
|
|
FFstrbuf song;
|
|
|
|
|
FFstrbuf artist;
|
|
|
|
|
FFstrbuf album;
|
2022-03-22 18:59:04 +01:00
|
|
|
FFstrbuf url;
|
2022-02-13 23:51:13 +01:00
|
|
|
} FFMediaResult;
|
|
|
|
|
|
2022-02-25 13:30:37 +01:00
|
|
|
typedef struct FFDateTimeResult
|
|
|
|
|
{
|
|
|
|
|
//Examples for 21.02.2022 - 15:18:37
|
|
|
|
|
uint16_t year; //2022
|
|
|
|
|
uint8_t yearShort; //22
|
|
|
|
|
uint8_t month; //2
|
|
|
|
|
FFstrbuf monthPretty; //02
|
|
|
|
|
FFstrbuf monthName; //February
|
|
|
|
|
FFstrbuf monthNameShort; //Feb
|
|
|
|
|
uint8_t week; //8
|
|
|
|
|
FFstrbuf weekday; //Monday
|
|
|
|
|
FFstrbuf weekdayShort; //Mon
|
|
|
|
|
uint16_t dayInYear; //52
|
|
|
|
|
uint8_t dayInMonth; //21
|
|
|
|
|
uint8_t dayInWeek; //1
|
|
|
|
|
uint8_t hour; //15
|
|
|
|
|
FFstrbuf hourPretty; //15
|
|
|
|
|
uint8_t hour12; //3
|
|
|
|
|
FFstrbuf hour12Pretty; //03
|
|
|
|
|
uint8_t minute; //18
|
|
|
|
|
FFstrbuf minutePretty; //18
|
|
|
|
|
uint8_t second; //37
|
|
|
|
|
FFstrbuf secondPretty; //37
|
|
|
|
|
} FFDateTimeResult;
|
|
|
|
|
|
2021-03-19 20:57:07 +01:00
|
|
|
typedef enum FFformatargtype
|
|
|
|
|
{
|
2021-04-24 21:42:48 +02:00
|
|
|
FF_FORMAT_ARG_TYPE_NULL = 0,
|
2021-03-19 20:57:07 +01:00
|
|
|
FF_FORMAT_ARG_TYPE_UINT,
|
2021-10-18 22:38:00 +08:00
|
|
|
FF_FORMAT_ARG_TYPE_UINT16,
|
2021-03-19 20:57:07 +01:00
|
|
|
FF_FORMAT_ARG_TYPE_UINT8,
|
|
|
|
|
FF_FORMAT_ARG_TYPE_INT,
|
|
|
|
|
FF_FORMAT_ARG_TYPE_STRING,
|
|
|
|
|
FF_FORMAT_ARG_TYPE_STRBUF,
|
2021-05-23 19:40:34 +02:00
|
|
|
FF_FORMAT_ARG_TYPE_DOUBLE,
|
|
|
|
|
FF_FORMAT_ARG_TYPE_LIST
|
2021-03-19 20:57:07 +01:00
|
|
|
} FFformatargtype;
|
|
|
|
|
|
|
|
|
|
typedef struct FFformatarg
|
|
|
|
|
{
|
|
|
|
|
FFformatargtype type;
|
2021-04-03 11:39:59 +02:00
|
|
|
const void* value;
|
2021-03-19 20:57:07 +01:00
|
|
|
} FFformatarg;
|
|
|
|
|
|
2021-04-15 18:59:26 +02:00
|
|
|
typedef struct FFcache
|
|
|
|
|
{
|
|
|
|
|
FILE* value;
|
|
|
|
|
FILE* split;
|
|
|
|
|
} FFcache;
|
|
|
|
|
|
2021-05-05 20:20:41 +02:00
|
|
|
typedef enum FFvarianttype
|
|
|
|
|
{
|
|
|
|
|
FF_VARIANT_TYPE_STRING,
|
2021-06-20 21:04:55 +02:00
|
|
|
FF_VARIANT_TYPE_BOOL,
|
|
|
|
|
FF_VARIANT_TYPE_INT
|
2021-05-05 20:20:41 +02:00
|
|
|
} FFvarianttype;
|
|
|
|
|
|
2021-05-08 17:56:56 +02:00
|
|
|
typedef union FFvariant
|
2021-05-05 20:20:41 +02:00
|
|
|
{
|
2021-05-08 17:56:56 +02:00
|
|
|
const char* strValue;
|
2021-06-20 21:04:55 +02:00
|
|
|
int32_t intValue;
|
2021-05-08 18:58:40 +02:00
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
bool boolValueSet;
|
|
|
|
|
bool boolValue;
|
|
|
|
|
};
|
2021-05-05 20:20:41 +02:00
|
|
|
} FFvariant;
|
|
|
|
|
|
2021-11-13 14:10:30 +01:00
|
|
|
#define FF_VARIANT_NULL ((FFvariant){.strValue = NULL})
|
|
|
|
|
|
2021-05-23 19:40:34 +02:00
|
|
|
typedef struct FFfont
|
|
|
|
|
{
|
|
|
|
|
FFstrbuf pretty;
|
|
|
|
|
FFstrbuf name;
|
|
|
|
|
FFstrbuf size;
|
|
|
|
|
FFlist styles;
|
|
|
|
|
} FFfont;
|
|
|
|
|
|
2021-06-20 21:04:55 +02:00
|
|
|
typedef struct FFpropquery
|
|
|
|
|
{
|
|
|
|
|
const char* start;
|
|
|
|
|
FFstrbuf* buffer;
|
|
|
|
|
} FFpropquery;
|
|
|
|
|
|
2021-11-13 14:10:30 +01:00
|
|
|
typedef enum FFInitState
|
|
|
|
|
{
|
|
|
|
|
FF_INITSTATE_UNINITIALIZED = 0,
|
|
|
|
|
FF_INITSTATE_SUCCESSFUL = 1,
|
|
|
|
|
FF_INITSTATE_FAILED = 2
|
|
|
|
|
} FFInitState;
|
|
|
|
|
|
|
|
|
|
#define FF_LIBRARY_SYMBOL(symbolName) \
|
|
|
|
|
__typeof__(&symbolName) ff ## symbolName;
|
|
|
|
|
|
2022-01-05 16:14:27 +01:00
|
|
|
#define FF_LIBRARY_LOAD(libraryObjectName, userLibraryName, returnValue, ...) \
|
|
|
|
|
void* libraryObjectName = ffLibraryLoad(&userLibraryName, __VA_ARGS__, NULL);\
|
|
|
|
|
if(libraryObjectName == NULL) \
|
2021-11-13 14:10:30 +01:00
|
|
|
return returnValue;
|
|
|
|
|
|
|
|
|
|
#define FF_LIBRARY_LOAD_SYMBOL_ADRESS(library, symbolMapping, symbolName, returnValue) \
|
|
|
|
|
symbolMapping = dlsym(library, #symbolName); \
|
2022-01-05 16:14:27 +01:00
|
|
|
if(symbolMapping == NULL) \
|
2021-11-13 14:10:30 +01:00
|
|
|
{ \
|
|
|
|
|
dlclose(library); \
|
|
|
|
|
return returnValue; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \
|
|
|
|
|
__typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADRESS(library, ff ## symbolName, symbolName, returnValue);
|
|
|
|
|
|
2022-04-02 14:35:43 +02:00
|
|
|
//////////////////////
|
|
|
|
|
// Common functions //
|
|
|
|
|
//////////////////////
|
2021-04-09 14:07:05 +02:00
|
|
|
|
|
|
|
|
//common/init.c
|
|
|
|
|
void ffInitInstance(FFinstance* instance);
|
2021-06-17 13:49:25 +02:00
|
|
|
void ffStart(FFinstance* instance);
|
2021-04-09 14:07:05 +02:00
|
|
|
void ffFinish(FFinstance* instance);
|
|
|
|
|
|
2022-02-13 23:51:13 +01:00
|
|
|
void ffListFeatures();
|
|
|
|
|
|
2021-04-09 14:07:05 +02:00
|
|
|
//common/threading.c
|
2021-06-15 13:12:29 +02:00
|
|
|
void ffStartDetectionThreads(FFinstance* instance);
|
2021-04-09 14:07:05 +02:00
|
|
|
|
|
|
|
|
//common/io.c
|
2022-06-19 18:22:00 +02:00
|
|
|
bool ffWriteFDBuffer(int fd, const FFstrbuf* content);
|
|
|
|
|
bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data);
|
|
|
|
|
bool ffWriteFileBuffer(const char* fileName, const FFstrbuf* buffer);
|
|
|
|
|
|
2022-06-20 16:27:33 +02:00
|
|
|
bool ffAppendFDBuffer(int fd, FFstrbuf* buffer);
|
|
|
|
|
ssize_t ffGetFileData(const char* fileName, size_t dataSize, void* data);
|
|
|
|
|
bool ffAppendFileBuffer(const char* fileName, FFstrbuf* buffer);
|
|
|
|
|
bool ffGetFileBuffer(const char* fileName, FFstrbuf* buffer);
|
2021-04-15 18:59:26 +02:00
|
|
|
|
2022-02-12 12:06:16 +01:00
|
|
|
bool ffFileExists(const char* fileName, mode_t mode);
|
2022-04-08 15:50:49 +02:00
|
|
|
void ffSuppressIO(bool suppress); // Not thread safe!
|
2022-02-12 12:06:16 +01:00
|
|
|
|
2022-04-26 17:17:16 +02:00
|
|
|
void ffGetTerminalResponse(const char* request, const char* format, ...);
|
2022-04-19 11:48:08 +02:00
|
|
|
|
2022-04-08 15:50:49 +02:00
|
|
|
//common/printing.c
|
2022-06-06 14:30:06 +02:00
|
|
|
void ffPrintLogoAndKey(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat);
|
2022-06-17 18:15:36 +02:00
|
|
|
void ffPrintFormatString(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat, const FFstrbuf* format, uint32_t numArgs, const FFformatarg* arguments);
|
|
|
|
|
void ffPrintFormat(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, uint32_t numArgs, const FFformatarg* arguments);
|
|
|
|
|
void ffPrintErrorString(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFstrbuf* customKeyFormat, const FFstrbuf* customErrorFormat, const char* message, ...);
|
|
|
|
|
void ffPrintError(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, const char* message, ...);
|
2021-12-19 22:39:22 +01:00
|
|
|
void ffPrintColor(const FFstrbuf* colorValue);
|
2022-04-08 15:50:49 +02:00
|
|
|
void ffPrintCharTimes(char c, uint32_t times);
|
|
|
|
|
|
|
|
|
|
//common/caching.c
|
|
|
|
|
void ffCacheValidate(FFinstance* instance);
|
|
|
|
|
|
|
|
|
|
void ffCacheOpenWrite(FFinstance* instance, const char* moduleName, FFcache* cache);
|
|
|
|
|
void ffCacheClose(FFcache* cache);
|
2021-12-19 22:39:22 +01:00
|
|
|
|
2022-06-17 18:15:36 +02:00
|
|
|
bool ffPrintFromCache(FFinstance* instance, const char* moduleName, const FFModuleArgs* moduleArgs, uint32_t numArgs);
|
|
|
|
|
void ffPrintAndAppendToCache(FFinstance* instance, const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFcache* cache, const FFstrbuf* value, uint32_t numArgs, const FFformatarg* arguments);
|
|
|
|
|
void ffPrintAndWriteToCache(FFinstance* instance, const char* moduleName, const FFModuleArgs* moduleArgs, const FFstrbuf* value, uint32_t numArgs, const FFformatarg* arguments);
|
2022-04-08 15:50:49 +02:00
|
|
|
|
|
|
|
|
//common/properties.c
|
|
|
|
|
bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer);
|
|
|
|
|
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer);
|
2021-06-20 21:04:55 +02:00
|
|
|
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries);
|
|
|
|
|
bool ffParsePropFile(const char* filename, const char* start, FFstrbuf* buffer);
|
2022-01-02 16:55:26 +01:00
|
|
|
bool ffParsePropFileHomeValues(const FFinstance* instance, const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
|
|
|
|
bool ffParsePropFileHome(const FFinstance* instance, const char* relativeFile, const char* start, FFstrbuf* buffer);
|
|
|
|
|
bool ffParsePropFileConfigValues(const FFinstance* instance, const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
|
|
|
|
bool ffParsePropFileConfig(const FFinstance* instance, const char* relativeFile, const char* start, FFstrbuf* buffer);
|
2021-02-27 18:30:05 +01:00
|
|
|
|
2022-04-08 15:50:49 +02:00
|
|
|
//common/font.c
|
|
|
|
|
void ffFontInitQt(FFfont* font, const char* data);
|
|
|
|
|
void ffFontInitPango(FFfont* font, const char* data);
|
|
|
|
|
void ffFontInitCopy(FFfont* font, const char* name);
|
|
|
|
|
void ffFontDestroy(FFfont* font);
|
2022-01-10 20:20:18 +01:00
|
|
|
|
2021-04-09 14:07:05 +02:00
|
|
|
//common/format.c
|
2021-04-16 17:46:50 +02:00
|
|
|
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
2022-06-17 18:15:36 +02:00
|
|
|
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
2021-04-09 14:07:05 +02:00
|
|
|
|
|
|
|
|
//common/parsing.c
|
2022-04-08 15:50:49 +02:00
|
|
|
bool ffStrSet(const char* str);
|
|
|
|
|
void ffParseSemver(FFstrbuf* buffer, const FFstrbuf* major, const FFstrbuf* minor, const FFstrbuf* patch);
|
|
|
|
|
void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, const FFstrbuf* gtk4);
|
2021-05-23 19:40:34 +02:00
|
|
|
|
2022-06-01 00:04:58 +02:00
|
|
|
void ffVersionToPretty(const FFVersion* version, FFstrbuf* pretty);
|
|
|
|
|
int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
|
|
|
|
|
|
2022-04-08 15:50:49 +02:00
|
|
|
//common/processing.c
|
|
|
|
|
void ffProcessAppendStdOut(FFstrbuf* buffer, char* const argv[]);
|
2021-04-05 19:25:34 +02:00
|
|
|
|
2022-04-08 15:50:49 +02:00
|
|
|
//common/libraries.c
|
|
|
|
|
void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...);
|
2021-06-20 21:04:55 +02:00
|
|
|
|
2022-04-08 15:50:49 +02:00
|
|
|
//common/networking.c
|
|
|
|
|
void ffNetworkingGetHttp(const char* host, const char* path, uint32_t timeout, FFstrbuf* buffer);
|
2022-01-07 18:00:38 +01:00
|
|
|
|
2021-05-04 19:48:23 +02:00
|
|
|
//common/settings.c
|
2021-05-08 17:56:56 +02:00
|
|
|
FFvariant ffSettingsGetDConf(FFinstance* instance, const char* key, FFvarianttype type);
|
2021-05-20 20:06:08 +02:00
|
|
|
FFvariant ffSettingsGetGSettings(FFinstance* instance, const char* schemaName, const char* path, const char* key, FFvarianttype type);
|
2021-05-08 17:56:56 +02:00
|
|
|
FFvariant ffSettingsGet(FFinstance* instance, const char* dconfKey, const char* gsettingsSchemaName, const char* gsettingsPath, const char* gsettingsKey, FFvarianttype type);
|
2021-05-11 20:06:17 +02:00
|
|
|
FFvariant ffSettingsGetXFConf(FFinstance* instance, const char* channelName, const char* propertyName, FFvarianttype type);
|
2021-05-01 16:01:59 +02:00
|
|
|
|
2022-05-24 13:36:33 +02:00
|
|
|
int ffSettingsGetSQLite3Int(const FFinstance* instance, const char* dbPath, const char* query);
|
2022-05-23 19:30:02 +02:00
|
|
|
|
2021-10-20 06:04:55 +00:00
|
|
|
#ifdef __ANDROID__
|
2022-01-10 15:20:51 +01:00
|
|
|
bool ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result);
|
2021-10-20 06:04:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
2022-04-02 14:35:43 +02:00
|
|
|
////////////////////
|
|
|
|
|
// Logo functions //
|
|
|
|
|
////////////////////
|
|
|
|
|
|
2022-06-08 10:59:33 +02:00
|
|
|
void ffLogoPrint(FFinstance* instance);
|
|
|
|
|
void ffLogoPrintRemaining(FFinstance* instance);
|
|
|
|
|
void ffLogoPrintLine(FFinstance* instance);
|
2022-04-02 14:35:43 +02:00
|
|
|
|
2022-06-08 10:59:33 +02:00
|
|
|
void ffLogoBuiltinPrint(FFinstance* instance);
|
|
|
|
|
void ffLogoBuiltinList();
|
|
|
|
|
void ffLogoBuiltinListAutocompletion();
|
2022-04-02 14:35:43 +02:00
|
|
|
|
|
|
|
|
/////////////////////////
|
|
|
|
|
// Detection functions //
|
|
|
|
|
/////////////////////////
|
|
|
|
|
|
2022-01-14 13:21:49 +01:00
|
|
|
//detection/os.c
|
2022-04-02 14:35:43 +02:00
|
|
|
const FFOSResult* ffDetectOS(const FFinstance* instance);
|
2022-01-14 13:21:49 +01:00
|
|
|
|
2021-12-20 16:34:46 +01:00
|
|
|
//detection/plasma.c
|
2021-04-28 19:53:30 +02:00
|
|
|
const FFPlasmaResult* ffDetectPlasma(FFinstance* instance);
|
2021-04-22 21:41:42 +02:00
|
|
|
|
2021-12-20 16:34:46 +01:00
|
|
|
//detection/gtk.c
|
2021-04-28 19:53:30 +02:00
|
|
|
const FFGTKResult* ffDetectGTK2(FFinstance* instance);
|
|
|
|
|
const FFGTKResult* ffDetectGTK4(FFinstance* instance);
|
|
|
|
|
const FFGTKResult* ffDetectGTK3(FFinstance* instance);
|
2021-04-09 14:07:05 +02:00
|
|
|
|
2022-01-02 16:55:26 +01:00
|
|
|
//detection/displayServer.c
|
|
|
|
|
const FFDisplayServerResult* ffConnectDisplayServer(const FFinstance* instance);
|
2021-05-01 13:03:30 +02:00
|
|
|
|
2021-12-20 16:34:46 +01:00
|
|
|
//detection/terminalShell.c
|
2021-06-14 23:22:14 +02:00
|
|
|
const FFTerminalShellResult* ffDetectTerminalShell(FFinstance* instance);
|
|
|
|
|
|
2022-01-16 16:33:15 +01:00
|
|
|
//detection/temps.c (currently unused)
|
|
|
|
|
const FFTempsResult* ffDetectTemps(const FFinstance* instance);
|
|
|
|
|
|
2022-02-13 23:51:13 +01:00
|
|
|
//detection/media.c
|
|
|
|
|
const FFMediaResult* ffDetectMedia(FFinstance* instance);
|
|
|
|
|
|
2022-02-25 13:30:37 +01:00
|
|
|
//detection/dateTime.c
|
|
|
|
|
const FFDateTimeResult* ffDetectDateTime(const FFinstance* instance);
|
|
|
|
|
|
2022-06-01 00:04:58 +02:00
|
|
|
//detection/vulkan.c
|
|
|
|
|
const FFVulkanResult* ffDetectVulkan(const FFinstance* instance);
|
|
|
|
|
|
2022-04-02 14:35:43 +02:00
|
|
|
//////////////////////
|
|
|
|
|
// Module functions //
|
|
|
|
|
//////////////////////
|
2021-04-09 14:07:05 +02:00
|
|
|
|
2021-04-28 19:53:30 +02:00
|
|
|
//Common
|
2021-06-15 11:04:44 +02:00
|
|
|
const FFTitleResult* ffDetectTitle(FFinstance* instance);
|
2021-04-28 19:53:30 +02:00
|
|
|
|
2022-06-17 18:15:36 +02:00
|
|
|
void ffPrintDateTimeFormat(FFinstance* instance, const char* moduleName, const FFModuleArgs* moduleArgs);
|
2022-02-25 13:30:37 +01:00
|
|
|
|
2021-04-28 19:53:30 +02:00
|
|
|
//Printing
|
2021-03-11 17:21:18 +01:00
|
|
|
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintCustom(FFinstance* instance, const char* key, const char* value);
|
|
|
|
|
void ffPrintBreak(FFinstance* instance);
|
|
|
|
|
void ffPrintTitle(FFinstance* instance);
|
2021-05-15 12:36:25 +02:00
|
|
|
void ffPrintSeparator(FFinstance* instance);
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintOS(FFinstance* instance);
|
|
|
|
|
void ffPrintHost(FFinstance* instance);
|
|
|
|
|
void ffPrintKernel(FFinstance* instance);
|
|
|
|
|
void ffPrintUptime(FFinstance* instance);
|
2021-10-18 22:38:00 +08:00
|
|
|
void ffPrintProcesses(FFinstance* instance);
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintPackages(FFinstance* instance);
|
|
|
|
|
void ffPrintShell(FFinstance* instance);
|
|
|
|
|
void ffPrintResolution(FFinstance* instance);
|
|
|
|
|
void ffPrintDesktopEnvironment(FFinstance* instance);
|
2021-03-05 21:38:35 +01:00
|
|
|
void ffPrintWM(FFinstance* instance);
|
2021-04-03 23:10:14 +02:00
|
|
|
void ffPrintWMTheme(FFinstance* instance);
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintTheme(FFinstance* instance);
|
|
|
|
|
void ffPrintIcons(FFinstance* instance);
|
|
|
|
|
void ffPrintFont(FFinstance* instance);
|
2021-06-20 21:04:55 +02:00
|
|
|
void ffPrintCursor(FFinstance* instance);
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintTerminal(FFinstance* instance);
|
2021-03-11 17:21:18 +01:00
|
|
|
void ffPrintTerminalFont(FFinstance* instance);
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintCPU(FFinstance* instance);
|
2021-11-24 16:16:25 +08:00
|
|
|
void ffPrintCPUUsage(FFinstance* instance);
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintGPU(FFinstance* instance);
|
|
|
|
|
void ffPrintMemory(FFinstance* instance);
|
|
|
|
|
void ffPrintDisk(FFinstance* instance);
|
|
|
|
|
void ffPrintBattery(FFinstance* instance);
|
|
|
|
|
void ffPrintLocale(FFinstance* instance);
|
2022-02-13 23:51:13 +01:00
|
|
|
void ffPrintPlayer(FFinstance* instance);
|
|
|
|
|
void ffPrintSong(FFinstance* instance);
|
2022-02-25 13:30:37 +01:00
|
|
|
void ffPrintDateTime(FFinstance* instance);
|
|
|
|
|
void ffPrintDate(FFinstance* instance);
|
|
|
|
|
void ffPrintTime(FFinstance* instance);
|
2022-02-14 12:04:54 +01:00
|
|
|
void ffPrintLocalIp(FFinstance* instance);
|
|
|
|
|
void ffPrintPublicIp(FFinstance* instance);
|
2021-02-27 19:22:28 +01:00
|
|
|
void ffPrintColors(FFinstance* instance);
|
2022-06-01 00:04:58 +02:00
|
|
|
void ffPrintVulkan(FFinstance* instance);
|
2022-06-04 15:21:34 +02:00
|
|
|
void ffPrintOpenGL(FFinstance* instance);
|
2022-06-05 00:18:40 +02:00
|
|
|
void ffPrintOpenCL(FFinstance* instance);
|
2021-02-18 22:25:36 +01:00
|
|
|
|
2021-03-27 18:14:19 +01:00
|
|
|
#endif
|