add themes
This commit is contained in:
parent
7ab3e8ef0c
commit
a3a17c2b8b
11 changed files with 163 additions and 26 deletions
43
src/fetch.c
43
src/fetch.c
|
@ -103,15 +103,6 @@ int PrintOs(const char *title, const FETCH fetch) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int PrintColors(const char *title, const FETCH fetch) {
|
||||
printf("%s%s%s", fetch.color, title, fetch.font_color);
|
||||
|
||||
for (int i = 1; i < 7; i++)
|
||||
printf("\033[1;3%dm%s\033[0m ", i, PC_CHAR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Blank(const char *title, const FETCH fetch) {
|
||||
printf("%s%s%s", fetch.color, title, fetch.font_color);
|
||||
return 0;
|
||||
|
@ -195,14 +186,22 @@ int GetMem(const char *title, const FETCH fetch) {
|
|||
if (fp == NULL)
|
||||
return 1;
|
||||
|
||||
off_t unused = 0, total = 0, available = 0;
|
||||
if (fscanf(fp, "MemTotal: %lu kB\nMemFree: %lu kB\nMemAvailable: %lu kB", &total, &unused, &available) < 0)
|
||||
off_t free = 0, total = 0;
|
||||
if (fscanf(fp, "MemTotal: %lu kB\nMemFree: %lu kB", &total, &free) < 0)
|
||||
return 1;
|
||||
|
||||
UNUSED(unused);
|
||||
printf("%s%s%s%lumb / %lumb", fetch.color, title, fetch.font_color, (uintmax_t)(total - available) / 1024, (uintmax_t)total / 1024);
|
||||
fclose(fp);
|
||||
#ifdef PRINT_USED_AND_TOTAL_MEM
|
||||
printf("%s%s%s%lumb / %lumb", fetch.color, title, fetch.font_color, (uintmax_t)(total - free) / 1024, (uintmax_t)total / 1024);
|
||||
|
||||
#elif PRINT_TOTALMEM
|
||||
printf("%s%s%s%lumb", fetch.color, title, fetch.font_color, (uintmax_t)total / 1024);
|
||||
|
||||
#else
|
||||
printf("%s%s%s%lumb", fetch.color, title, fetch.font_color, (uintmax_t)(total - free) / 1024);
|
||||
|
||||
#endif
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -241,3 +240,19 @@ int GetHostname(const char *title, const FETCH fetch) {
|
|||
printf("%s%s%s%s", fetch.color, title, fetch.font_color, hostname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetAVG(const char *title, const FETCH fetch) {
|
||||
#ifndef __ANDROID__
|
||||
double avg[3] = {0, 0, 0};
|
||||
|
||||
if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0)
|
||||
return 1;
|
||||
|
||||
printf("%s%s%s%.2f %.2f %.2f", fetch.color, title, fetch.font_color, avg[0], avg[1], avg[2]);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
return 1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define _MAIN_H
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <string.h>
|
||||
#include "fetch.h"
|
||||
#include "config.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue