main.c fix logo print

This commit is contained in:
Your Name 2023-12-15 18:45:57 +03:00
parent e59cd1d2a0
commit 2f88885982
3 changed files with 14 additions and 8 deletions

View File

@ -9,7 +9,7 @@ typedef struct {
} PARAMETR;
/* Config, EDIT THERE */
#define FONT_COLOR "\033[37m"
#define FONT_COLOR "\033[1;37m"
#define PC_CHAR "%"
#ifdef _MAIN_H
@ -21,7 +21,7 @@ PARAMETR CONFIG[] = {
{" ARCH ", GetArch},
{" SHELL ", GetShell},
{" PKGS ", GetPkg},
{" RAM ", GetMem},
{" MEM ", GetMem},
{" ", Blank},
{" COLORS ", PrintColors}
};

View File

@ -121,7 +121,8 @@ int GetUser(const char *title, const FETCH fetch) {
int GetUptime(const char *title, const FETCH fetch) {
#ifdef CLOCK
struct timespec uptime;
clock_gettime(CLOCK, &uptime);
if (clock_gettime(CLOCK, &uptime) == -1)
return 1;
int days = uptime.tv_sec / 86400;
int hours = uptime.tv_sec / 3600;

View File

@ -6,19 +6,24 @@
int main(void) {
FETCH fetch = Init();
size_t i;
int flag = 0;
size_t i = 0;
for (i = 0; i < sizeof(CONFIG) / sizeof(PARAMETR); i++) {
if (i < fetch.logo_size)
if (i < fetch.logo_size && !flag)
printf("%s", fetch.logo[i]);
if (i >= fetch.logo_size)
if (i >= fetch.logo_size && !flag)
printf("%s", fetch.logo[fetch.logo_size - 1]);
if (!CONFIG[i].func(CONFIG[i].title, fetch))
if (!CONFIG[i].func(CONFIG[i].title, fetch)) {
flag = 0;
printf("\033[0m\n");
}
else
else {
flag = 1;
printf("\033[0m");
}
}
for (; i < fetch.logo_size; i++)