linux mint add

This commit is contained in:
Your Name 2024-01-15 21:37:52 +03:00
parent 363cd4c1d1
commit bdfb4b6423
4 changed files with 46 additions and 0 deletions

View File

@ -33,6 +33,10 @@ PARAMETR CONFIG[] = {
{" host ", GetHostname},
{" lAVG ", GetAVG},
{" batt ", GetBattery},
{" tty ", eBlank},
{"tty | xargs basename", Execute},
{" ", Blank},
{COLORS, Blank}
};

View File

@ -47,5 +47,7 @@ int GetModel(const char *title, const FETCH fetch);
int GetHostname(const char *title, const FETCH fetch);
int GetAVG(const char *title, const FETCH fetch);
int GetBattery(const char *title, const FETCH fetch);
int Execute(const char *title, const FETCH fetch);
int eBlank(const char *title, const FETCH fetch);
#endif

View File

@ -90,6 +90,18 @@ char *Ubuntu[] = {
" ",
};
char *Lmint[] = {
" ",
"\033[1;32m _____________ ",
"\033[1;32m |_ \\ ",
"\033[1;32m | | _____ | ",
"\033[1;32m | | | | | | ",
"\033[1;32m | | | | | | ",
"\033[1;32m | \\_____/ | ",
"\033[1;32m \\___________/ ",
" "
};
char *Unknow[] = {
"\033[1;36m ___ ",
"\033[1;36m (\033[0m..\033[1;36m | ",

View File

@ -86,6 +86,9 @@ void GetArt(FETCH *fetch, int flag) {
else if (strstr(fetch->os_name, "Ubuntu"))
SetArt(fetch, sizeof(Ubuntu), "dpkg -l | tail -n+6 | wc -l | tr -d ' '", Ubuntu, "\033[1;33m", flag);
else if (strstr(fetch->os_name, "Mint"))
SetArt(fetch, sizeof(Lmint), "dpkg -l | tail -n+6 | wc -l | tr -d ' '", Lmint, "\033[1;32m", flag);
else if (!chdir("/system") && !strcmp(fetch->os_name, "Linux"))
SetArt(fetch, sizeof(Android), "dpkg -l | tail -n+6 | wc -l | tr -d ' '", Android, "\033[32m", flag);
@ -302,3 +305,28 @@ int GetBattery(const char *title, const FETCH fetch) {
DrawBar(capacity, 100);
return 0;
}
int Execute(const char *title, const FETCH fetch) {
FILE *fp = popen(title, "r");
if (fp == NULL)
return 1;
printf("%s", fetch.font_color);
int c;
while ((c = getc(fp))) {
if (c == EOF || c == '\n')
break;
putchar(c);
}
pclose(fp);
return 0;
}
int eBlank(const char *title, const FETCH fetch) {
printf("%s%s%s", fetch.color, title, fetch.font_color);
return 1;
}