From bdfb4b6423dee660fdf8edb05adda7bd25024d2d Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 15 Jan 2024 21:37:52 +0300 Subject: [PATCH] linux mint add --- config.h | 4 ++++ include/fetch.h | 2 ++ include/logo.h | 12 ++++++++++++ src/fetch.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/config.h b/config.h index b1c0643..573ba0c 100644 --- a/config.h +++ b/config.h @@ -33,6 +33,10 @@ PARAMETR CONFIG[] = { {" host ", GetHostname}, {" lAVG ", GetAVG}, {" batt ", GetBattery}, + + {" tty ", eBlank}, + {"tty | xargs basename", Execute}, + {" ", Blank}, {COLORS, Blank} }; diff --git a/include/fetch.h b/include/fetch.h index eba8dcd..68a95d5 100644 --- a/include/fetch.h +++ b/include/fetch.h @@ -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 diff --git a/include/logo.h b/include/logo.h index 1983938..abdad17 100644 --- a/include/logo.h +++ b/include/logo.h @@ -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 | ", diff --git a/src/fetch.c b/src/fetch.c index 17bb738..ac1af5d 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -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; +}