2021-02-18 22:25:36 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#ifndef FASTFETCH_INCLUDED
|
|
|
|
|
#define FASTFETCH_INCLUDED
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <pwd.h>
|
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
|
#include <sys/sysinfo.h>
|
|
|
|
|
|
|
|
|
|
#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-02-19 18:02:36 +01:00
|
|
|
typedef struct FFlogo
|
|
|
|
|
{
|
|
|
|
|
uint8_t width;
|
|
|
|
|
uint8_t height;
|
|
|
|
|
char chars[256][256];
|
|
|
|
|
char name[128];
|
|
|
|
|
char color[10];
|
|
|
|
|
} FFlogo;
|
|
|
|
|
|
2021-02-18 22:25:36 +01:00
|
|
|
typedef struct FFstate
|
|
|
|
|
{
|
2021-02-22 16:52:51 +01:00
|
|
|
//Actual state stuff
|
2021-02-18 22:25:36 +01:00
|
|
|
uint8_t current_row;
|
|
|
|
|
|
2021-02-22 16:52:51 +01:00
|
|
|
//Configuration stuff
|
2021-02-19 18:02:36 +01:00
|
|
|
FFlogo logo;
|
2021-02-20 20:12:57 +01:00
|
|
|
uint16_t logo_seperator;
|
2021-02-18 22:25:36 +01:00
|
|
|
char color[10];
|
2021-02-22 16:52:51 +01:00
|
|
|
uint8_t titleLength;
|
2021-02-19 16:23:41 +01:00
|
|
|
bool showErrors;
|
2021-02-22 16:52:51 +01:00
|
|
|
bool recache;
|
2021-02-19 16:23:41 +01:00
|
|
|
|
2021-02-22 16:52:51 +01:00
|
|
|
//Common stuff
|
2021-02-18 22:25:36 +01:00
|
|
|
struct passwd* passwd;
|
|
|
|
|
struct utsname utsname;
|
2021-02-22 16:52:51 +01:00
|
|
|
struct sysinfo sysinfo;
|
2021-02-18 22:25:36 +01:00
|
|
|
} FFstate;
|
|
|
|
|
|
|
|
|
|
//Helper functions
|
|
|
|
|
void ffPrintLogoLine(FFstate* state);
|
|
|
|
|
void ffPrintKey(FFstate* state, const char* key);
|
|
|
|
|
void ffPrintLogoAndKey(FFstate* state, const char* key);
|
|
|
|
|
void ffParsePropFile(const char* file, const char* regex, char* buffer);
|
|
|
|
|
void ffParsePropFileHome(FFstate* state, const char* relativeFile, const char* regex, char* buffer);
|
|
|
|
|
void ffPrintGtkPretty(const char* gtk2, const char* gtk3, const char* gtk4);
|
2021-02-19 16:23:41 +01:00
|
|
|
void ffPrintError(FFstate* state, const char* key, const char* message);
|
2021-02-22 16:52:51 +01:00
|
|
|
bool ffPrintCachedValue(FFstate* state, const char* key);
|
|
|
|
|
void ffSaveCachedValue(FFstate* state, const char* key, const char* value);
|
2021-02-18 22:25:36 +01:00
|
|
|
|
|
|
|
|
void ffLoadLogoSet(FFstate* state, const char* logo);
|
|
|
|
|
void ffLoadLogo(FFstate* state);
|
2021-02-19 16:23:41 +01:00
|
|
|
void ffListLogos();
|
|
|
|
|
void ffPrintLogos();
|
2021-02-18 22:25:36 +01:00
|
|
|
|
|
|
|
|
void ffPrintBreak(FFstate* state);
|
|
|
|
|
void ffPrintTitle(FFstate* state);
|
|
|
|
|
void ffPrintSeperator(FFstate* state);
|
|
|
|
|
void ffPrintOS(FFstate* state);
|
|
|
|
|
void ffPrintHost(FFstate* state);
|
|
|
|
|
void ffPrintKernel(FFstate* state);
|
|
|
|
|
void ffPrintUptime(FFstate* state);
|
|
|
|
|
void ffPrintPackages(FFstate* state);
|
|
|
|
|
void ffPrintShell(FFstate* state);
|
|
|
|
|
void ffPrintResolution(FFstate* state);
|
|
|
|
|
void ffPrintDesktopEnvironment(FFstate* state);
|
|
|
|
|
void ffPrintTheme(FFstate* state);
|
|
|
|
|
void ffPrintIcons(FFstate* state);
|
|
|
|
|
void ffPrintFont(FFstate* state);
|
|
|
|
|
void ffPrintTerminal(FFstate* state);
|
|
|
|
|
void ffPrintCPU(FFstate* state);
|
|
|
|
|
void ffPrintGPU(FFstate* state);
|
|
|
|
|
void ffPrintMemory(FFstate* state);
|
|
|
|
|
void ffPrintDisk(FFstate* state);
|
|
|
|
|
void ffPrintBattery(FFstate* state);
|
|
|
|
|
void ffPrintLocale(FFstate* state);
|
|
|
|
|
void ffPrintColors(FFstate* state);
|
|
|
|
|
|
|
|
|
|
#endif
|