diff --git a/.gitignore b/.gitignore index 4119127..e708858 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ uwufetch *.zip *.vscode +*.gz +*.1 +.prettierrc \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c256dab --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,58 @@ +# Contributing to uwufetch + +## Code + +To contribute to this project, you should follow some rules to keep the code consistent: + +- Please try to be consistent in code formatting, if you use `Prettier`, this are the rules used in all the files: + +```json +{ + "arrowParens": "avoid", + "bracketSpacing": true, + "endOfLine": "lf", + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "jsxBracketSameLine": false, + "jsxSingleQuote": false, + "printWidth": 80, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": true, + "singleQuote": false, + "tabWidth": 4, + "trailingComma": "es5", + "useTabs": true, + "vueIndentScriptAndStyle": false +} +``` + +- Function and variable names should be written in snake_case and abbreviated if too long. +- Use shell commands only if necessary, just to improve `uwufetch` speed. + +# + +## Pull requests + +Before sending a pull request be sure that no one is already working on the same thing and to follow this guide-lines. + +With pull requests you can `[FIX]` a bug (reported or not), add `[OS-SUPPORT]`, add a `[NEW-FEATURE]` requested in an [issue](https://github.com/TheDarkBug/uwufetch/blob/main/CONTRIBUTING.md#issues), fix a `[TYPO]` or `[OPTIMIZE]` the code. For everything else do not use tags. + +# + +## Issues + +You can use the issues to report bugs with `[BUG]`, to request features `[FEATURE-REQUEST]`, to request support for an os `[OS-SUPPORT]`. For everything else do not use tags. + +If you are reporting a `[BUG]`, please include a screenshot and the output of the command (if a command is used in `uwufetch`). + +If you are requesting a feature, please specify if you are already working on it, then send a [pull request](https://github.com/TheDarkBug/uwufetch/blob/main/CONTRIBUTING.md#pull-requests). + +# + +## Conclusions + +I know that adding this file now is a bit late, but I am writing this anyway, just to appear as a _professional_ programmer, even though I am not. + +I woult take some space to thank all the [contributors](https://github.com/TheDarkBug/uwufetch/graphs/contributors) that made this project better every day. diff --git a/Makefile b/Makefile index 732d8db..7fd13db 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,41 @@ -NAME = uwufetch -FILES = uwufetch.c -FLAGS = -O3 -FLAGS_DEBUG = -Wall -Wextra -INSTALL_DIR = /usr/bin/ -all: build install +NAME = uwufetch +FILES = uwufetch.c +CFLAGS = -O3 +CFLAGS_DEBUG = -Wall -Wextra +PREFIX = /usr/bin +CC = cc +MAN_COMPILER = pandoc -build: uwufetch.c - gcc $(FLAGS) -o $(NAME) $(FILES) +build: $(FILES) + $(CC) $(CFLAGS) -o $(NAME) $(FILES) + $(MAN_COMPILER) $(NAME)_man.md -st man -o $(NAME).1 + @gzip $(NAME).1 debug: - clear - gcc $(FLAGS_DEBUG) -o $(NAME) $(FILES) + @clear + $(CC) $(CFLAGS_DEBUG) -o $(NAME) $(FILES) ./uwufetch install: - sudo cp $(NAME) $(INSTALL_DIR)$(NAME) - ls /usr/lib/uwufetch/ > /dev/null || sudo mkdir /usr/lib/uwufetch/ - sudo cp res/* /usr/lib/uwufetch/ + cp $(NAME) $(DESTDIR)$(PREFIX)/$(NAME) + ls $(DESTDIR)/usr/lib/uwufetch/ 2> /dev/null || mkdir $(DESTDIR)/usr/lib/uwufetch/ + cp res/* $(DESTDIR)/usr/lib/uwufetch/ + cp ./$(NAME).1.gz $(DESTDIR)/usr/share/man/man1/ uninstall: - sudo rm $(INSTALL_DIR)$(NAME) - sudo rm -rf /usr/lib/uwufetch/ + rm -f $(DESTDIR)$(PREFIX)/$(NAME) + rm -rf $(DESTDIR)/usr/lib/uwufetch/ + rm -rf $(DESTDIR)/usr/share/man/man1/$(NAME).1.gz termux: build - cp $(NAME) /data/data/com.termux/files$(INSTALL_DIR)$(NAME) - ls /data/data/com.termux/files/usr/lib/uwufetch/ > /dev/null || mkdir /data/data/com.termux/files/usr/lib/uwufetch/ + cp $(NAME) $(DESTDIR)/data/data/com.termux/files$(PREFIX)/$(NAME) + ls $(DESTDIR)/data/data/com.termux/files/usr/lib/uwufetch/ > /dev/null || mkdir $(DESTDIR)/data/data/com.termux/files/usr/lib/uwufetch/ cp res/* /data/data/com.termux/files/usr/lib/uwufetch/ - + termux_uninstall: - rm -rf /data/data/com.termux/files$(INSTALL_DIR)$(NAME) - rm -rf /data/data/com.termux/files/usr/lib/uwufetch/ + rm -rf $(DESTDIR)/data/data/com.termux/files$(PREFIX)/$(NAME) + rm -rf $(DESTDIR)/data/data/com.termux/files/usr/lib/uwufetch/ + +man_debug: build + @clear + @man -P cat ./uwufetch.1 diff --git a/README.md b/README.md index f842546..40a5cc2 100644 --- a/README.md +++ b/README.md @@ -4,50 +4,80 @@ A meme system info tool for (almost) all your Linux/Unix-based systems, based on ## Currently supported distros -Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, GentOwO, Miwint, Myanjawo, Pop OwOs, UwUntu, and OwOid; Plus Nyandroid; and FweeBSD, and OwOpenBSD. +#### Full support (Both Ascii art + images are provided for the given distribution) + +Nyalpine, Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, GentOwO, GnUwU gUwUix, Miwint, Myanjawo, OwOpenSUSE, Pop OwOs, RaspNyan, UwUntu, and OwOid; Plus Nyandroid. + +#### Partial support (Either no Ascii art, or no image is provided) + +endeavOwO, KDE NeOwOn, nixOwOs, Swackwawe, sOwOlus; Plus FweeBSD, and OwOpenBSD ## Building and installation +#### Requisites + +[viu](https://github.com/atanunq/viu) to use images instead of ascii art. + +[lshw](https://github.com/lyonel/lshw) to get gpu info. + ##### Via package manager Right now, the package is only available on the AUR: [![uwufetch](https://img.shields.io/aur/version/uwufetch?color=1793d1&label=uwufetch&logo=arch-linux&style=for-the-badge)](https://aur.archlinux.org/packages/uwufetch/) + [![uwufetch-git](https://img.shields.io/aur/version/uwufetch-git?color=1793d1&label=uwufetch-git&logo=arch-linux&style=for-the-badge)](https://aur.archlinux.org/packages/uwufetch-git/) ##### Via source +Building requisites: + +- Make +- A c compiler +- Pandoc to compile man pages + To install UwUfetch from the source, type these commands in the terminal: ```shell git clone https://github.com/TheDarkBug/uwufetch.git cd uwufetch -make +make build +sudo make install ``` To uninstall: ```shell cd uwufetch -make uninstall +sudo make uninstall ``` ##### Make options: ```shell -make all # builds and installs make build # builds uwueftch make debug # use for debug -make install # installs uwufetch -make uninstall # uninstalls uwufetch +make install # installs uwufetch (needs root permissons) +make uninstall # uninstalls uwufetch (needs root permissons) make termux # build and install for termux make termux_uninstall # uninstall for termux ``` -## Images +## Images and copyright info -[IMAGES.md](https://github.com/TheDarkBug/uwufetch/tree/main/res/IMAGES.md) +### How to use images + +First at all you need `viu`, to install it follow the [guide](https://github.com/atanunq/viu#installation). +Images are working in almost every terminal, for a better experience i recommend [kitty](https://github.com/kovidgoyal/kitty) + +### For copyright and logos info + +[COPYRIGHT.md](https://github.com/TheDarkBug/uwufetch/tree/main/res/COPYRIGHT.md) ## License This program is provided under the [GPL-3.0 License](https://github.com/TheDarkBug/uwufetch/LICENSE). + +# Contributing + +All kind of contribution are welcome, but before contributing please read [CONTRIBUTING.md](https://github.com/TheDarkBug/uwufetch/blob/main/CONTRIBUTING.md). diff --git "a/res/\"manjaro-arm\".png" "b/res/\"manjaro-arm\".png" new file mode 100644 index 0000000..d3f867b Binary files /dev/null and "b/res/\"manjaro-arm\".png" differ diff --git a/res/opensuse.png "b/res/\"opensuse-leap\".png" similarity index 100% rename from res/opensuse.png rename to "res/\"opensuse-leap\".png" diff --git a/res/void.png "b/res/\"void\".png" similarity index 100% rename from res/void.png rename to "res/\"void\".png" diff --git a/res/COPYRIGHT.md b/res/COPYRIGHT.md new file mode 100644 index 0000000..e9617af --- /dev/null +++ b/res/COPYRIGHT.md @@ -0,0 +1,390 @@ +# Introduction + +Int this directory, all the logo images, are stored. + +This file contains all copyright info for every image that `uwufetch` uses. If you want to remove _your_ image from this repository contact me on [reddit](https://www.reddit.com/user/TheDarkBug). +I am not a copyright expert, and maybe I am doing all wrong things, please correct this file if you notice something wrong. + +# Copyrights + +## Arch Linux + +image + +### Base artwork: + +- Copyright Holder: Arch Linux Devs +- License: [Arch Linux TrademarkPolicy](https://archlinux.org/art/) +- [Reference](https://wiki.archlinux.org/index.php/DeveloperWiki:TrademarkPolicy) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/Ishaan_P](https://www.reddit.com/user/Ishaan_P) +- License: No license, just a reddit post +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lxfg9j/someone_posted_uwuntu_so_i_made_nyarch/) + +# + +## Artix + +image + +### Base artwork: + +- Copyright Holder: Artix Linux Devs +- License: [Artix Brand Book](https://gitea.artixlinux.org/artix/artwork/src/branch/master/README.md) +- [Reference](https://gitea.artixlinux.org/artix/artwork) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/akzcake](https://www.reddit.com/user/akzcake) +- License: No license, just a reddit post +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/ly6wd1/nyartix/) + +# + +## Debian + +image + +### Base artwork: + +- Copyright Holder: Debian Devs +- License: LGPL3 +- [License URL](https://www.gnu.org/licenses/lgpl-3.0.html) +- [Reference](https://www.debian.org/logos/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/Ishaan_P](https://www.reddit.com/user/Ishaan_P) +- License: [LGPL3](https://www.gnu.org/licenses/lgpl-3.0.html) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lxqip4/debinyan/) + +# + +## Endeavour OS + +image + +### Base artwork: + +- Copyright Holder: Endeavour OS Devs +- License: [No license was mentioned on the website](https://endeavouros.com/endeavouros-logo/) +- [Reference](https://endeavouros.com/endeavouros-logo/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/zuru2003](https://www.reddit.com/user/zuru2003) +- License: No license, just a reddit post +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/ly9zed/endowo_os/) + +# + +## Fedora + +image + +### Base artwork: + +- Copyright Holder: +- License: [Fedora logo usage guide-lines](https://fedoraproject.org/wiki/Logo/UsageGuidelines) +- [Reference](https://fedoraproject.org/wiki/Logo) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/iD3nis124](https://www.reddit.com/user/iD3nis124) +- License: [Fedora logo usage guide-lines (I guess)](https://fedoraproject.org/wiki/Logo/UsageGuidelines) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lxjp3s/saw_nyarch_and_had_to_do_fedowa/) + +# + +## Gentoo + +image + +### Base artwork: + +- Copyright Holder: Gentoo Devs +- License: [Gentoo name and logo guide-lines](https://www.gentoo.org/inside-gentoo/foundation/name-logo-guidelines.html) +- [Reference](https://www.gentoo.org/inside-gentoo/artwork/gentoo-logo.html) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/TheSatisfiedPig](https://www.reddit.com/user/TheSatisfiedPig) +- License: [CC-BY-SA/2.5](https://creativecommons.org/licenses/by-sa/2.5/) +- [Reference (reddit)](https://www.reddit.com/r/linuxmasterrace/comments/m11aml/genchu/) +- [Reference (gentoo artwork)](https://wiki.gentoo.org/wiki/Project:Artwork/Artwork#Genchu) + +# + +## GNU + +image + +### Base artwork: + +- Copyright Holder: Aurelio A. Heckert (aurium@gmail.com) +- License: [CC BY-SA 2.0](https://creativecommons.org/licenses/by-sa/2.0/) +- [Reference](https://www.gnu.org/graphics/heckert_gnu.svg) + +### Modifications + +- Description: Addition of ahegao facial expression, and colorization. +- Copyright Holder: [u/FOSSphorous](https://www.reddit.com/user/FOSSphorous/) +- License: [CC BY-SA 2.0](https://creativecommons.org/licenses/by-sa/2.0/) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lyi8ce/its_actually_gnuwulinux/) + +## Manjaro + +image + +### Base artwork: + +- Copyright Holder: Manjaro GmbH & Co. KG. +- License: [Manjaro terms of use](https://manjaro.org/terms-of-use/) +- [Reference](https://gitlab.manjaro.org/artwork) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/matrixrunner](https://www.reddit.com/user/matrixrunner) +- License: [Manjaro terms of use (I guess, again)](https://manjaro.org/terms-of-use/) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lxx9h7/myanjawo_also_in_wallpaper/) + +# + +## Linux Mint + +image + +### Base artwork: + +- Copyright Holder: Linux mint Devs +- License: [None (I think)](https://linuxmint.com/faq.php) +- [Reference](https://linuxmint.com/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/iD3nis124](https://www.reddit.com/user/iD3nis124) +- License: None +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/ly8oy0/seen_a_lot_of_people_asking_for_mint_so_here_it_is/) + +# + +## KDE neon + +image + +### Base artwork: + +- Copyright Holder: Jens (kde team) +- License: None +- [Reference](https://community.kde.org/Neon#Logo) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/muff2](https://www.reddit.com/user/muff2) +- License: None +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lxt82v/kde_uwon/) + +# + +## NixOS (Nix Snowflake) + +image + +### Base artwork: + +- Copyright Holder: Tim Cuthbertson (@timbertson) +- License: [CC-BY license](https://creativecommons.org/licenses/by/4.0/) +- [Reference](https://github.com/NixOS/nixos-artwork/tree/master/logo#nixos-logo) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/ant-artica](https://www.reddit.com/user/ant-artica) +- License: [CC-BY license](https://creativecommons.org/licenses/by/4.0/) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lzdwl4/nixowos/) + +# + +## OpenSuse + +image + +### Base artwork: + +- Copyright Holder: OpenSuse Devs +- License: [Opensuse Trademark guide-lines](https://news.opensuse.org/2009/03/02/opensuse-trademark-guidelines-released/) +- [Reference](https://en.opensuse.org/openSUSE:Artwork_brand#Buttons) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/VortexAcherontic](https://www.reddit.com/user/VortexAcherontic) +- License: [OpenSuse Trademark guide-lines](https://news.opensuse.org/2009/03/02/opensuse-trademark-guidelines-released/) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lyhgxp/my_better_attempt_on_owosuse/) + +# + +## PopOS + +image + +### Base artwork: + +- Copyright Holder: System76 +- License: [System76 Terms](https://system76.com/terms) +- [Reference](https://pop.system76.com/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/Mochimo786](https://www.reddit.com/user/Mochimo786) +- License: [System76 Terms](https://system76.com/terms) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lxz3xu/pop_uwus/) + +# + +## Slackware + +image + +### Base artwork: + +- Copyright Holder: Slackware Devs +- License: [Slackware Propaganda Graphics FAQ](http://www.slackware.com/~msimons/slackware/grfx/grfxfaq.txt) +- [Reference](http://www.slackware.com/~msimons/slackware/grfx/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/theldus](https://www.reddit.com/user/theldus) +- License: [Slackware Propaganda Graphics FAQ](http://www.slackware.com/~msimons/slackware/grfx/grfxfaq.txt) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lyt6xi/slawckyware/) + +# + +## Solus + +image + +### Base artwork: + +- Copyright Holder: Solus Devs +- License: [Solus brand copyright](https://getsol.us/branding/) +- [Reference](https://getsol.us/home/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/welpelp](https://www.reddit.com/user/welpelp) +- License: [Solus brand copyright](https://getsol.us/branding/) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/ly9il3/continuing_the_trend_i_made_sowus_my_first/) + +# + +## Tux + +image + +### Base artwork: + +- Copyright Holder: Linux foundation +- License: [Who knows](https://web.archive.org/web/20040401161253/http://www.linux.org/info/logos.html) +- [Reference](https://www.linux.org/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/Annual-Examination96](https://www.reddit.com/user/Annual-Examination96) +- License: [Who knows](https://web.archive.org/web/20040401161253/http://www.linux.org/info/logos.html) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lz2i32/tuwu/) + +# + +## Ubuntu + +image + +### Base artwork: + +- Copyright Holder: Canonical Ltd +- License: [Canonical Ltd Trademarks](https://ubuntu.com/legal/trademarks) +- [Reference](https://design.ubuntu.com/brand/ubuntu-logo/#:~:text=The%20Ubuntu%20logo%20is%20made,a%20flat%20orange%2Dcoloured%20background.) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/Chicki2D](https://www.reddit.com/user/Chicki2D) +- License: [Canonical Ltd Trademarks](https://ubuntu.com/legal/trademarks) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lwsnul/uwuntu/) + +# + +## VoidLinux + +image + +### Base artwork: + +- Copyright Holder: VoidLinux Contributors +- License: None +- [Reference](https://voidlinux.org/) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/Satoqz](https://www.reddit.com/user/Satoqz) +- License: None +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lxnjwd/my_boyfriend_decided_to_create_owoid/) + +# + +## Android + +image + +Android at the end because it could be not considered as an actual distribution of gnu/linux + +### Base artwork: + +- Copyright Holder: Google Inc. +- License: [CC-BY-3.0](https://creativecommons.org/licenses/by/3.0/) +- [Reference](https://developer.android.com/distribute/marketing-tools/brand-guidelines#android_robot) + +### Modifications + +- Description: uwu style +- Copyright Holder: [u/6b86b3ac03c167320d93](https://www.reddit.com/user/6b86b3ac03c167320d93) +- License: [CC-BY-3.0](https://creativecommons.org/licenses/by/3.0/) +- [Reference](https://www.reddit.com/r/linuxmasterrace/comments/lye15q/im_not_an_artist_but_heres_my_attempt_at_making/) + +# + + diff --git a/res/IMAGES.md b/res/IMAGES.md deleted file mode 100644 index fb2fc77..0000000 --- a/res/IMAGES.md +++ /dev/null @@ -1,30 +0,0 @@ -# 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). - -## How to use images - -First at all you need `viu`, to install it follow the [guide](https://github.com/atanunq/viu#installation). -Images are working in almost every terminal, for a better experience i recommend [kitty](https://github.com/kovidgoyal/kitty) - -## 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/TheSatisfiedPig ([here](https://www.reddit.com/r/linuxmasterrace/comments/m11aml/genchu/)) -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/)) -image Nyandroid by u/6b86b3ac03c167320d93 ([here](https://www.reddit.com/r/linuxmasterrace/comments/lye15q/im_not_an_artist_but_heres_my_attempt_at_making/)) (android at the end because it could be not considered as an actual distribution of gnu/linux) diff --git a/res/guix.png b/res/guix.png new file mode 100644 index 0000000..99df927 Binary files /dev/null and b/res/guix.png differ diff --git a/res/popos.png b/res/pop.png similarity index 100% rename from res/popos.png rename to res/pop.png diff --git a/uwufetch.c b/uwufetch.c index 18776e8..52ed008 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -18,8 +18,10 @@ #include #include #include +#include #include #include +#include // COLORS #define NORMAL "\x1b[0m" @@ -35,365 +37,673 @@ #define PINK "\x1b[38;5;201m" #define LPINK "\x1b[38;5;213m" +struct package_manager +{ + char command_string[128]; // command to get number of packages installed + char pkgman_name[16]; // name of the package manager +}; struct utsname sys_var; struct sysinfo sys; -int ram_max = 0, ram_free = 0, pkgs, a_i_flag = 0; -char user[32], host[256], shell[64], version_name[64], cpu_model[256], pkgman_name[64], image_name[32]; +struct winsize win; +int ram_total, ram_used = 0; +// initialise the variables to store data, gpu array can hold up to 8 gpus +int pkgs, target_width = 0; +// all flags available +int ascii_image_flag = 0, + show_user_info = 1, + show_os = 1, + show_kernel = 1, + show_cpu = 1, + show_gpu = 1, + show_ram = 1, + show_shell = 1, + show_pkgs = 1, + show_uptime = 1, + show_colors = 1; +char user[32], host[256], shell[64], kernel[256], version_name[64], cpu_model[256], + gpu_model[8][256] = {{'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}}, + pkgman_name[64], image_name[128], *config_directory = NULL; + +// functions definitions, to use them in main() int pkgman(); +void parse_config(); void get_info(); void list(); void print_ascii(); void print_info(); void print_image(); -void usage(char*); +void usage(char *); void uwu_name(); +void truncate_name(char *); +void remove_brackets(char *); -int main(int argc, char *argv[]) { +int main(int argc, char *argv[]) +{ int opt = 0; + static struct option long_options[] = { + {"ascii", no_argument, NULL, 'a'}, + {"config", required_argument, NULL, 'c'}, + {"distro", required_argument, NULL, 'd'}, + {"help", no_argument, NULL, 'h'}, + {"image", optional_argument, NULL, 'i'}, + {"list", no_argument, NULL, 'l'}, + {NULL, 0, NULL, 0}}; get_info(); - while((opt = getopt(argc, argv, "ad:hilc:")) != -1) { - switch(opt) { - case 'a': - a_i_flag = 0; - break; - case 'c': - a_i_flag = 1; + while ((opt = getopt_long(argc, argv, "ac:d:hi::l", long_options, NULL)) != -1) + { + switch (opt) + { + case 'a': + ascii_image_flag = 0; + break; + case 'c': + config_directory = optarg; + break; + case 'd': + if (optarg) + sprintf(version_name, "%s", optarg); + break; + case 'h': + usage(argv[0]); + return 0; + case 'i': + ascii_image_flag = 1; + if (!optarg && argv[optind] != NULL && argv[optind][0] != '-') + sprintf(image_name, "%s", argv[optind++]); + else if (optarg) sprintf(image_name, "%s", optarg); - 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; - case 'l': - list(argv[0]); - return 0; - default: - break; + break; + case 'l': + list(argv[0]); + return 0; + default: + break; } } - if (argc == 1 || a_i_flag == 0) print_ascii(); - else if (a_i_flag) print_image(); + parse_config(); + if ((argc == 1 && ascii_image_flag == 0) || (argc > 1 && ascii_image_flag == 0)) + print_ascii(); + else if (ascii_image_flag) + print_image(); uwu_name(); print_info(); } -int pkgman() { // this is just a function that returns the total of installed packages - int apt, dnf, emerge, flatpak, nix, pacman, rpm, xbps, total = 0; +void parse_config() +{ + char line[256]; + char *homedir = getenv("HOME"); + char *temp_buffer = ""; + FILE *config; - FILE *file[8]; - file[0] = popen("dpkg-query -f '${binary:Package}\n' -W 2> /dev/null | wc -l", "r"); - file[1] = popen("dnf list installed 2> /dev/null | wc -l", "r"); - file[2] = popen("qlist -I 2> /dev/null | wc -l", "r"); - file[3] = popen("flatpak list 2> /dev/null | wc -l", "r"); - file[4] = popen("nix-store -q --requisites /run/current-sys_vartem/sw 2> /dev/null | wc -l", "r"); - file[5] = popen("pacman -Qq 2> /dev/null | wc -l", "r"); - file[6] = popen("rpm -qa --last 2> /dev/null | wc -l", "r"); - file[7] = popen("xbps-query -l 2> /dev/null | wc -l", "r"); - - fscanf(file[0], "%d", &apt); - fscanf(file[1], "%d", &dnf); - fscanf(file[2], "%d", &emerge); - fscanf(file[3], "%d", &flatpak); - fscanf(file[4], "%d", &nix); - fscanf(file[5], "%d", &pacman); - fscanf(file[6], "%d", &rpm); - fscanf(file[7], "%d", &xbps); - for (int i = 0; i < 8; i++) fclose(file[i]); - - #define ADD_PACKAGES(package_count, pkgman_to_add) if (package_count > 0) { total += package_count; strcat(pkgman_name, pkgman_to_add); } - ADD_PACKAGES(apt, "(apt)") - ADD_PACKAGES(dnf, "(dnf)") - ADD_PACKAGES(emerge, "(emerge)") - ADD_PACKAGES(flatpak,"(flatpak)") - ADD_PACKAGES(nix, "(nix)") - ADD_PACKAGES(pacman, "(pacman)") - ADD_PACKAGES(rpm, "(rpm)") - ADD_PACKAGES(xbps, "(xbps)") - #undef ADD_PACKAGES - - return total; + if (config_directory == NULL) + config = fopen(strcat(homedir, "/.config/uwufetch/config"), "r"); + else + config = fopen(config_directory, "r"); + if (config == NULL) + return; + while (fgets(line, sizeof(line), config)) + { + if (line[0] == '#') + continue; + if (strlen(image_name) < 1 && ascii_image_flag == 0) + ascii_image_flag = sscanf(line, "image=%s", image_name); + sscanf(line, "distro=%s", version_name); + if (sscanf(line, "nouser%s", temp_buffer)) + show_user_info = 0; + if (sscanf(line, "noos%s", temp_buffer)) + show_os = 0; + if (sscanf(line, "nokernel%s", temp_buffer)) + show_kernel = 0; + if (sscanf(line, "nocpu%s", temp_buffer)) + show_cpu = 0; + if (sscanf(line, "nogpu%s", temp_buffer)) + show_gpu = 0; + if (sscanf(line, "noram%s", temp_buffer)) + show_ram = 0; + if (sscanf(line, "noshell%s", temp_buffer)) + show_shell = 0; + if (sscanf(line, "nopkgs%s", temp_buffer)) + show_pkgs = 0; + if (sscanf(line, "nouptime%s", temp_buffer)) + show_uptime = 0; + if (sscanf(line, "nocolors%s", temp_buffer)) + show_colors = 0; + } } -void print_info() { // print collected info - printf( "\033[9A\033[18C%s%s%s@%s\n" - "\033[18C%s%sOWOS %s%s\n" - "\033[18C%s%sKERNEL %s%s %s\n" - "\033[18C%s%sCPUWU %s%s\n" - "\033[18C%s%sWAM %s%i MB/%i MB\n" - "\033[18C%s%sSHELL %s%s\n" - "\033[18C%s%sPKGS %s%s%d %s\n" - "\033[18C%s%sUWUPTIME %s"/*"%lid, "*/"%lih, %lim\n" - "\033[18C%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", - NORMAL, BOLD, user, host, - NORMAL, BOLD, NORMAL, version_name, - NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine, - NORMAL, BOLD, NORMAL, cpu_model, - NORMAL, BOLD, NORMAL, (ram_max - ram_free), ram_max, - NORMAL, BOLD, NORMAL, shell, - NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name, - NORMAL, BOLD, NORMAL, /*sys.uptime/60/60/24,*/ sys.uptime/60/60, sys.uptime/60%60, - BOLD, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, NORMAL); +int pkgman() +{ // this is just a function that returns the total of installed packages + int total = 0; + + struct package_manager pkgmans[] = { + {"apt list --installed 2> /dev/null | wc -l", "(apt)"}, + {"apk info 2> /dev/null | wc -l", "(apk)"}, + {"dnf list installed 2> /dev/null | wc -l", "(dnf)"}, + {"qlist -I 2> /dev/null | wc -l", "(emerge)"}, + {"flatpak list 2> /dev/null | wc -l", "(flatpack)"}, + {"guix package --list-installed 2> /dev/null | wc -l", "(guix)"}, + {"nix-store -q --requisites /run/current-sys_vartem/sw 2> /dev/null | wc -l", "(nix)"}, + {"pacman -Qq 2> /dev/null | wc -l", "(pacman)"}, + {"rpm -qa --last 2> /dev/null | wc -l", "(rpm)"}, + {"xbps-query -l 2> /dev/null | wc -l", "(xbps)"}, + {"zypper se --installed-only 2> /dev/null | wc -l", "(zypper)"}}; + + const unsigned long pkgman_count = sizeof(pkgmans) / sizeof(pkgmans[0]); + + for (long unsigned int i = 0; i < pkgman_count; i++) + { // long unsigned int instead of int because of -Wsign-compare + struct package_manager *current = &pkgmans[i]; + + FILE *fp = popen(current->command_string, "r"); + unsigned int pkg_count; + + if (fscanf(fp, "%u", &pkg_count) == 3) + continue; + fclose(fp); + + total += pkg_count; + if (pkg_count > 0) + strcat(pkgman_name, current->pkgman_name); + } + return total; } -void get_info() { // get all necessary info - char line[256]; // var to scan file lines +void print_info() +{ + // store sys info in the sys again + // print collected info - from host to cpu info + printf("\033[9A"); // to align info text + if (show_user_info) + printf("\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host); + if (show_os) + printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name); + if (show_kernel) + printf("\033[18C%s%sKEWNEL %s%s\n", NORMAL, BOLD, NORMAL, kernel); + if (show_cpu) + printf("\033[18C%s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model); + + // print the gpus + if (show_gpu) + { + int gpu_iter = 0; + while (gpu_model[gpu_iter][0] != '0') + { + printf("\033[18C%s%sGPUWU %s%s\n", + NORMAL, BOLD, NORMAL, gpu_model[gpu_iter]); + gpu_iter++; + } + } + + // print ram to uptime and colors + if (show_ram) + printf("\033[18C%s%sWAM %s%i MB/%i MB\n", + NORMAL, BOLD, NORMAL, (ram_used), ram_total); + if (show_shell) + printf("\033[18C%s%sSHELL %s%s\n", + NORMAL, BOLD, NORMAL, shell); + if (show_pkgs) + printf("\033[18C%s%sPKGS %s%s%d %s\n", + NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name); + if (show_uptime) + printf("\033[18C%s%sUWUPTIME %s" /*"%lid, "*/ "%lih, %lim\n", + NORMAL, BOLD, NORMAL, /*sys.uptime/60/60/24,*/ sys.uptime / 60 / 60, sys.uptime / 60 % 60); + if (show_colors) + printf("\033[18C%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 + char line[256]; // var to scan file lines + + // terminal width used to truncate long names + ioctl(STDOUT_FILENO, TIOCGWINSZ, &win); + target_width = win.ws_col - 28; + // os version FILE *os_release = fopen("/etc/os-release", "r"); FILE *cpuinfo = fopen("/proc/cpuinfo", "r"); - if (os_release) { // get normal vars - while (fgets(line, sizeof(line), os_release)) { - sscanf(line, "\nID=%s", version_name); - if (strlen(version_name)) break; - } - while (fgets(line, sizeof(line), cpuinfo)) if (fscanf(cpuinfo, "model name : %[^with\n]", cpu_model)) break; + if (os_release) + { // get normal vars + while (fgets(line, sizeof(line), os_release)) + if (sscanf(line, "\nID=%s", version_name)) + break; + while (fgets(line, sizeof(line), cpuinfo)) + if (sscanf(line, "model name : %[^\n]", cpu_model)) + break; sprintf(user, "%s", getenv("USER")); fclose(os_release); - } else { // try for android vars, or unknown system + } + else + { // try for android vars, or unknown system DIR *system_app = opendir("/system/app/"); DIR *system_priv_app = opendir("/system/priv-app/"); - if (system_app && system_priv_app) { // android + if (system_app && system_priv_app) + { // android closedir(system_app); closedir(system_priv_app); sprintf(version_name, "android"); // android vars FILE *whoami = popen("whoami", "r"); - fscanf(whoami, "%s", user); + if (fscanf(whoami, "%s", user) == 3) + sprintf(user, "unknown"); fclose(whoami); - while (fgets(line, sizeof(line), cpuinfo)) if (fscanf(cpuinfo, "Hardware : %[^\n]", cpu_model)) break; - } else sprintf(version_name, "unknown"); + while (fgets(line, sizeof(line), cpuinfo)) + if (sscanf(line, "Hardware : %[^\n]", cpu_model)) + break; + } + else + sprintf(version_name, "unknown"); } fclose(cpuinfo); gethostname(host, 256); - sscanf(getenv("SHELL"), "%*[bin/]%s", shell); + sscanf(getenv("SHELL"), "%s", shell); + if (strlen(shell) > 16) + memmove(&shell, &shell[27], strlen(shell)); // android shell was too long, this works only for termux + + // truncate CPU name + truncate_name(cpu_model); // system resources uname(&sys_var); - sysinfo(&sys); - + //sysinfo(&sys); // somehow this function has to be called again in print_info() + + truncate_name(sys_var.release); + sprintf(kernel, "%s %s %s", sys_var.sysname, sys_var.release, sys_var.machine); + truncate_name(kernel); + // ram - FILE *meminfo = fopen("/proc/meminfo", "r"); - while (fgets(line, sizeof(line), meminfo)) { - sscanf(line, "MemFree: %d kB", &ram_free); - sscanf(line, "MemTotal: %d kB", &ram_max); - if (ram_max > 0 && ram_free > 0) { - ram_max *= 0.001024; - ram_free *= 0.001024; - fclose(meminfo); - break; + FILE *meminfo; + + meminfo = popen("LANG=EN_us free 2> /dev/null", "r"); + while (fgets(line, sizeof(line), meminfo)) + { + // free command prints like this: "Mem:" total used free shared buff/cache available + if (sscanf(line, "Mem: %d %d", &ram_total, &ram_used)) + { + // convert to megabytes + if (ram_total > 0 && ram_used > 0) + { + // data is in bytes + ram_total /= 1024; + ram_used /= 1024; + break; + } } } + fclose(meminfo); + + /* ---------- gpu ---------- */ + int gpun = 0; // number of the gpu that the program is searching for to put in the array + setenv("LANG", "en_US", 1); // force language to english + FILE *gpu; + gpu = popen("lshw -class display 2> /dev/null", "r"); + + // add all gpus to the array gpu_model (up to 8 gpus) + while (fgets(line, sizeof(line), gpu)) + if (sscanf(line, " product: %[^\n]", gpu_model[gpun])) + gpun++; + + if (strlen(gpu_model[0]) < 2) + { + // get gpus with lspci command + if (strcmp(version_name, "android") != 0) + gpu = popen("lspci -mm 2> /dev/null | grep \"VGA\" | cut --fields=4,6 -d '\"' --output-delimiter=\" \" | sed \"s/ Controller.*//\"", "r"); + else + gpu = popen("getprop ro.hardware.vulkan 2> /dev/null", "r"); + } + + // get all the gpus + while (fgets(line, sizeof(line), gpu)) + { + if (sscanf(line, "%[^\n]", gpu_model[gpun])) + gpun++; + } + fclose(gpu); + + // truncate GPU name and remove square brackets + for (int i = 0; i < gpun; i++) + { + remove_brackets(gpu_model[i]); + truncate_name(gpu_model[i]); + } + + // package count pkgs = pkgman(); } -void list(char* arg) { // prints distribution list - /* distributions are listed by distribution branch - to make the output easier to understand by the user.*/ - printf( "%s -d \n" - " Available distributions:\n" - " %sArch linux %sbased:\n" - " %sarch, artix, %smanjaro, \"manjaro-arm\"\n\n" - " %sDebian/%sUbuntu %sbased:\n" - " %sdebian, %slinuxmint, %spopos\n\n" - " %sOther/spare distributions:\n" - " %sfedora, %sgentoo, %svoid, android, %sunknown\n\n" - " %sBSD:\n" - " freebsd, %sopenbsd\n", - arg, BLUE, NORMAL, BLUE, GREEN, // Arch based colors - RED, YELLOW, NORMAL, RED, GREEN, BLUE, // Debian based colors - NORMAL, BLUE, PINK, GREEN, WHITE, // Other/spare distributions colors - RED, YELLOW); // BSD colors +void list(char *arg) +{ // prints distribution list + // distributions are listed by distribution branch + // to make the output easier to understand by the user. + printf("%s -d \n" + " Available distributions:\n" + " %sArch linux %sbased:\n" + " %sarch, artix, %smanjaro, \"manjaro-arm\"\n\n" + " %sDebian/%sUbuntu %sbased:\n" + " %sdebian, %slinuxmint, %spop, %sraspbian\n\n" + " %sBSD:\n" + " freebsd, %sopenbsd\n\n" + " %sOther/spare distributions:\n" + " %salpine, %sfedora, %sgentoo, %s\"void\", \"opensuse-leap\", android, %sgnu, guix, %sunknown\n", + arg, + BLUE, NORMAL, BLUE, GREEN, // Arch based colors + RED, YELLOW, NORMAL, RED, GREEN, BLUE, RED, // Debian based colors + RED, YELLOW, // BSD colors + NORMAL, BLUE, BLUE, PINK, GREEN, YELLOW, WHITE); // Other/spare distributions colors } -void print_ascii() { // prints logo (as ascii art) of the given system. distributions listed alphabetically. - - // linux - if (strcmp(version_name, "arch") == 0) { - printf( "\033[1E\033[8C%s/\\\n" - " / \\\n" - " /\\ \\\n" - " / > w <\\\n" - " / __ \\\n" - " / __| |__-\\\n" - " /_-'' ''-_\\\n\n", BLUE); - } else if (strcmp(version_name, "artix") == 0) { - printf( "\033[1E\033[8C%s/\\\n" - " / \\\n" - " /`'.,\\\n" - " /\u2022 w \u2022 \\\n" - " / ,`\\\n" - " / ,.'`. \\\n" - " /.,'` `'.\\\n\n", BLUE); - } else if (strcmp(version_name, "debian") == 0) { - printf( "\033[1E\033[6C%s______\n" - " / ___ \\\n" - " | / OwO |\n" - " | \\____-\n" - " -_\n" - " --_\n\n\n", RED); - } else if (strcmp(version_name, "fedora") == 0) { - printf( "\033[1E\033[8C%s_____\n" - " / __)%s\\\n" - " %s> %s| / %s<%s\\ \\\n" - " __%s_| %sw%s|_%s_/ /\n" - " / %s(_ _)%s_/\n" - " / / %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) { - 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) { - 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" - " \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" - " \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"); - } else if (strcmp(version_name, "\"manjaro-arm\"") == 0) { - 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" - " \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" - " \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"); - } else if (strcasecmp(version_name, "linuxmint") == 0) { - printf( "\033[2E\033[4C%s__/\\____/\\.\n" - " |%s.--. %s|\n" - " %s, %s¯| %s| UwU| %s|\n" - " %s|| %s| %s| | %s|\n" - " %s | %s| %s---- %s|\n" - " %s --%s'--------'\n\n",GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, GREEN); - } else if (strcasecmp(version_name, "popos") == 0) { - printf("\033[2E\033[6C%s|\\.-----./|\n" - " |/ \\|\n" - " | > < |\n" - " | %s~ %sP! %s~ %s|\n" - "_ ---\\ w /\n" - " \\_/ '-----'\n\n", BLUE, LPINK, WHITE, LPINK, BLUE); - } else if (strcmp(version_name, "ubuntu") == 0) { - printf( "\033[1E\033[9C%s_\n" - " %s\u25E3%s__(_)%s\u25E2%s\n" - " _/ --- \\\n" - " (_) |>w<| |\n" - " \\ --- _/\n" - " %sC__/%s---(_)\n\n\n", LPINK, PINK, LPINK, PINK, LPINK, PINK, LPINK); - } else if (strcmp(version_name, "void") == 0){ - printf("\033[2E\033[2C%s |\\_____/|\n" - " _\\____ |\n" - " | \\ \\ |\n" - " | | %s\u00d2w\u00d3 %s| | ,\n" - " | \\_____\\_|-, |\n" - " -_______\\ \\_/\n\n", GREEN, WHITE, GREEN); - } else if (strcmp(version_name, "android") == 0) { // android at the end because it could be not considered as an actual distribution of gnu/linux - printf( "\033[2E\033[3C%s\\ _------_ /\n" - " / \\\n" - " | %s~ %s> w < %s~ %s|\n" - " ------------\n\n\n\n", GREEN, RED, GREEN, RED, GREEN); +void print_ascii() +{ // prints logo (as ascii art) of the given system. distributions listed alphabetically. + // linux + if (strcmp(version_name, "alpine") == 0) + { + printf("\033[2E\033[4C%s. .___.\n" + " / \\/ \\ /\n" + " /OwO\\ɛU\\/ __\n" + " / \\ \\__/ \\\n" + "/ \\ \\\n\n\n", + BLUE); + } + else if (strcmp(version_name, "arch") == 0) + { + printf("\033[1E\033[8C%s/\\\n" + " / \\\n" + " /\\ \\\n" + " / > w <\\\n" + " / __ \\\n" + " / __| |__-\\\n" + " /_-'' ''-_\\\n\n", + BLUE); + } + else if (strcmp(version_name, "artix") == 0) + { + printf("\033[1E\033[8C%s/\\\n" + " / \\\n" + " /`'.,\\\n" + " /\u2022 w \u2022 \\\n" + " / ,`\\\n" + " / ,.'`. \\\n" + " /.,'` `'.\\\n\n", + BLUE); + } + else if (strcmp(version_name, "debian") == 0) + { + printf("\033[1E\033[6C%s______\n" + " / ___ \\\n" + " | / OwO |\n" + " | \\____-\n" + " -_\n" + " --_\n\n\n", + RED); + } + else if (strcmp(version_name, "fedora") == 0) + { + printf("\033[1E\033[8C%s_____\n" + " / __)%s\\\n" + " %s> %s| / %s<%s\\ \\\n" + " __%s_| %sw%s|_%s_/ /\n" + " / %s(_ _)%s_/\n" + " / / %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) + { + printf("\033[1E\033[3C%s_-----_\n" + " ( \\\n" + " \\ OwO \\\n" + "%s \\ )\n" + " / _/\n" + " ( _-\n" + " \\____-\n\n", + MAGENTA, WHITE); + } + else if (strcmp(version_name, "gnu") == 0 || strcmp(version_name, "guix") == 0) + { + printf("\033[3E\033[3C%s,= %s,-_-. %s=.\n" + " ((_/%s)%sU U%s(%s\\_))\n" + " `-'%s(. .)%s`-'\n" + " %s\\%sw%s/\n" + " \u00af\n\n", + WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW); + } + else if (strcmp(version_name, "manjaro") == 0) + { + 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" + " \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" + " \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"); + } + else if (strcmp(version_name, "\"manjaro-arm\"") == 0) + { + 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" + " \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" + " \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"); + } + else if (strcmp(version_name, "linuxmint") == 0) + { + printf("\033[2E\033[4C%s__/\\____/\\.\n" + " |%s.--. %s|\n" + " %s, %s¯| %s| UwU| %s|\n" + " %s|| %s| %s| | %s|\n" + " %s | %s| %s---- %s|\n" + " %s --%s'--------'\n\n", + GREEN, WHITE, GREEN, WHITE, + GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, GREEN, WHITE, + GREEN, WHITE, GREEN, WHITE, GREEN); + } + else if (strcmp(version_name, "\"opensuse-leap\"") == 0 || strcmp(version_name, "\"opensuse-tumbleweed\"") == 0) + { + printf("\033[3E\033[3C%s|\\----/|\n" + " _ / %sO O%s\\\n" + " __. W /\n" + " '----'\n\n\n", + GREEN, WHITE, GREEN); + } + else if (strcmp(version_name, "pop") == 0) + { + printf("\033[2E\033[6C%s|\\.-----./|\n" + " |/ \\|\n" + " | > < |\n" + " | %s~ %sP! %s~ %s|\n" + "_ ---\\ w /\n" + " \\_/ '-----'\n\n", + BLUE, LPINK, WHITE, LPINK, BLUE); + } + else if (strcmp(version_name, "raspbian") == 0) + { + printf("\033[0E\033[6C%s__ __\n" + " (_\\)(/_)\n" + " %s(>(__)<)\n" + " (_(_)(_)_)\n" + " (_(__)_)\n" + " (__)\n\n\n", + GREEN, RED); + } + else if (strcmp(version_name, "ubuntu") == 0) + { + printf("\033[1E\033[9C%s_\n" + " %s\u25E3%s__(_)%s\u25E2%s\n" + " _/ --- \\\n" + " (_) |>w<| |\n" + " \\ --- _/\n" + " %sC__/%s---(_)\n\n\n", + LPINK, PINK, LPINK, PINK, LPINK, PINK, LPINK); + } + else if (strcmp(version_name, "\"void\"") == 0) + { + printf("\033[2E\033[2C%s |\\_____/|\n" + " _\\____ |\n" + " | \\ \\ |\n" + " | | %s\u00d2w\u00d3 %s| | ,\n" + " | \\_____\\_|-, |\n" + " -_______\\ \\_/\n\n", + GREEN, WHITE, GREEN); + } + else if (strcmp(version_name, "android") == 0) + { // android at the end because it could be not considered as an actual distribution of gnu/linux + printf("\033[2E\033[3C%s\\ _------_ /\n" + " / \\\n" + " | %s~ %s> w < %s~ %s|\n" + " ------------\n\n\n\n", + GREEN, RED, GREEN, RED, GREEN); } // BSD - else if (strcmp(version_name, "freebsd") == 0) { - printf( "\032[1E\033[3C%s\n" - " /\\,-'''''-,/\\\n" - " \\_) (_/\n" - " | \\ / |\n" - " | O w O |\n" - " ; ;\n" - " '-_____-'\n", RED); + else if (strcmp(version_name, "freebsd") == 0) + { + printf("\033[2E\033[1C%s/\\,-'''''-,/\\\n" + " \\_) (_/\n" + " | \\ / |\n" + " | O w O |\n" + " ; ;\n" + " '-_____-'\n\n", + RED); + } + else if (strcmp(version_name, "openbsd") == 0) + { + printf("\033[1E\033[3C%s ______ \n" + " \\- -/ %s\u2665 \n" + "%s\\_/ \\ \n" + "| %s> < %s| \n" + "|_ < %s// %sW %s// \n" + "%s/ \\ / \n" + " /-________-\\ \n\n", + YELLOW, RED, YELLOW, WHITE, YELLOW, LPINK, WHITE, LPINK, YELLOW); + } - } else if (strcmp(version_name, "openbsd") == 0) { - printf( "\033[1E\033[3C%s ______ \n" - " \\- -/ %s\u2665 \n" - "%s\\_/ \\ \n" - "| %s> < %s| \n" - "|_ < %s// %sW %s// \n" - "%s/ \\ / \n" - " /-________-\\ \n\n", YELLOW, RED, YELLOW, WHITE, YELLOW, LPINK, WHITE, LPINK, YELLOW); - - } - else printf( "\033[0E\033[4C%s.--.\n" - " |o_o |\n" - " |:_/ |\n" - " // \\ \\\n" - " (| | )\n" - " %s/'\\_ _/`\\\n" - " \\___)=(___/\n\n", WHITE, YELLOW); + // everything else + else + printf("\033[0E\033[2C%s._.--._.\n" + " \\|>%s_%s< |/\n" + " |%s:_/%s |\n" + " // \\ \\ ?\n" + " (| | ) /\n" + " %s/'\\_ _/`\\%s-\n" + " %s\\___)=(___/\n\n", + WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW); } -void print_image() { // prints logo (as an image) of the given system. distributions listed alphabetically. +void print_image() +{ // prints logo (as an image) of the given system. distributions listed alphabetically. char command[256]; - if (strlen(image_name) > 1) sprintf(command, "viu -t -w 18 -h 8 %s 2> /dev/null", image_name); - else { - if (strcmp(version_name, "android") == 0) sprintf(command, "viu -t -w 18 -h 8 /data/data/com.termux/files/usr/lib/uwufetch/%s.png 2> /dev/null", version_name); - else sprintf(command, "viu -t -w 18 -h 8 /usr/lib/uwufetch/%s.png 2> /dev/null", version_name); + if (strlen(image_name) > 1) + sprintf(command, "viu -t -w 18 -h 8 %s 2> /dev/null", image_name); + else + { + if (strcmp(version_name, "android") == 0) + sprintf(command, "viu -t -w 18 -h 8 /data/data/com.termux/files/usr/lib/uwufetch/%s.png 2> /dev/null", version_name); + else + sprintf(command, "viu -t -w 18 -h 8 /usr/lib/uwufetch/%s.png 2> /dev/null", version_name); } - if (system(command) != 0) { // if viu is not installed or the image is missing - printf( "\033[0E\033[3C%s\n" - " There was an\n" - " error: viu\n" - " is not installed\n" - " or the image\n" - " is not fount\n" - " Read IMAGES.md\n" - " for more info.\n\n", RED); + printf("\n"); + if (system(command) != 0) + { // if viu is not installed or the image is missing + printf("\033[0E\033[3C%s\n" + " There was an\n" + " error: viu\n" + " is not installed\n" + " or the image\n" + " is not fount\n" + " Read IMAGES.md\n" + " for more info.\n\n", + RED); } } -void usage(char* arg) { +void usage(char *arg) +{ printf("Usage: %s \n" - " -a, --ascii prints logo as ascii text (default)\n" - " -c, --custom choose a custom image\n" - " -d, --distro lets you choose the logo to print\n" - " -h, --help prints this help page\n" - " -i, --image prints logo as image\n" - " %sworks in most terminals\n" - " read res/IMAGES.md for more info%s\n", - arg, BLUE, NORMAL); + " -a, --ascii prints logo as ascii text (default)\n" + " -c --config use custom config path\n" + " -d, --distro lets you choose the logo to print\n" + " -h, --help prints this help page\n" + " -i, --image prints logo as image and use a custom image if provided\n" + " %sworks in most terminals\n" + " read README.md for more info%s\n" + " -l, --list lists all supported distributions\n", + arg, BLUE, NORMAL); } -void uwu_name() { // changes distro name to uwufied(?) name +void uwu_name() +{ // uwufies distro name - #define STRING_TO_UWU(original, uwufied) if (strcmp(version_name, original) == 0) sprintf(version_name, "%s", uwufied) - // linux - STRING_TO_UWU("arch", "Nyarch Linuwu"); - else STRING_TO_UWU("artix", "Nyartix Linuwu"); - else STRING_TO_UWU("debian", "Debinyan"); - else STRING_TO_UWU("fedora", "Fedowa"); - else STRING_TO_UWU("gentoo", "GentOwO"); - else STRING_TO_UWU("linuxmint", "LinUWU Miwint"); - else STRING_TO_UWU("manjaro", "Myanjawo"); - else STRING_TO_UWU("manjaro-arm", "Myanjawo AWM"); - else STRING_TO_UWU("popos", "PopOwOS"); - else STRING_TO_UWU("ubuntu", "Uwuntu"); - else STRING_TO_UWU("void", "OwOid"); - else STRING_TO_UWU("android", "Nyandroid"); // android at the end because it could be not considered as an actual distribution of gnu/linux +#define STRING_TO_UWU(original, uwufied) \ + if (strcmp(version_name, original) == 0) \ + sprintf(version_name, "%s", uwufied) - // BSD - else STRING_TO_UWU("freebsd", "FweeBSD"); - else STRING_TO_UWU("openbsd", "OwOpenBSD"); + // linux + STRING_TO_UWU("alpine", "Nyalpine"); + else STRING_TO_UWU("arch", "Nyarch Linuwu"); + else STRING_TO_UWU("artix", "Nyartix Linuwu"); + else STRING_TO_UWU("debian", "Debinyan"); + else STRING_TO_UWU("endeavour", "endeavOwO"); + else STRING_TO_UWU("fedora", "Fedowa"); + else STRING_TO_UWU("gentoo", "GentOwO"); + else STRING_TO_UWU("gnu", "gnUwU"); + else STRING_TO_UWU("guix", "gnUwU gUwUix"); + else STRING_TO_UWU("linuxmint", "LinUWU Miwint"); + else STRING_TO_UWU("manjaro", "Myanjawo"); + else STRING_TO_UWU("\"manjaro-arm\"", "Myanjawo AWM"); + else STRING_TO_UWU("neon", "KDE NeOwOn"); + else STRING_TO_UWU("nixos", "nixOwOs"); + else STRING_TO_UWU("\"opensuse-leap\"", "OwOpenSUSE Leap"); + else STRING_TO_UWU("\"opensuse-tumbleweed\"", "OwOpenSUSE Tumbleweed"); + else STRING_TO_UWU("pop", "PopOwOS"); + else STRING_TO_UWU("raspbian", "RaspNyan"); + else STRING_TO_UWU("slackware", "Swackwawe"); + else STRING_TO_UWU("solus", "sOwOlus"); + else STRING_TO_UWU("ubuntu", "Uwuntu"); + else STRING_TO_UWU("\"void\"", "OwOid"); + else STRING_TO_UWU("android", "Nyandroid"); // android at the end because it could be not considered as an actual distribution of gnu/linux + // BSD + else STRING_TO_UWU("freebsd", "FweeBSD"); + else STRING_TO_UWU("openbsd", "OwOpenBSD"); - else { - sprintf(version_name, "%s", "unknown"); - if (a_i_flag == 1) { - print_image(); - printf("\n"); - } + else + { + sprintf(version_name, "%s", "unknown"); + if (ascii_image_flag == 1) + { + print_image(); + printf("\n"); } - #undef STRING_TO_UWU + } +#undef STRING_TO_UWU +} + +void truncate_name(char *name) +{ + for (int i = target_width; i < 256; i++) + name[i] = '\0'; +} + +// remove square brackets (for gpu names) +void remove_brackets(char *str) +{ + int i = 0, j; + while (i < (int)strlen(str)) + { + if (str[i] == '[' || str[i] == ']') + { + for (j = i; j < (int)strlen(str); j++) + str[j] = str[j + 1]; + } + else + i++; + } } diff --git a/uwufetch_man.md b/uwufetch_man.md new file mode 100644 index 0000000..7d689f7 --- /dev/null +++ b/uwufetch_man.md @@ -0,0 +1,111 @@ +% UWUFETCH(1) uwufetch 1.2 +% TheDarkBug +% April 2021 + + + +# NAME + +uwufetch - A meme system info tool for Linux, based on nyan/uwu trend on r/linuxmasterrace. + +# SYNOPSIS + +**uwufetch** [*OPTIONS*] [*ARGUMENTS*]\ + +## OPTIONS + +-a --ascii\ +prints the logo as ascii text (default) + +-c --config\ +you can change config path + +-d --distro\ +you can choose the logo to print by the distro name + +-h --help\ +prints a help page + +-i --image\ +prints image instead of ascii logo\ +uses a custom image if one is provided + +-l --list\ +prints a list of all supported distributions + +# CONFIG FILE + +The config file is located in $HOME/.config/uwufetch/config (you need to create it), but you can change the path by using the `--config` option. + +## OPTIONS + +distribution=name\ \ \ \ \ # use it to change displayed distribution\ +image=/path/to/image\ \ \ # enable images (leave blank), or use custom image path\ +nouser\ \ \ \ \ \ \ \ \ \ \ # disable username and hostname\ +noos\ \ \ \ \ \ \ \ \ \ \ # disable os\ +nokernel\ \ \ \ \ \ \ \ \ # disable kernel\ +nocpu\ \ \ \ \ \ \ \ \ \ \ # disable cpu\ +nogpu\ \ \ \ \ \ \ \ \ \ \ # disable gpu\ +noram\ \ \ \ \ \ \ \ \ \ \ # disable ram\ +noshell\ \ \ \ \ \ \ \ \ \ # disable shell\ +nopkgs\ \ \ \ \ \ \ \ \ \ \ # disable pkgs\ +nouptime\ \ \ \ \ \ \ \ \ # disable uptime\ +nocolors\ \ \ \ \ \ \ \ \ # disable colors + +# SUPPORTED DISTRIBUTIONS + +Distribution name\ \ \ \ \ -d option + +Nyalpine\ \ \ \ \ \ \ \ \ alpine\ +Nyarch Linuwu\ \ \ \ \ \ \ arch\ +Nyartix Linuwu\ \ \ \ \ \ \ artix\ +Debinyan\ \ \ \ \ \ \ \ \ debian\ +Fedowa\ \ \ \ \ \ \ \ \ \ \ fedora\ +GentOwO\ \ \ \ \ \ \ \ \ \ gentoo\ +GnUwU gUwUix\ \ \ \ \ \ \ guix\ +Miwint\ \ \ \ \ \ \ \ \ \ \ linuxmint\ +Myanjawo\ \ \ \ \ \ \ \ \ manjaro\ +Myanjawo AWM\ \ \ \ \ \ \ \\"manjaro-arm\\"\ +OwOpenSUSE\ \ \ \ \ \ \ \ \ \\"opensuse-leap\\"\ +Pop OwOs\ \ \ \ \ \ \ \ \ pop\ +RaspNyan\ \ \ \ \ \ \ \ \ raspbian\ +UwUntu\ \ \ \ \ \ \ \ \ \ \ ubuntu\ +OwOid\ \ \ \ \ \ \ \ \ \ \ \\"void\\"\ +Nyandroid\ \ \ \ \ \ \ \ \ android\ +Unknown (tux logo)\ \ \ \ \ unknown + +--image/ascii only distributions--\ +endeavOwO\ \ \ \ \ \ \ \ \ endeavour\ +KDE NeOwOn\ \ \ \ \ \ \ \ \ neon\ +nixOwOs\ \ \ \ \ \ \ \ \ \ nixos\ +Swackwawe\ \ \ \ \ \ \ \ \ slackware\ +sOwOlus\ \ \ \ \ \ \ \ \ \ solus\ +FweeBSD\ \ \ \ \ \ \ \ \ \ freebsd\ +OwOpenBSD\ \ \ \ \ \ \ \ \ openbsd + +# DESCRIPTION + +Uwufetch is a program inspired by neofetch and ufetch, that takes system informations\ +and prints them in the terminal in an UwU way, with and UwU ascii logo or image. + +# EXAMPLES + +uwufetch -d arch\ \ \ \ \ \ \ \ \ \ # prints arch logo\ +uwufetch -\-custom some_image.png\ \ # prints custom image (does not need full path)\ +ueufetch -i -d artix\ \ \ \ \ \ \ \ # prints artix image + +# DEPENDANCES + +lshw\ \ better gpu info\ +viu\ \ \ print images instead of ascii logo\ +kitty\ \ better image viewing + +All of this are optional, there is no necessary dependancy. + +# LICENSE AND COPYRIGTH + +uwufetch is provided under the GPL3 license, for copyright info read https://github.com/TheDarkBug/uwufetch/tree/main/res/COPYRIGHT.md.