Merge pull request #1 from TheDarkBug/main

update main
This commit is contained in:
Joe Todd 2021-03-07 19:13:07 +00:00 committed by GitHub
commit 19aa8ff810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 127 additions and 43 deletions

View file

@ -9,9 +9,13 @@ build: uwufetch.c
install: install:
sudo cp $(NAME) $(INSTALL_DIR)$(NAME) sudo cp $(NAME) $(INSTALL_DIR)$(NAME)
mkdir ~/.config/uwufetch/ ls /usr/lib/uwufetch/ > /dev/null || sudo mkdir /usr/lib/uwufetch/
cp res/* ~/.config/uwufetch/ sudo cp res/* /usr/lib/uwufetch/
uninstall: uninstall:
sudo rm $(INSTALL_DIR)$(NAME) sudo rm $(INSTALL_DIR)$(NAME)
rm -rf ~/.config/uwufetch sudo rm -rf /usr/lib/uwufetch/
debug: build install
clear
./uwufetch

View file

@ -4,7 +4,7 @@ A meme system info tool for Linux, based on nyan/UwU trend on r/linuxmasterrace.
## Currently supported distros ## Currently supported distros
Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, Myanjaro. Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, GentOwO, Myanjawo.
## Building and installation ## Building and installation
@ -20,6 +20,9 @@ To uninstall:
cd uwufetch cd uwufetch
make uninstall make uninstall
``` ```
## Images
[IMAGES.md](https://github.com/TheDarkBug/uwufetch/tree/main/res/IMAGES.md)
## License ## License
This program is provided under the [GPL-3.0 License](https://github.com/TheDarkBug/uwufetch/LICENSE). This program is provided under the [GPL-3.0 License](https://github.com/TheDarkBug/uwufetch/LICENSE).

24
res/IMAGES.md Normal file
View file

@ -0,0 +1,24 @@
# Image logos
Int this directory, all the images for the logos, are stored.
If you want to remove *your* image from this repository contact me on [reddit](https://www.reddit.com/user/TheDarkBug).
## Credits
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/arch.png" title="" alt="image" width="200"> Nyarch Linuwu by u/Ishaan_P ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxfg9j/someone_posted_uwuntu_so_i_made_nyarch/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/artix.png" title="" alt="image" width="200"> Nyartix Linuwu by u/akzcake ([here](https://www.reddit.com/r/linuxmasterrace/comments/ly6wd1/nyartix/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/debian.png" title="" alt="image" width="200"> Debinyan by u/Ishaan_P ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxqip4/debinyan/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/endeavour.png" title="" alt="image" width="200"> Endowo Os by u/zuru2003 ([here](https://www.reddit.com/r/linuxmasterrace/comments/ly9zed/endowo_os/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/fedora.png" title="" alt="image" width="200"> Fedowa by u/iD3nis124 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxjp3s/saw_nyarch_and_had_to_do_fedowa/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/gentoo.png" title="" alt="image" width="200"> GentOwO by u/Abbix57 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lyeija/gentowo/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/manjaro.png" title="" alt="image" width="200"> Myanjawo by u/matrixrunner ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxx9h7/myanjawo_also_in_wallpaper/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/mint.png" title="" alt="image" width="200"> Miwint by u/iD3nis124 ([here](https://www.reddit.com/r/linuxmasterrace/comments/ly8oy0/seen_a_lot_of_people_asking_for_mint_so_here_it_is/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/neon.png" title="" alt="image" width="200"> KDE Uwon by u/muff2 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxt82v/kde_uwon/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/nixos.png" title="" alt="image" width="200"> NwnixOS by u/ant-artica ([here](https://www.reddit.com/r/linuxmasterrace/comments/lzdwl4/nixowos/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/opensuse.png" title="" alt="image" width="200"> OwOsuse by u/VortexAcherontic ([here](https://www.reddit.com/r/linuxmasterrace/comments/lyhgxp/my_better_attempt_on_owosuse/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/pop_os.png" title="" alt="image" width="200"> Pop UwUs by u/Mochimo786 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxz3xu/pop_uwus/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/slackware.png" title="" alt="image" width="200"> Slawkyware by u/theldus ([here](https://www.reddit.com/r/linuxmasterrace/comments/lyt6xi/slawckyware/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/solus.png" title="" alt="image" width="200"> Sowus by u/welpelp ([here](https://www.reddit.com/r/linuxmasterrace/comments/ly9il3/continuing_the_trend_i_made_sowus_my_first/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/tux.png" title="" alt="image" width="200"> Tuwu by u/Annual-Examination96 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lz2i32/tuwu/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/ubuntu.png" title="" alt="image" width="200"> Uwuntu by u/Chicki2D ([here](https://www.reddit.com/r/linuxmasterrace/comments/lwsnul/uwuntu/))
<img src="https://raw.githubusercontent.com/TheDarkBug/uwufetch/main/res/void.png" title="" alt="image" width="200"> Owoid by u/Satoqz ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxnjwd/my_boyfriend_decided_to_create_owoid/))

BIN
res/artix.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
res/debian.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
res/endeavour.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
res/fedora.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

BIN
res/gentoo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
res/manjaro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

BIN
res/mint.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
res/neon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
res/nixos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

BIN
res/opensuse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
res/pop_os.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
res/slackware.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

BIN
res/solus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
res/tux.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
res/ubuntu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
res/void.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

View file

@ -28,13 +28,33 @@ void get_info();
void print_ascii(); void print_ascii();
void print_info(); void print_info();
void print_image(); void print_image();
void usage(char*);
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int opt = 0, a_i_flag = 0;
get_info(); get_info();
//sprintf(version_name, "%s", "manjaro"); // a debug thing //sprintf(version_name, "%s", "debian"); // a debug thing
//char c = getopt(argc, argv, "adhi"); // things for the future
print_ascii(); while((opt = getopt(argc, argv, "ad:hi")) != -1) {
//system("viu -t -w 18 -h 8 $HOME/.config/uwufetch/arch.png"); // other things for the future switch(opt) {
case 'a':
a_i_flag = 0;
break;
case 'd':
if (optarg) sprintf(version_name, "%s", optarg);
break;
case 'h':
usage(argv[0]);
return 0;
case 'i':
a_i_flag = 1;
break;
default:
break;
}
}
if (argc == 1 || a_i_flag == 0) print_ascii();
else if (a_i_flag) print_image();
print_info(); print_info();
} }
@ -61,28 +81,28 @@ int pkgman() { // this is just a function that returns the total of installed pa
fscanf(file[7], "%d", &xbps); fscanf(file[7], "%d", &xbps);
for (int i = 0; i < 8; i++) fclose(file[i]); for (int i = 0; i < 8; i++) fclose(file[i]);
if (apt > 0) { total += apt; snprintf(pkgman_name, 64, "(%s)", "apt"); } if (apt > 0) { total += apt; strcat(pkgman_name, "(apt)"); }
if (dnf > 0) { total += dnf; snprintf(pkgman_name, 64, "(%s)", "dnf"); } if (dnf > 0) { total += dnf; strcat(pkgman_name, "(dnf)"); }
if (emerge > 0) { total += emerge; snprintf(pkgman_name, 64, "(%s)", "emerge"); } if (emerge > 0) { total += emerge; strcat(pkgman_name, "(emerge)"); }
if (flatpak > 0) { total += flatpak; snprintf(pkgman_name, 64, "(%s)", "flatpak"); } if (flatpak > 0) { total += flatpak; strcat(pkgman_name, "(flatpak)"); }
if (nix > 0) { total += nix; snprintf(pkgman_name, 64, "(%s)", "nix"); } if (nix > 0) { total += nix; strcat(pkgman_name, "(nix)"); }
if (pacman > 0) { total += pacman; snprintf(pkgman_name, 64, "(%s)", "pacman"); } if (pacman > 0) { total += pacman; strcat(pkgman_name, "(pacman)"); }
if (rpm > 0) { total += rpm; snprintf(pkgman_name, 64, "(%s)", "rpm"); } if (rpm > 0) { total += rpm; strcat(pkgman_name, "(rpm)"); }
if (xbps > 0) { total += xbps; snprintf(pkgman_name, 64, "(%s)", "xbps"); } if (xbps > 0) { total += xbps; strcat(pkgman_name, "(xbps)"); }
return total; return total;
} }
void print_info() { // print collected info void print_info() { // print collected info
printf("\033[2;18H %s%s%s@%s\n", NORMAL, BOLD, user, host); printf("\033[9A\033[17C %s%s%s@%s\n", NORMAL, BOLD, user, host);
printf("\033[3;18H %s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name); printf("\033[17C %s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name);
printf("\033[4;18H %s%sKERNEL %s%s %s\n", NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine); printf("\033[17C %s%sKERNEL %s%s %s\n", NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine);
printf("\033[5;18H %s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model); printf("\033[17C %s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model);
printf("\033[6;18H %s%sWAM %s%ldM/%iM\n", NORMAL, BOLD, NORMAL, r_usage.ru_maxrss, ram_max); printf("\033[17C %s%sWAM %s%ldM/%iM\n", NORMAL, BOLD, NORMAL, r_usage.ru_maxrss, ram_max);
printf("\033[7;18H %s%sSHELL %s%s\n", NORMAL, BOLD, NORMAL, shell); printf("\033[17C %s%sSHELL %s%s\n", NORMAL, BOLD, NORMAL, shell);
printf("\033[8;18H %s%sPKGS %s%s%d %s\n", NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name); printf("\033[17C %s%sPKGS %s%s%d %s\n", NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name);
printf("\033[9;18H %s%sUWUPTIME %s%lid, %lih, %lim\n", NORMAL, BOLD, NORMAL, sys.uptime/60/60/24, sys.uptime/60/60%24, sys.uptime/60%60); printf("\033[17C %s%sUWUPTIME %s%lid, %lih, %lim\n", NORMAL, BOLD, NORMAL, sys.uptime/60/60/24, sys.uptime/60/60%24, sys.uptime/60%60);
printf("\033[10;18H %s%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\n", BOLD, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, NORMAL); printf("\033[17C %s%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\n", BOLD, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, NORMAL);
} }
void get_info() { // get all necessary info void get_info() { // get all necessary info
@ -94,15 +114,16 @@ void get_info() { // get all necessary info
memmove(&shell[0], &shell[5], 16); memmove(&shell[0], &shell[5], 16);
// os version // os version
FILE *fos_rel = popen("cut -d '=' -f2 <<< $(cat /etc/os-release | grep ID=) 2> /dev/null", "r"); FILE *fos_rel = popen("cat /etc/os-release | awk '/^ID=/' | awk -F '=' '{print $2}' 2> /dev/null", "r");
fscanf(fos_rel,"%[^\n]", version_name); fscanf(fos_rel,"%[^\n]", version_name);
fclose(fos_rel); fclose(fos_rel);
// system info
if (uname(&sys_var) == -1) printf("There was some kind of error while getting the username\n"); if (uname(&sys_var) == -1) printf("There was some kind of error while getting the username\n");
if (sysinfo(&sys) == -1) printf("There was some kind of error while getting system info\n"); if (sysinfo(&sys) == -1) printf("There was some kind of error while getting system info\n");
// cpu and ram // cpu and ram
FILE *fcpu = popen("sed 's/ //g' <<< $(cut -d ':' -f2 <<< $(lscpu | grep 'Model name:')) 2> /dev/null", "r"); FILE *fcpu = popen("lscpu | grep 'Model name:' | cut -d ':' -f2 | sed 's/ //g' 2> /dev/null", "r");
fscanf(fcpu, "%[^\n]", cpu_model); fscanf(fcpu, "%[^\n]", cpu_model);
fclose(fcpu); fclose(fcpu);
ram_max = sys.totalram * sys.mem_unit / 1048576; ram_max = sys.totalram * sys.mem_unit / 1048576;
@ -110,36 +131,36 @@ void get_info() { // get all necessary info
pkgs = pkgman(); pkgs = pkgman();
} }
void print_ascii() { void print_ascii() { // prints logo (as ascii art) of the given system. distributions listed alphabetically.
if (strcmp(version_name, "arch") == 0) { if (strcmp(version_name, "arch") == 0) {
sprintf(version_name, "%s", "Nyarch Linuwu"); sprintf(version_name, "%s", "Nyarch Linuwu");
printf( "\033[3;9H%s/\\\n" printf( "\033[1E\033[8C%s/\\\n"
" / \\\n" " / \\\n"
" /\\ \\\n" " /\\ \\\n"
" / > w <\\\n" " / > w <\\\n"
" / __ \\\n" " / __ \\\n"
" / __| |__-\\\n" " / __| |__-\\\n"
" /_-'' ''-_\\\n", BLUE); " /_-'' ''-_\\\n\n", BLUE);
} else if (strcmp(version_name, "artix") == 0) { } else if (strcmp(version_name, "artix") == 0) {
sprintf(version_name, "%s", "Nyartix Linuwu"); sprintf(version_name, "%s", "Nyartix Linuwu");
printf( "\033[3;9H%s/\\\n" printf( "\033[1E\033[8C%s/\\\n"
" / \\\n" " / \\\n"
" /`'.,\\\n" " /`'.,\\\n"
" /\u2022 w \u2022 \\\n" " /\u2022 w \u2022 \\\n"
" / ,`\\\n" " / ,`\\\n"
" / ,.'`. \\\n" " / ,.'`. \\\n"
" /.,'` `'.\\\n", BLUE); " /.,'` `'.\\\n\n", BLUE);
} else if (strcmp(version_name, "debian") == 0) { } else if (strcmp(version_name, "debian") == 0) {
sprintf(version_name, "%s", "Debinyan"); sprintf(version_name, "%s", "Debinyan");
printf( "\033[3;7H%s______\n" printf( "\033[1E\033[6C%s______\n"
" / ___ \\\n" " / ___ \\\n"
" | / OwO |\n" " | / OwO |\n"
" | \\____-\n" " | \\____-\n"
" -_\n" " -_\n"
" --_\n", RED); " --_\n\n\n", RED);
} else if (strcmp(version_name, "fedora") == 0) { } else if (strcmp(version_name, "fedora") == 0) {
sprintf(version_name, "%s", "Fedowora"); sprintf(version_name, "%s", "Fedowoa");
printf( "\033[2;9H%s_____\n" printf( "\033[1E\033[8C%s_____\n"
" / __)%s\\\n" " / __)%s\\\n"
" %s> %s| / %s<%s\\ \\\n" " %s> %s| / %s<%s\\ \\\n"
" __%s_| %sw%s|_%s_/ /\n" " __%s_| %sw%s|_%s_/ /\n"
@ -147,9 +168,18 @@ void print_ascii() {
" / / %s| |\n" " / / %s| |\n"
" %s\\ \\%s__/ |\n" " %s\\ \\%s__/ |\n"
" %s\\%s(_____/\n", BLUE, CYAN, WHITE, BLUE, WHITE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE); " %s\\%s(_____/\n", BLUE, CYAN, WHITE, BLUE, WHITE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE, CYAN, BLUE);
} else if (strcmp(version_name, "gentoo") == 0) {
sprintf(version_name, "%s", "GentOwO");
printf( "\033[1E\033[3C%s_-----_\n"
" ( \\\n"
" \\ OwO \\\n"
"%s \\ )\n"
" / _/\n"
" ( _-\n"
" \\____-\n\n", MAGENTA, WHITE);
} else if (strcmp(version_name, "manjaro") == 0) { } else if (strcmp(version_name, "manjaro") == 0) {
sprintf(version_name, "%s", "Myanjaro"); sprintf(version_name, "%s", "Myanjawo");
printf( " \u25b3 \u25b3 \u25e0\u25e0\u25e0\u25e0\n" printf( "\033[0E\033[1C\u25b3 \u25b3 \u25e0\u25e0\u25e0\u25e0\n"
" \e[0;42m \e[0m \e[0;42m \e[0m\n" " \e[0;42m \e[0m \e[0;42m \e[0m\n"
" \e[0;42m \e[0m\e[0;42m\e[1;30m > w < \e[0m\e[0;42m \e[0m \e[0;42m \e[0m\n" " \e[0;42m \e[0m\e[0;42m\e[1;30m > w < \e[0m\e[0;42m \e[0m \e[0;42m \e[0m\n"
" \e[0;42m \e[0m \e[0;42m \e[0m\n" " \e[0;42m \e[0m \e[0;42m \e[0m\n"
@ -159,3 +189,26 @@ void print_ascii() {
" \e[0;42m \e[0m \e[0;42m \e[0m \e[0;42m \e[0m\n"); " \e[0;42m \e[0m \e[0;42m \e[0m \e[0;42m \e[0m\n");
} }
} }
void print_image() { // prints logo (as an image) of the given system. distributions listed alphabetically.
char command[256];
sprintf(command, "viu -t -w 18 -h 8 /usr/lib/uwufetch/%s.png", version_name);
system(command);
if (strcmp(version_name, "arch") == 0) sprintf(version_name, "%s", "Nyarch Linuwu");
if (strcmp(version_name, "artix") == 0) sprintf(version_name, "%s", "Nyartix Linuwu");
if (strcmp(version_name, "debian") == 0) sprintf(version_name, "%s", "Debinyan");
if (strcmp(version_name, "fedora") == 0) sprintf(version_name, "%s", "Fedowa");
if (strcmp(version_name, "gentoo") == 0) sprintf(version_name, "%s", "GentOwO");
if (strcmp(version_name, "manjaro") == 0) sprintf(version_name, "%s", "Myanjawo");
}
void usage(char* arg) {
printf("Usage: %s <args>\n"
" -a, --ascii prints logo as ascii text (default)\n"
" -d, --distro %slets you choose the logo to print%s\n"
" -h, --help prints this help page\n"
" -i, --image prints logo as image\n"
" %sworks in few terminals\n"
" <cat res/IMAGES.md> for more info%s\n",
arg, YELLOW, NORMAL, BLUE, NORMAL);
}