2024-01-03 12:09:07 +00:00
|
|
|
#ifndef _FETCH_H
|
|
|
|
#define _FETCH_H
|
2023-11-02 14:51:10 +00:00
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
|
|
|
|
#if defined(CLOCK_BOOTTIME)
|
|
|
|
#define CLOCK CLOCK_BOOTTIME
|
|
|
|
#elif defined(CLOCK_UPTIME)
|
|
|
|
#define CLOCK CLOCK_UPTIME
|
|
|
|
#elif defined(__APPLE__)
|
|
|
|
#define CLOCK CLOCK_MONOTONIC
|
|
|
|
#endif
|
|
|
|
|
2023-11-26 10:13:38 +00:00
|
|
|
#define OS_SIZE 128
|
2023-12-28 13:21:23 +00:00
|
|
|
#define MODEL_BUFF_SIZE 512
|
|
|
|
static const char *MODELS[] = {
|
|
|
|
"/sys/devices/virtual/dmi/id/product_name",
|
|
|
|
"/sys/devices/virtual/dmi/id/product_version",
|
|
|
|
"/sys/firmware/devicetree/base/model"
|
|
|
|
};
|
|
|
|
|
2023-11-02 14:51:10 +00:00
|
|
|
typedef struct {
|
2023-12-16 15:58:30 +00:00
|
|
|
char os_name[OS_SIZE + 1];
|
2023-11-02 14:51:10 +00:00
|
|
|
struct utsname uts;
|
|
|
|
|
|
|
|
char *pkg_cmd;
|
|
|
|
char *color;
|
|
|
|
char *font_color;
|
|
|
|
size_t logo_size;
|
|
|
|
char **logo;
|
|
|
|
} FETCH;
|
|
|
|
|
|
|
|
FETCH Init(void);
|
|
|
|
int GetOs(char *os_name, size_t len);
|
2024-01-03 10:18:43 +00:00
|
|
|
void GetArt(FETCH *fetch, int flag);
|
2023-11-26 09:49:11 +00:00
|
|
|
int GetKernel(const char *title, const FETCH fetch);
|
|
|
|
int PrintOs(const char *title, const FETCH fetch);
|
|
|
|
int Blank(const char *title, const FETCH fetch);
|
|
|
|
int GetUser(const char *title, const FETCH fetch);
|
|
|
|
int GetUptime(const char *title, const FETCH fetch);
|
|
|
|
int GetArch(const char *title, const FETCH fetch);
|
|
|
|
int GetShell(const char *title, const FETCH fetch);
|
|
|
|
int GetPkg(const char *title, const FETCH fetch);
|
2023-12-15 14:02:25 +00:00
|
|
|
int GetMem(const char *title, const FETCH fetch);
|
2023-12-28 13:21:23 +00:00
|
|
|
int GetModel(const char *title, const FETCH fetch);
|
2024-01-03 11:10:52 +00:00
|
|
|
int GetHostname(const char *title, const FETCH fetch);
|
2024-01-03 12:09:07 +00:00
|
|
|
int GetAVG(const char *title, const FETCH fetch);
|
2023-11-02 14:51:10 +00:00
|
|
|
|
|
|
|
#endif
|