diff --git a/.gitignore b/.gitignore index 00aa3ff..98f73e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -uwufetch +uwufetch \ No newline at end of file diff --git a/Makefile b/Makefile index 98400a1..eac15aa 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,13 @@ build: uwufetch.c install: sudo cp $(NAME) $(INSTALL_DIR)$(NAME) - mkdir ~/.config/uwufetch/ - cp res/* ~/.config/uwufetch/ + ls /usr/lib/uwufetch/ > /dev/null || sudo mkdir /usr/lib/uwufetch/ + sudo cp res/* /usr/lib/uwufetch/ uninstall: sudo rm $(INSTALL_DIR)$(NAME) - rm -rf ~/.config/uwufetch + sudo rm -rf /usr/lib/uwufetch/ + +debug: build install + clear + ./uwufetch \ No newline at end of file diff --git a/README.md b/README.md index 2d3a9c2..8d34a89 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A meme system info tool for Linux, based on nyan/UwU trend on r/linuxmasterrace. ## Currently supported distros -Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, Myanjaro. +Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, GentOwO, Myanjawo. ## Building and installation @@ -20,6 +20,9 @@ To uninstall: cd uwufetch make uninstall ``` +## Images + +[IMAGES.md](https://github.com/TheDarkBug/uwufetch/tree/main/res/IMAGES.md) ## License This program is provided under the [GPL-3.0 License](https://github.com/TheDarkBug/uwufetch/LICENSE). diff --git a/res/IMAGES.md b/res/IMAGES.md new file mode 100644 index 0000000..50bd0a6 --- /dev/null +++ b/res/IMAGES.md @@ -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 + +image Nyarch Linuwu by u/Ishaan_P ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxfg9j/someone_posted_uwuntu_so_i_made_nyarch/)) +image Nyartix Linuwu by u/akzcake ([here](https://www.reddit.com/r/linuxmasterrace/comments/ly6wd1/nyartix/)) +image Debinyan by u/Ishaan_P ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxqip4/debinyan/)) +image Endowo Os by u/zuru2003 ([here](https://www.reddit.com/r/linuxmasterrace/comments/ly9zed/endowo_os/)) +image Fedowa by u/iD3nis124 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxjp3s/saw_nyarch_and_had_to_do_fedowa/)) +image GentOwO by u/Abbix57 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lyeija/gentowo/)) +image Myanjawo by u/matrixrunner ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxx9h7/myanjawo_also_in_wallpaper/)) +image 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/)) +image KDE Uwon by u/muff2 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxt82v/kde_uwon/)) +image NwnixOS by u/ant-artica ([here](https://www.reddit.com/r/linuxmasterrace/comments/lzdwl4/nixowos/)) +image OwOsuse by u/VortexAcherontic ([here](https://www.reddit.com/r/linuxmasterrace/comments/lyhgxp/my_better_attempt_on_owosuse/)) +image Pop UwUs by u/Mochimo786 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxz3xu/pop_uwus/)) +image Slawkyware by u/theldus ([here](https://www.reddit.com/r/linuxmasterrace/comments/lyt6xi/slawckyware/)) +image Sowus by u/welpelp ([here](https://www.reddit.com/r/linuxmasterrace/comments/ly9il3/continuing_the_trend_i_made_sowus_my_first/)) +image Tuwu by u/Annual-Examination96 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lz2i32/tuwu/)) +image Uwuntu by u/Chicki2D ([here](https://www.reddit.com/r/linuxmasterrace/comments/lwsnul/uwuntu/)) +image Owoid by u/Satoqz ([here](https://www.reddit.com/r/linuxmasterrace/comments/lxnjwd/my_boyfriend_decided_to_create_owoid/)) diff --git a/res/artix.png b/res/artix.png new file mode 100644 index 0000000..851e61c Binary files /dev/null and b/res/artix.png differ diff --git a/res/debian.png b/res/debian.png new file mode 100644 index 0000000..47973a0 Binary files /dev/null and b/res/debian.png differ diff --git a/res/endeavour.png b/res/endeavour.png new file mode 100644 index 0000000..08aa9fb Binary files /dev/null and b/res/endeavour.png differ diff --git a/res/fedora.png b/res/fedora.png new file mode 100644 index 0000000..cfa767f Binary files /dev/null and b/res/fedora.png differ diff --git a/res/gentoo.png b/res/gentoo.png new file mode 100644 index 0000000..c673a0b Binary files /dev/null and b/res/gentoo.png differ diff --git a/res/manjaro.png b/res/manjaro.png new file mode 100644 index 0000000..d3f867b Binary files /dev/null and b/res/manjaro.png differ diff --git a/res/mint.png b/res/mint.png new file mode 100644 index 0000000..6e15dcb Binary files /dev/null and b/res/mint.png differ diff --git a/res/neon.png b/res/neon.png new file mode 100644 index 0000000..94c1f04 Binary files /dev/null and b/res/neon.png differ diff --git a/res/nixos.png b/res/nixos.png new file mode 100644 index 0000000..f7123a9 Binary files /dev/null and b/res/nixos.png differ diff --git a/res/opensuse.png b/res/opensuse.png new file mode 100644 index 0000000..631c608 Binary files /dev/null and b/res/opensuse.png differ diff --git a/res/pop_os.png b/res/pop_os.png new file mode 100644 index 0000000..9a51f10 Binary files /dev/null and b/res/pop_os.png differ diff --git a/res/slackware.png b/res/slackware.png new file mode 100644 index 0000000..0971275 Binary files /dev/null and b/res/slackware.png differ diff --git a/res/solus.png b/res/solus.png new file mode 100644 index 0000000..cf35873 Binary files /dev/null and b/res/solus.png differ diff --git a/res/tux.png b/res/tux.png new file mode 100644 index 0000000..3d24244 Binary files /dev/null and b/res/tux.png differ diff --git a/res/ubuntu.png b/res/ubuntu.png new file mode 100644 index 0000000..4068ade Binary files /dev/null and b/res/ubuntu.png differ diff --git a/res/void.png b/res/void.png new file mode 100644 index 0000000..3702aa7 Binary files /dev/null and b/res/void.png differ diff --git a/uwufetch.c b/uwufetch.c index d03bb4b..a788043 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -28,14 +28,34 @@ void get_info(); void print_ascii(); void print_info(); void print_image(); +void usage(char*); int main(int argc, char *argv[]) { + int opt = 0, a_i_flag = 0; get_info(); - //sprintf(version_name, "%s", "manjaro"); // a debug thing - //char c = getopt(argc, argv, "adhi"); // things for the future - print_ascii(); - //system("viu -t -w 18 -h 8 $HOME/.config/uwufetch/arch.png"); // other things for the future - print_info(); + //sprintf(version_name, "%s", "debian"); // a debug thing + + while((opt = getopt(argc, argv, "ad:hi")) != -1) { + 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(); } int pkgman() { // this is just a function that returns the total of installed packages @@ -60,29 +80,29 @@ int pkgman() { // this is just a function that returns the total of installed pa fscanf(file[6], "%d", &rpm); fscanf(file[7], "%d", &xbps); for (int i = 0; i < 8; i++) fclose(file[i]); - - if (apt > 0) { total += apt; snprintf(pkgman_name, 64, "(%s)", "apt"); } - if (dnf > 0) { total += dnf; snprintf(pkgman_name, 64, "(%s)", "dnf"); } - if (emerge > 0) { total += emerge; snprintf(pkgman_name, 64, "(%s)", "emerge"); } - if (flatpak > 0) { total += flatpak; snprintf(pkgman_name, 64, "(%s)", "flatpak"); } - if (nix > 0) { total += nix; snprintf(pkgman_name, 64, "(%s)", "nix"); } - if (pacman > 0) { total += pacman; snprintf(pkgman_name, 64, "(%s)", "pacman"); } - if (rpm > 0) { total += rpm; snprintf(pkgman_name, 64, "(%s)", "rpm"); } - if (xbps > 0) { total += xbps; snprintf(pkgman_name, 64, "(%s)", "xbps"); } + + if (apt > 0) { total += apt; strcat(pkgman_name, "(apt)"); } + if (dnf > 0) { total += dnf; strcat(pkgman_name, "(dnf)"); } + if (emerge > 0) { total += emerge; strcat(pkgman_name, "(emerge)"); } + if (flatpak > 0) { total += flatpak; strcat(pkgman_name, "(flatpak)"); } + if (nix > 0) { total += nix; strcat(pkgman_name, "(nix)"); } + if (pacman > 0) { total += pacman; strcat(pkgman_name, "(pacman)"); } + if (rpm > 0) { total += rpm; strcat(pkgman_name, "(rpm)"); } + if (xbps > 0) { total += xbps; strcat(pkgman_name, "(xbps)"); } - return total; + return total; } void print_info() { // print collected info - printf("\033[2;18H %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[4;18H %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[6;18H %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[8;18H %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[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[9A\033[17C %s%s%s@%s\n", NORMAL, BOLD, user, host); + printf("\033[17C %s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name); + printf("\033[17C %s%sKERNEL %s%s %s\n", NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine); + printf("\033[17C %s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model); + printf("\033[17C %s%sWAM %s%ldM/%iM\n", NORMAL, BOLD, NORMAL, r_usage.ru_maxrss, ram_max); + printf("\033[17C %s%sSHELL %s%s\n", NORMAL, BOLD, NORMAL, shell); + printf("\033[17C %s%sPKGS %s%s%d %s\n", NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name); + 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[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 @@ -94,15 +114,16 @@ void get_info() { // get all necessary info memmove(&shell[0], &shell[5], 16); // 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); fclose(fos_rel); + // system info 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"); // 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); fclose(fcpu); ram_max = sys.totalram * sys.mem_unit / 1048576; @@ -110,36 +131,36 @@ void get_info() { // get all necessary info 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) { sprintf(version_name, "%s", "Nyarch Linuwu"); - printf( "\033[3;9H%s/\\\n" + printf( "\033[1E\033[8C%s/\\\n" " / \\\n" " /\\ \\\n" " / > w <\\\n" " / __ \\\n" " / __| |__-\\\n" - " /_-'' ''-_\\\n", BLUE); + " /_-'' ''-_\\\n\n", BLUE); } else if (strcmp(version_name, "artix") == 0) { sprintf(version_name, "%s", "Nyartix Linuwu"); - printf( "\033[3;9H%s/\\\n" + printf( "\033[1E\033[8C%s/\\\n" " / \\\n" " /`'.,\\\n" " /\u2022 w \u2022 \\\n" " / ,`\\\n" " / ,.'`. \\\n" - " /.,'` `'.\\\n", BLUE); + " /.,'` `'.\\\n\n", BLUE); } else if (strcmp(version_name, "debian") == 0) { sprintf(version_name, "%s", "Debinyan"); - printf( "\033[3;7H%s______\n" + printf( "\033[1E\033[6C%s______\n" " / ___ \\\n" " | / OwO |\n" " | \\____-\n" " -_\n" - " --_\n", RED); + " --_\n\n\n", RED); } else if (strcmp(version_name, "fedora") == 0) { - sprintf(version_name, "%s", "Fedowora"); - printf( "\033[2;9H%s_____\n" + sprintf(version_name, "%s", "Fedowoa"); + printf( "\033[1E\033[8C%s_____\n" " / __)%s\\\n" " %s> %s| / %s<%s\\ \\\n" " __%s_| %sw%s|_%s_/ /\n" @@ -147,9 +168,18 @@ void print_ascii() { " / / %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); + } 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) { - sprintf(version_name, "%s", "Myanjaro"); - printf( " \u25b3 \u25b3 \u25e0\u25e0\u25e0\u25e0\n" + sprintf(version_name, "%s", "Myanjawo"); + 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[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" @@ -158,4 +188,27 @@ 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"); } -} \ No newline at end of file +} +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 \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" + " for more info%s\n", + arg, YELLOW, NORMAL, BLUE, NORMAL); +}