From 811ec5d2d23b2a7a2391a1545912d29c399070f6 Mon Sep 17 00:00:00 2001 From: zenobit Date: Fri, 29 Mar 2024 16:23:58 +0100 Subject: [PATCH 01/29] am fix --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 1f4b8399..ba3bd467 100755 --- a/neofetch +++ b/neofetch @@ -2070,7 +2070,7 @@ get_packages() { has pipx && tot pipx list --short has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs" has npm && pkgs_h=1 tot npm list -g --depth=0 - has am && pac "$(am -f | grep 'PROGRAMS MANAGED BY' | cut -d' ' -f4)"a + has am && pac "$(am -f | grep 'PROGRAMS MANAGED BY' | cut -d' ' -f4)" # OS-specific package managers. case $os in From 01a01fb21baad3bb998ed367474bbcb6e110c7f9 Mon Sep 17 00:00:00 2001 From: zenobit Date: Tue, 2 Apr 2024 21:21:08 +0200 Subject: [PATCH 02/29] better showing of apps managed by am --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index ba3bd467..fc211734 100755 --- a/neofetch +++ b/neofetch @@ -2070,7 +2070,7 @@ get_packages() { has pipx && tot pipx list --short has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs" has npm && pkgs_h=1 tot npm list -g --depth=0 - has am && pac "$(am -f | grep 'PROGRAMS MANAGED BY' | cut -d' ' -f4)" + has am && pac "$(am -f --less)" # OS-specific package managers. case $os in From bd9c0b30cfe4992be7ab20a71971bc7bab0846f0 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:56:31 -0400 Subject: [PATCH 03/29] [F] Fix npm list count #240 --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index fc211734..10e9ad70 100755 --- a/neofetch +++ b/neofetch @@ -2069,7 +2069,8 @@ get_packages() { # OS-independent package managers. has pipx && tot pipx list --short has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs" - has npm && pkgs_h=1 tot npm list -g --depth=0 + npm-list() { npm list -g --depth=0 | grep -v -E '.*(\(none\)|npm@).*'; } + has npm && pkgs_h=1 tot npm-list has am && pac "$(am -f --less)" # OS-specific package managers. From be8f75df019f6b975e77d30a81c1211ac4292be4 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:54:28 -0400 Subject: [PATCH 04/29] [O] Optimize npm query Closes https://github.com/hykilpikonna/hyfetch/issues/246 --- neofetch | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 10e9ad70..ab012efd 100755 --- a/neofetch +++ b/neofetch @@ -2069,10 +2069,28 @@ get_packages() { # OS-independent package managers. has pipx && tot pipx list --short has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs" - npm-list() { npm list -g --depth=0 | grep -v -E '.*(\(none\)|npm@).*'; } - has npm && pkgs_h=1 tot npm-list has am && pac "$(am -f --less)" + # Special case for npm: If has npm, we should list folders under node_modules instead of using npm list. + # This is because npm list is very slow (2s) + if has npm; then + # Try to apply heuristics to find the global directory. + if [[ -d /usr/lib/node_modules ]]; then + dir /usr/lib/node_modules/*/ + elif [[ -d /usr/local/lib/node_modules ]]; then + dir /usr/local/lib/node_modules/*/ + else + # If neither exist, use npm root -g to get the global directory. + # (still ~10x faster than npm list) + npm_global=$(npm root -g) + [[ -d $npm_global ]] && dir "$npm_global"/*/ + + # This may not work in WSL2 (if npm is installed on Windows, not WSL). + # However, if npm is not installed on this WSL subsystem, it doesn't really count + # as a package manager for this subsystem, so let's ignore this case. + fi + fi + # OS-specific package managers. case $os in Linux|BSD|"iPhone OS"|Solaris|illumos|Interix) From d47a63d237d5eaa90961d72e4e4f6bc5dc62f6e6 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sun, 14 Apr 2024 12:39:48 -0400 Subject: [PATCH 05/29] [+] Package windows git inside hyfetch wheel --- tools/build_pkg.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tools/build_pkg.sh diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh new file mode 100644 index 00000000..ca684dd3 --- /dev/null +++ b/tools/build_pkg.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +set -e + +# Remove the old build +rm -rf dist/ +rm -rf build/ + +# Remove git from the source code before building +rm -rf hyfetch/git/ + +# Build python from setup.py +python3 setup.py sdist bdist_wheel + +# Check +twine check dist/* + +# ================= +# Build for windows +cd dist + +# Get the file name +file=$(ls | grep .whl) + +# Get the git distribution if it doesn't exist +if [ ! -f git.tar.bz2 ]; then + #URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-64-bit.tar.bz2" + # NOTE: Git for Windows v2.44 is the last release to support Windows 7 and 8 + URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-32-bit.tar.bz2" + wget $URL -O git.tar.bz2 +fi + +# Unzip the git distribution to git directory +mkdir git +tar -xvf git.tar.bz2 -C git + +# Unzip the wheel +unzip $file -d wheel + +# Copy the git distribution to the wheel +cp -r git/ wheel/hyfetch/ + +# Change the file name (replace -none-any with -win_amd64) +new_name="$(echo $file | sed 's/-none-any/-win32/')" + +# Zip the wheel to win_amd64.whl +cd wheel && zip -r "../$new_name" * && cd .. + +# Check again +twine check $new_name \ No newline at end of file From ece02c5d4495a49b6ac93bc5ddd9630728051c31 Mon Sep 17 00:00:00 2001 From: Yukari Chiba Date: Fri, 19 Apr 2024 13:42:47 +0800 Subject: [PATCH 06/29] add eweOS --- docs/neofetch.1 | 2 +- neofetch | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/neofetch.1 b/docs/neofetch.1 index 044f4e65..a0e71efe 100644 --- a/docs/neofetch.1 +++ b/docs/neofetch.1 @@ -327,7 +327,7 @@ Container Linux by CoreOS, CRUX, Crystal Linux, Cucumber, CutefishOS, CuteOS, CyberOS, dahlia, DarkOs, Darwin, Debian, Deepin, DesaOS, Devuan, DietPi, digital UNIX, DracOS, DragonFly, Drauger, Droidian, Elementary, Elive, EncryptOS, EndeavourOS, Endless, Enso, -EuroLinux, EvolutionOS, Exherbo, Exodia Predator OS, Fedora, +EuroLinux, EvolutionOS, eweOS, Exherbo, Exodia Predator OS, Fedora, FemboyOS, Feren, Finnix, Floflis, FreeBSD, FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, GhostBSD, glaucus, gNewSense, GNOME, GNU, GoboLinux, GrapheneOS, Grombyang, Guix, Haiku, HamoniKR, diff --git a/neofetch b/neofetch index ab012efd..4a145414 100755 --- a/neofetch +++ b/neofetch @@ -865,7 +865,7 @@ image_source="auto" # Chrom, Cleanjaro, Clear Linux OS, ClearOS, Clover, Cobalt, Condres, Container Linux by CoreOS, # CRUX, Crystal Linux, Cucumber, CutefishOS, CuteOS, CyberOS, dahlia, DarkOs, Darwin, Debian, # Deepin, DesaOS, Devuan, DietPi, digital UNIX, DracOS, DragonFly, Drauger, Droidian, Elementary, -# Elive, EncryptOS, EndeavourOS, Endless, Enso, EuroLinux, EvolutionOS, Exherbo, Exodia Predator OS, +# Elive, EncryptOS, EndeavourOS, Endless, Enso, EuroLinux, EvolutionOS, eweOS, Exherbo, Exodia Predator OS, # Fedora, FemboyOS, Feren, Finnix, Floflis, FreeBSD, FreeMiNT, Frugalware, Funtoo, GalliumOS, # Garuda, Gentoo, GhostBSD, glaucus, gNewSense, GNOME, GNU, GoboLinux, GrapheneOS, Grombyang, Guix, # Haiku, HamoniKR, HarDClanZ, Hash, Huayra, Hybrid, HydroOS, Hyperbola, iglunix, instantOS, Interix, @@ -6521,7 +6521,7 @@ ASCII: CutefishOS, CuteOS, CyberOS, dahlia, DarkOs, Darwin, Debian, Deepin, DesaOS, Devuan, DietPi, digital UNIX, DracOS, DragonFly, Drauger, Droidian, Elementary, Elive, EncryptOS, EndeavourOS, Endless, Enso, - EuroLinux, EvolutionOS, Exherbo, Exodia Predator OS, Fedora, + EuroLinux, EvolutionOS, eweOS, Exherbo, Exodia Predator OS, Fedora, FemboyOS, Feren, Finnix, Floflis, FreeBSD, FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, GhostBSD, glaucus, gNewSense, GNOME, GNU, GoboLinux, GrapheneOS, Grombyang, Guix, Haiku, HamoniKR, @@ -9632,6 +9632,27 @@ ${c1}\e[1;32m dddddddddddddddddddddddd EOF ;; + "eweOS"*) + set_colors 7 11 9 8 1 + read -rd '' ascii_data <<'EOF' +${c2} #####%%% +${c2} ##%%${c3}////${c2}%%%%%${c3}/// +${c2} #%%%%${c3}////((((////${c2}% +${c1} *@@@@@@@${c3}/${c5},,,${c3}/////${c5},,,${c2}%${c1}@@@@@@@ +${c1} .@@@@@@@@@@@${c3}////////${c2}%%%${c1}@@@@@@@@@@@@ +${c1} @@@${c4}...${c1}@@@@@@${c3}////${c2}%%${c3}////${c1}@@@@@@@@@@@@@@@@ +${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@ +${c1} @@@@@@@@@@@@@@@@@@@@@@@ +${c1} @@@@@@ @@@@@@ +${c1} @@@ @@@ +EOF + ;; + "Exherbo"*) set_colors 4 7 1 read -rd '' ascii_data <<'EOF' From 6f9155fe83ae3393b01d6f4e07bce212f8505099 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Tue, 23 Apr 2024 07:42:08 -0400 Subject: [PATCH 07/29] [+] Better build script --- setup.py | 1 + tools/bash_ignore.txt | 366 ++++++++++++++++++++++++++++++++++++++++++ tools/build_bash.sh | 19 +++ tools/build_pkg.sh | 15 +- 4 files changed, 389 insertions(+), 12 deletions(-) create mode 100644 tools/bash_ignore.txt create mode 100644 tools/build_bash.sh diff --git a/setup.py b/setup.py index d7dd759b..95260a40 100755 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ setup( "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], packages=find_namespace_packages(), package_data={'hyfetch': ['hyfetch/*']}, diff --git a/tools/bash_ignore.txt b/tools/bash_ignore.txt new file mode 100644 index 00000000..632e75cf --- /dev/null +++ b/tools/bash_ignore.txt @@ -0,0 +1,366 @@ +git-bash.exe +git-cmd.exe +cmd +tmp +dev +bin/git.exe +bin/sh.exe +usr/share +usr/ssl +usr/libexec +usr/lib +usr/bin/git* +usr/bin/*vim* +usr/bin/*ssl* +usr/bin/*perl* +usr/bin/*gpg* +usr/bin/*ssh* +usr/bin/*crypto* +usr/bin/*view* +usr/bin/*svn* +usr/bin/ex*.exe +mingw32/share +mingw32/lib +mingw32/etc +mingw32/doc +mingw32/libexec +mingw32/bin/git* +mingw32/bin/Git* +mingw32/bin/Avalonia* +mingw32/bin/xz* +mingw32/bin/*ssl* +mingw32/bin/scalar.exe +mingw32/bin/libSkiaSharp.dll +mingw32/bin/*crypto* +mingw32/bin/*Microsoft.Identity* +mingw32/bin/*bz* +mingw32/bin/tcl* +mingw32/bin/*brotli* +mingw32/bin/av* +mingw32/bin/pdftotext.exe +mingw32/bin/libiconv-2.dll +mingw32/bin/libHarfBuzzSharp.dll +mingw32/bin/SkiaSharp.dll +mingw32/bin/libcurl-4.dll +mingw32/bin/libgmp-10.dll +mingw32/bin/System.Text.Json.dll +mingw32/bin/gcmcore.dll +mingw32/bin/curl.exe + +# Automatically determined by access time +usr/bin/rebase.exe +usr/bin/rebaseall +usr/bin/start +usr/bin/column.exe +usr/bin/dash.exe +usr/bin/getopt.exe +usr/bin/znew +usr/bin/zless +usr/bin/zipinfo.exe +usr/bin/zipgrep +usr/bin/zgrep +usr/bin/zforce +usr/bin/zfgrep +usr/bin/zegrep +usr/bin/zdiff +usr/bin/zcmp +usr/bin/zcat +usr/bin/yes.exe +usr/bin/yat2m.exe +usr/bin/xxd.exe +usr/bin/xgettext.exe +usr/bin/xargs.exe +usr/bin/winpty.exe +usr/bin/wordpad +usr/bin/winpty.dll +usr/bin/winpty-debugserver.exe +usr/bin/winpty-agent.exe +usr/bin/whoami.exe +usr/bin/who.exe +usr/bin/which.exe +usr/bin/watchgnupg.exe +usr/bin/vi +usr/bin/vdir.exe +usr/bin/users.exe +usr/bin/updatedb +usr/bin/update-ca-trust +usr/bin/unzipsfx.exe +usr/bin/unzip.exe +usr/bin/unlink.exe +usr/bin/unix2mac.exe +usr/bin/unix2dos.exe +usr/bin/unexpand.exe +usr/bin/uncompress +usr/bin/umount.exe +usr/bin/u2d.exe +usr/bin/tzset.exe +usr/bin/tty.exe +usr/bin/tsort.exe +usr/bin/tset.exe +usr/bin/trust.exe +usr/bin/truncate.exe +usr/bin/true.exe +usr/bin/tr.exe +usr/bin/tput.exe +usr/bin/touch.exe +usr/bin/toe.exe +usr/bin/timeout.exe +usr/bin/tig.exe +usr/bin/tic.exe +usr/bin/test.exe +usr/bin/tee.exe +usr/bin/tar.exe +usr/bin/tail.exe +usr/bin/tac.exe +usr/bin/tabs.exe +usr/bin/sync.exe +usr/bin/sum.exe +usr/bin/stty.exe +usr/bin/strace.exe +usr/bin/stat.exe +usr/bin/ssp.exe +usr/bin/split.exe +usr/bin/sleep.exe +usr/bin/shuf.exe +usr/bin/shred.exe +usr/bin/sha512sum.exe +usr/bin/sha384sum.exe +usr/bin/sha256sum.exe +usr/bin/sha224sum.exe +usr/bin/sha1sum.exe +usr/bin/sftp.exe +usr/bin/sexp-conv.exe +usr/bin/setmetamode.exe +usr/bin/setfacl.exe +usr/bin/seq.exe +usr/bin/sdiff.exe +usr/bin/scp.exe +usr/bin/runcon.exe +usr/bin/rnano.exe +usr/bin/rmdir.exe +usr/bin/rm.exe +usr/bin/restore +usr/bin/reset.exe +usr/bin/regtool.exe +usr/bin/recode-sr-latin.exe +usr/bin/realpath.exe +usr/bin/readlink.exe +usr/bin/pwd.exe +usr/bin/ptx.exe +usr/bin/psl.exe +usr/bin/psl-make-dafsa +usr/bin/ps.exe +usr/bin/profiler.exe +usr/bin/printf.exe +usr/bin/printenv.exe +usr/bin/pr.exe +usr/bin/pldd.exe +usr/bin/pkcs1-conv.exe +usr/bin/pinky.exe +usr/bin/pinentry.exe +usr/bin/pinentry-w32.exe +usr/bin/pathchk.exe +usr/bin/patch.exe +usr/bin/paste.exe +usr/bin/passwd.exe +usr/bin/p11-kit.exe +usr/bin/od.exe +usr/bin/numfmt.exe +usr/bin/nproc.exe +usr/bin/notepad +usr/bin/nohup.exe +usr/bin/nl.exe +usr/bin/nice.exe +usr/bin/ngettext.exe +usr/bin/nettle-pbkdf2.exe +usr/bin/nettle-lfib-stream.exe +usr/bin/nettle-hash.exe +usr/bin/nano.exe +usr/bin/mv.exe +usr/bin/msys-z.dll +usr/bin/msys-wind-0.dll +usr/bin/msys-unistring-2.dll +usr/bin/msys-ticw6.dll +usr/bin/msys-tasn1-6.dll +usr/bin/msys-sqlite3-0.dll +usr/bin/msys-smartcols-1.dll +usr/bin/msys-serf-1-0.dll +usr/bin/msys-sasl2-3.dll +usr/bin/msys-roken-18.dll +usr/bin/msys-psl-5.dll +usr/bin/msys-pcre2-posix-3.dll +usr/bin/msys-pcre2-8-0.dll +usr/bin/msys-p11-kit-0.dll +usr/bin/msys-npth-0.dll +usr/bin/msys-nettle-8.dll +usr/bin/msys-magic-1.dll +usr/bin/msys-lz4-1.dll +usr/bin/msys-ksba-8.dll +usr/bin/msys-krb5-26.dll +usr/bin/msys-kafs-0.dll +usr/bin/msys-idn2-0.dll +usr/bin/msys-hx509-5.dll +usr/bin/msys-hogweed-6.dll +usr/bin/msys-heimntlm-0.dll +usr/bin/msys-heimbase-1.dll +usr/bin/msys-gssapi-3.dll +usr/bin/msys-gobject-2.0-0.dll +usr/bin/msys-gnutls-30.dll +usr/bin/msys-gmodule-2.0-0.dll +usr/bin/msys-glib-2.0-0.dll +usr/bin/msys-gio-2.0-0.dll +usr/bin/msys-gettextsrc-0-19-8-1.dll +usr/bin/msys-gettextlib-0-19-8-1.dll +usr/bin/msys-gcrypt-20.dll +usr/bin/msys-fido2-1.dll +usr/bin/msys-ffi-7.dll +usr/bin/msys-expat-1.dll +usr/bin/msys-edit-0.dll +usr/bin/msys-crypt-0.dll +usr/bin/msys-com_err-1.dll +usr/bin/msys-cbor-0.11.dll +usr/bin/msys-bz2-1.dll +usr/bin/msys-assuan-0.dll +usr/bin/msys-asn1-8.dll +usr/bin/msys-aprutil-1-0.dll +usr/bin/msys-apr-1-0.dll +usr/bin/msguniq.exe +usr/bin/msgunfmt.exe +usr/bin/msgmerge.exe +usr/bin/msginit.exe +usr/bin/msggrep.exe +usr/bin/msgfmt.exe +usr/bin/msgfilter.exe +usr/bin/msgexec.exe +usr/bin/msgen.exe +usr/bin/msgconv.exe +usr/bin/msgcomm.exe +usr/bin/msgcmp.exe +usr/bin/msgcat.exe +usr/bin/msgattrib.exe +usr/bin/mpicalc.exe +usr/bin/mount.exe +usr/bin/mktemp.exe +usr/bin/mkpasswd.exe +usr/bin/mknod.exe +usr/bin/mkgroup.exe +usr/bin/mkfifo.exe +usr/bin/mkdir.exe +usr/bin/mintty.exe +usr/bin/mintheme +usr/bin/minidumper.exe +usr/bin/md5sum.exe +usr/bin/mac2unix.exe +usr/bin/lsattr.exe +usr/bin/ls.exe +usr/bin/logname.exe +usr/bin/locate.exe +usr/bin/locale.exe +usr/bin/ln.exe +usr/bin/link.exe +usr/bin/lesskey.exe +usr/bin/lessecho.exe +usr/bin/less.exe +usr/bin/ldh.exe +usr/bin/ldd.exe +usr/bin/kill.exe +usr/bin/kbxutil.exe +usr/bin/join.exe +usr/bin/install.exe +usr/bin/infotocap.exe +usr/bin/infocmp.exe +usr/bin/iconv.exe +usr/bin/hostname.exe +usr/bin/hostid.exe +usr/bin/hmac256.exe +usr/bin/head.exe +usr/bin/gzip.exe +usr/bin/gzexe +usr/bin/gunzip +usr/bin/gsettings.exe +usr/bin/groups.exe +usr/bin/gobject-query.exe +usr/bin/gmondump.exe +usr/bin/glib-compile-schemas.exe +usr/bin/gkill.exe +usr/bin/gio-querymodules.exe +usr/bin/gettextize +usr/bin/gettext.sh +usr/bin/gettext.exe +usr/bin/getflags +usr/bin/getfacl.exe +usr/bin/getemojis +usr/bin/getconf.exe +usr/bin/gencat.exe +usr/bin/gdbus.exe +usr/bin/gawk.exe +usr/bin/gawk-5.0.0.exe +usr/bin/gapplication.exe +usr/bin/funzip.exe +usr/bin/fold.exe +usr/bin/fmt.exe +usr/bin/find.exe +usr/bin/file.exe +usr/bin/fgrep +usr/bin/false.exe +usr/bin/factor.exe +usr/bin/envsubst.exe +usr/bin/env.exe +usr/bin/egrep +usr/bin/echo.exe +usr/bin/dumpsexp.exe +usr/bin/du.exe +usr/bin/dos2unix.exe +usr/bin/docx2txt.pl +usr/bin/docx2txt +usr/bin/dirmngr.exe +usr/bin/dirmngr-client.exe +usr/bin/dircolors.exe +usr/bin/dir.exe +usr/bin/diff3.exe +usr/bin/diff.exe +usr/bin/df.exe +usr/bin/dd.exe +usr/bin/date.exe +usr/bin/d2u.exe +usr/bin/cygwin-console-helper.exe +usr/bin/cygcheck.exe +usr/bin/cut.exe +usr/bin/csplit.exe +usr/bin/cp.exe +usr/bin/comm.exe +usr/bin/cmp.exe +usr/bin/clear.exe +usr/bin/cksum.exe +usr/bin/chroot.exe +usr/bin/chown.exe +usr/bin/chmod.exe +usr/bin/chgrp.exe +usr/bin/chcon.exe +usr/bin/chattr.exe +usr/bin/cat.exe +usr/bin/captoinfo.exe +usr/bin/c_rehash +usr/bin/bzless +usr/bin/bzip2recover.exe +usr/bin/bzip2.exe +usr/bin/bzgrep +usr/bin/bzfgrep +usr/bin/bzegrep +usr/bin/bzdiff +usr/bin/bzcmp +usr/bin/bzcat.exe +usr/bin/bunzip2.exe +usr/bin/bashbug +usr/bin/basenc.exe +usr/bin/basename.exe +usr/bin/base64.exe +usr/bin/base32.exe +usr/bin/backup +usr/bin/b2sum.exe +usr/bin/autopoint +usr/bin/astextplain +usr/bin/arch.exe +usr/bin/applygnupgdefaults +usr/bin/addgnupghome +usr/bin/[.exe diff --git a/tools/build_bash.sh b/tools/build_bash.sh new file mode 100644 index 00000000..2f381122 --- /dev/null +++ b/tools/build_bash.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# This script is used to build a customized Git Bash for windows pacakge that only include bash and no other unnecessary files + +# Get script directory +DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd $DIR/../dist + +# Get the git distribution if it doesn't exist +if [ ! -f git.tar.bz2 ]; then + # NOTE: Git for Windows v2.44 is the last release to support Windows 7 and 8 + URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-32-bit.tar.bz2" + wget $URL -O git.tar.bz2 +fi + +# Unzip the git distribution to git directory +# Ignore the unnecessary files +rm -rf git +mkdir git +tar -xvf git.tar.bz2 -C git --exclude-from="$DIR/bash_ignore.txt" \ No newline at end of file diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index ca684dd3..34c3c6d2 100644 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -22,17 +22,8 @@ cd dist # Get the file name file=$(ls | grep .whl) -# Get the git distribution if it doesn't exist -if [ ! -f git.tar.bz2 ]; then - #URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-64-bit.tar.bz2" - # NOTE: Git for Windows v2.44 is the last release to support Windows 7 and 8 - URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-32-bit.tar.bz2" - wget $URL -O git.tar.bz2 -fi - -# Unzip the git distribution to git directory -mkdir git -tar -xvf git.tar.bz2 -C git +# Build bash pacakge +$DIR/build_bash.sh # Unzip the wheel unzip $file -d wheel @@ -44,7 +35,7 @@ cp -r git/ wheel/hyfetch/ new_name="$(echo $file | sed 's/-none-any/-win32/')" # Zip the wheel to win_amd64.whl -cd wheel && zip -r "../$new_name" * && cd .. +cd wheel && zip -y -r "../$new_name" * && cd .. # Check again twine check $new_name \ No newline at end of file From 81f4dc90e8edf5e4cdd4d59b5afde18b33e5661a Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Tue, 23 Apr 2024 07:43:48 -0400 Subject: [PATCH 08/29] [F] Fix current dir --- tools/build_pkg.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index 34c3c6d2..e4c25231 100644 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# Get script directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd $DIR/.. + set -e # Remove the old build From a385480d8930115c240da64aa2f0f5eab9df2bc3 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Tue, 23 Apr 2024 08:31:23 -0400 Subject: [PATCH 09/29] [+] Package fastfetch into hyfetch --- tools/build_bash.sh | 21 +++++++++---- tools/build_pkg.sh | 77 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 84 insertions(+), 14 deletions(-) mode change 100644 => 100755 tools/build_bash.sh mode change 100644 => 100755 tools/build_pkg.sh diff --git a/tools/build_bash.sh b/tools/build_bash.sh old mode 100644 new mode 100755 index 2f381122..d22e8c0a --- a/tools/build_bash.sh +++ b/tools/build_bash.sh @@ -1,19 +1,28 @@ #!/usr/bin/env bash # This script is used to build a customized Git Bash for windows pacakge that only include bash and no other unnecessary files +set -e + # Get script directory DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -cd $DIR/../dist +cd "$DIR/../dist" # Get the git distribution if it doesn't exist -if [ ! -f git.tar.bz2 ]; then +if [ ! -f /tmp/git.tar.bz2 ]; then # NOTE: Git for Windows v2.44 is the last release to support Windows 7 and 8 URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-32-bit.tar.bz2" - wget $URL -O git.tar.bz2 + echo "> Downloading git distribution" + wget -q $URL -O /tmp/git.tar.bz2 fi # Unzip the git distribution to git directory # Ignore the unnecessary files -rm -rf git -mkdir git -tar -xvf git.tar.bz2 -C git --exclude-from="$DIR/bash_ignore.txt" \ No newline at end of file +# rm -rf git +if [ ! -d /tmp/git ]; then + mkdir -p /tmp/git + echo "> Unzipping git distribution" + tar -xf /tmp/git.tar.bz2 --exclude-from="$DIR/bash_ignore.txt" -C /tmp/git +fi + +# Copy the git distribution +cp -r /tmp/git ./git diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh old mode 100644 new mode 100755 index e4c25231..cfd2978a --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash +FASTFETCH_VERSION="2.10.2" +FASTFETCH_DL="https://github.com/fastfetch-cli/fastfetch/releases/download/$FASTFETCH_VERSION/" + # Get script directory DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -cd $DIR/.. +cd "$DIR/.." set -e @@ -17,29 +20,87 @@ rm -rf hyfetch/git/ python3 setup.py sdist bdist_wheel # Check -twine check dist/* +twine check dist/*.tar.gz +twine check dist/*.whl # ================= # Build for windows cd dist # Get the file name -file=$(ls | grep .whl) +# file="$(ls | grep .whl)" use glob instead +file=$(echo *-none-any.whl) # Build bash pacakge -$DIR/build_bash.sh +"$DIR/build_bash.sh" # Unzip the wheel -unzip $file -d wheel +echo "> Unzipping $file" +rm -rf wheel +unzip -qq "$file" -d wheel +# TODO: Find a way to exclude the tools folder +rm -rf wheel/tools # Copy the git distribution to the wheel cp -r git/ wheel/hyfetch/ +# Embed fastfetch binary +echo "> Embedding fastfetch binary" +wget -q "$FASTFETCH_DL/fastfetch-windows-i686.zip" -O fastfetch-windows.zip +mkdir -p wheel/hyfetch/fastfetch +bsdtar -zxf fastfetch-windows.zip -C wheel/hyfetch/fastfetch +rm -rf fastfetch-windows.zip + # Change the file name (replace -none-any with -win_amd64) -new_name="$(echo $file | sed 's/-none-any/-win32/')" +new_name=${file/-any/-win32} # Zip the wheel to win_amd64.whl -cd wheel && zip -y -r "../$new_name" * && cd .. +cd wheel && zip -qq -y -r "../$new_name" * && cd .. # Check again -twine check $new_name \ No newline at end of file +twine check "$new_name" + +# ================= +# Build for linux + +# Now we're done with windows, delete the git folder +rm -rf wheel/git + +function build_for_platform() { + ff_platform=$1 + wheel_platform=$2 + + echo "Building for $ff_platform" + + # Download the fastfetch binary + wget -q "$FASTFETCH_DL/fastfetch-$ff_platform.zip" -O "fastfetch-$ff_platform.zip" + + # Delete the old fastfetch folder + rm -rf wheel/hyfetch/fastfetch + + # Unzip the fastfetch binary + # unzip -qq "fastfetch-$ff_platform.zip" -d wheel/hyfetch/fastfetch + mkdir -p wheel/hyfetch/fastfetch + bsdtar -zxf "fastfetch-$ff_platform.zip" -C wheel/hyfetch/fastfetch --strip-components 1 + rm -rf "fastfetch-$ff_platform.zip" + + # Change the file name + new_name=${file/-any/-"$wheel_platform"} + + # Zip the wheel to platform.whl + cd wheel && zip -qq -y -r "../$new_name" * && cd .. + + # Check again + twine check "$new_name" +} + +# See https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/ +build_for_platform "linux-amd64" "manylinux1_x86_64" +build_for_platform "linux-aarch64" "manylinux2014_aarch64" +# There doesn't seem to be tags for freebsd? +# build_for_platform "freebsd-amd64" "freebsd_x86_64" +# build_for_platform "freebsd-aarch64" "freebsd_aarch64" +build_for_platform "musl-amd64" "musllinux_1_1_x86_64" +build_for_platform "musl-aarch64" "musllinux_1_1_aarch64" +build_for_platform "macos-universal" "macosx_11_0_x86_64" +build_for_platform "macos-universal" "macosx_11_0_arm64" From 1c9480b7647c25ede8b2eab2ac9d6549d7e9f096 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Tue, 23 Apr 2024 08:36:16 -0400 Subject: [PATCH 10/29] [+] Get bundled fastfetch path --- hyfetch/neofetch_util.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hyfetch/neofetch_util.py b/hyfetch/neofetch_util.py index 40019dc1..df57cd32 100644 --- a/hyfetch/neofetch_util.py +++ b/hyfetch/neofetch_util.py @@ -24,6 +24,7 @@ from .serializer import from_dict from .types import BackendLiteral, ColorAlignMode RE_NEOFETCH_COLOR = re.compile('\\${c[0-9]}') +SRC = Path(__file__).parent def literal_input(prompt: str, options: Iterable[str], default: str, show_ops: bool = True) -> str: @@ -401,6 +402,16 @@ def run_fastfetch(asc: str, args: str = '', legacy: bool = False): :param args: Additional arguments to pass to fastfetch :param legacy: Set true when using fastfetch < 1.8.0 """ + # Find fastfetch binary + ff_path = (shutil.which('fastfetch') + or if_file(SRC / 'fastfetch/usr/bin/fastfetch') + or if_file(SRC / 'fastfetch/fastfetch') + or if_file(SRC / 'fastfetch/fastfetch.exe')) + + if not ff_path: + printc("&cError: fastfetch binary is not found. Please install fastfetch first.") + exit(127) + # Write temp file with TemporaryDirectory() as tmp_dir: tmp_dir = Path(tmp_dir) @@ -408,7 +419,7 @@ def run_fastfetch(asc: str, args: str = '', legacy: bool = False): path.write_text(asc) # Call fastfetch with the temp file - proc = subprocess.run(['fastfetch', '--raw' if legacy else '--file-raw', path.absolute(), *shlex.split(args)]) + proc = subprocess.run([ff_path, '--raw' if legacy else '--file-raw', path.absolute(), *shlex.split(args)]) if proc.returncode == 144: printc("&6Error code 144 detected: Please upgrade fastfetch to >=1.8.0 or use the 'fastfetch-old' backend") From 1e30a7701f499746ee9abacca46a214c976a3e90 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Tue, 23 Apr 2024 08:38:07 -0400 Subject: [PATCH 11/29] [-] Remove GIT URL --- hyfetch/constants.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hyfetch/constants.py b/hyfetch/constants.py index 48571f1b..2205fa65 100644 --- a/hyfetch/constants.py +++ b/hyfetch/constants.py @@ -31,6 +31,7 @@ IS_WINDOWS = platform.system() == 'Windows' CACHE_PATH = Path(os.getenv("LOCALAPPDATA") or os.getenv("XDG_CACHE_HOME") or Path.home() / '.cache') / 'hyfetch' + @dataclass class GlobalConfig: # Global color mode default to 8-bit for compatibility @@ -49,6 +50,4 @@ class GlobalConfig: return 0.65 if term.lower() == 'dark' else 0.4 -GLOBAL_CFG = GlobalConfig(color_mode='8bit', override_distro=None, debug=False, is_light=False, use_overlay=False) - -GIT_URL = 'https://github.com/git-for-windows/git/releases/download/v2.37.2.windows.2/Git-2.37.2.2-32-bit.tar.bz2' +GLOBAL_CFG = GlobalConfig(color_mode='8bit', override_distro=None, debug=False, is_light=False, use_overlay=True) From 5c34876c538cede13ffe8bf21275151b7259a511 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Tue, 23 Apr 2024 08:54:21 -0400 Subject: [PATCH 12/29] [O] Greatly simplify things --- .gitignore | 1 + hyfetch/neofetch_util.py | 103 ++++++++++++--------------------------- 2 files changed, 31 insertions(+), 73 deletions(-) diff --git a/.gitignore b/.gitignore index a32565bc..6b5d6854 100644 --- a/.gitignore +++ b/.gitignore @@ -120,3 +120,4 @@ webhook-log start_moderation.sh gh_moderator.toml moderator-data +hyfetch/git \ No newline at end of file diff --git a/hyfetch/neofetch_util.py b/hyfetch/neofetch_util.py index df57cd32..f9f13ee1 100644 --- a/hyfetch/neofetch_util.py +++ b/hyfetch/neofetch_util.py @@ -7,17 +7,14 @@ import shlex import shutil import subprocess import sys -import tarfile from dataclasses import dataclass from pathlib import Path from subprocess import check_output from tempfile import TemporaryDirectory from typing import Iterable -import pkg_resources - from .color_util import color, printc -from .constants import GLOBAL_CFG, GIT_URL, IS_WINDOWS +from .constants import GLOBAL_CFG, IS_WINDOWS from .distros import distro_detector from .presets import ColorProfile from .serializer import from_dict @@ -198,24 +195,13 @@ def get_command_path() -> str: :return: Command path """ - cmd_path = pkg_resources.resource_filename(__name__, 'scripts/neowofetch') + cmd_path = (if_file(SRC.parent / 'neofetch') or if_file(SRC / 'scripts/neowofetch')) - # Windows doesn't support symbolic links, but also I can't detect symbolic links... hard-code it here for now. - if IS_WINDOWS: - pkg = Path(__file__).parent - pth = (shutil.which("neowofetch") or - if_file(cmd_path) or - if_file(pkg / 'scripts/neowofetch') or - if_file(pkg.parent / 'neofetch') or - if_file(Path(cmd_path).parent.parent.parent / 'neofetch')) + if not cmd_path: + printc("&cError: Neofetch script cannot be found") + exit(127) - if not pth: - printc("&cError: Neofetch script cannot be found") - exit(127) - - return str(pth) - - return cmd_path + return str(cmd_path) def ensure_git_bash() -> Path: @@ -224,48 +210,19 @@ def ensure_git_bash() -> Path: :returns git bash path """ - if IS_WINDOWS: - # Find installation in default path - def_path = Path(r'C:\Program Files\Git\bin\bash.exe') - if def_path.is_file(): - return def_path + if not IS_WINDOWS: + return Path('/usr/bin/bash') - # Detect third-party git.exe in path - git_exe = shutil.which("bash") or shutil.which("git.exe") or shutil.which("git") - if git_exe is not None: - pth = Path(git_exe).parent - if (pth / r'bash.exe').is_file(): - return pth / r'bash.exe' - elif (pth / r'bin\bash.exe').is_file(): - return pth / r'bin\bash.exe' + # Bundled git bash + git_path = (if_file(SRC / 'git/bin/bash.exe') + or if_file("C:/Program Files/Git/bin/bash.exe") + or if_file("C:/Program Files (x86)/Git/bin/bash.exe")) - # Find installation in PATH (C:\Program Files\Git\cmd should be in path) - pth = (os.environ.get('PATH') or '').lower().split(';') - pth = [p for p in pth if p.endswith(r'\git\cmd')] - if pth: - return Path(pth[0]).parent / r'bin\bash.exe' + if not git_path.is_file(): + printc("&cError: Git Bash installation not found") + sys.exit(127) - # Previously downloaded portable installation - path = Path(__file__).parent / 'min_git' - portable_bash_exe = path / r'bin\bash.exe' - if path.is_dir() and portable_bash_exe.is_file(): - return portable_bash_exe - - # No installation found, download a portable installation - Path.mkdir(path, parents=True, exist_ok=True) - pkg_path = path / 'package.tbz' - print('Git installation not found. Git Bash is required to use HyFetch/neofetch on Windows') - if literal_input('Would you like to download and install Git into HyFetch package directory? (if no is selected colors almost certainly won\'t work)', ['yes', 'no'], 'yes', False) == 'yes': - print('Downloading a portable version of Git...') - from urllib.request import urlretrieve - urlretrieve(GIT_URL, pkg_path) - print('Download finished! Extracting...') - with tarfile.open(pkg_path, 'r:bz2') as tbz_ref: - tbz_ref.extractall(path) - print('Done!') - return portable_bash_exe - else: - sys.exit() + return git_path def check_windows_cmd(): @@ -273,14 +230,14 @@ def check_windows_cmd(): Check if this script is running under cmd.exe. If so, launch an external window with git bash since cmd doesn't support RGB colors. """ - if IS_WINDOWS: - import psutil - # TODO: This line does not correctly identify cmd prompts... - if psutil.Process(os.getppid()).name().lower().strip() == 'cmd.exe': - print("cmd.exe doesn't support RGB colors, restarting in MinTTY...") - cmd = f'"{ensure_git_bash().parent.parent / "usr/bin/mintty.exe"}" -s 110,40 -e python -m hyfetch --ask-exit' - os.system(cmd) - sys.exit(0) + # if IS_WINDOWS: + # import psutil + # # TODO: This line does not correctly identify cmd prompts... + # if psutil.Process(os.getppid()).name().lower().strip() == 'cmd.exe': + # print("cmd.exe doesn't support RGB colors, restarting in MinTTY...") + # cmd = f'"{ensure_git_bash().parent.parent / "usr/bin/mintty.exe"}" -s 110,40 -e python -m hyfetch --ask-exit' + # os.system(cmd) + # sys.exit(0) def run_neofetch_cmd(args: str, pipe: bool = False) -> str | None: @@ -294,8 +251,7 @@ def run_neofetch_cmd(args: str, pipe: bool = False) -> str | None: cmd = get_command_path().replace("\\", "/").replace("C:/", "/c/") args = args.replace('\\', '/').replace('C:/', '/c/') - full_cmd = [ensure_git_bash(), '-c', f"'{cmd}' {args}"] - # print(full_cmd) + full_cmd = [ensure_git_bash(), cmd, *shlex.split(args)] if pipe: return check_output(full_cmd).decode().strip() @@ -354,10 +310,10 @@ def run(asc: str, backend: BackendLiteral, args: str = ''): def run_qwqfetch(asc: str, args: str = ''): """ - Run neofetch with colors + Run qwqfetch with colors - :param preset: Color palette - :param alignment: Color alignment settings + :param asc: Ascii art + :param args: Additional arguments to pass to qwqfetch """ asc = asc.replace('\\', '\\\\') @@ -370,7 +326,8 @@ def run_qwqfetch(asc: str, args: str = ''): except ImportError as e: # module not found etc print("qwqfetch is not installed. Install it by executing:") # use print to output hint directly print("pip install git+https://github.com/nexplorer-3e/qwqfetch") # TODO: public repo - raise e + exit(127) + def run_neofetch(asc: str, args: str = ''): """ From 25a64b6ce3249001827338da6942f6ba0d10b570 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Tue, 23 Apr 2024 08:57:39 -0400 Subject: [PATCH 13/29] [O] Finalize build process --- tools/build_pkg.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index cfd2978a..07dd7d63 100755 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -104,3 +104,6 @@ build_for_platform "musl-amd64" "musllinux_1_1_x86_64" build_for_platform "musl-aarch64" "musllinux_1_1_aarch64" build_for_platform "macos-universal" "macosx_11_0_x86_64" build_for_platform "macos-universal" "macosx_11_0_arm64" + +# Finally, remove temporary files +rm -rf wheel git \ No newline at end of file From 9cebc9df35288b1f086175c7d2aeb15c5b41655c Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Tue, 23 Apr 2024 08:59:00 -0400 Subject: [PATCH 14/29] [U] Bump version 1.5.0alpha1 --- hyfetch/__version__.py | 2 +- tools/build_pkg.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hyfetch/__version__.py b/hyfetch/__version__.py index 6752860d..ed27d9f8 100644 --- a/hyfetch/__version__.py +++ b/hyfetch/__version__.py @@ -1 +1 @@ -VERSION = '1.4.11' +VERSION = '1.5.0alpha1' diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index 07dd7d63..d0d27651 100755 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -106,4 +106,4 @@ build_for_platform "macos-universal" "macosx_11_0_x86_64" build_for_platform "macos-universal" "macosx_11_0_arm64" # Finally, remove temporary files -rm -rf wheel git \ No newline at end of file +rm -rf wheel git From bb156173b547d2897a4c05174a310388ea5c2411 Mon Sep 17 00:00:00 2001 From: Ryan Rotter Date: Wed, 24 Apr 2024 22:01:54 -0400 Subject: [PATCH 15/29] correct M2 Mac Studio hw.model per https://support.apple.com/en-us/102231 --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 4a145414..e55cc921 100755 --- a/neofetch +++ b/neofetch @@ -1589,8 +1589,8 @@ get_model() { case $model in Mac14,15): "MacBook Air (15-inch, M2, 2023)" ;; - Mac14,14): "Mac Studio (M2 Max, 2023)" ;; - Mac14,13): "Mac Studio (M2 Ultra, 2023)" ;; + Mac14,14): "Mac Studio (M2 Ultra, 2023)" ;; + Mac14,13): "Mac Studio (M2 Max, 2023)" ;; Mac14,8): "Mac Pro (2023)" ;; Mac14,6 | Mac14,10): "MacBook Pro (16-inch, 2023)" ;; Mac14,5 | Mac14,9): "MacBook Pro (14-inch, 2023)" ;; From 9292a602df857cbb489e9fe32e496d57965afea8 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Wed, 24 Apr 2024 23:39:37 -0400 Subject: [PATCH 16/29] [O] NixOS XDG path #255 --- neofetch | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index e55cc921..564ff7da 100755 --- a/neofetch +++ b/neofetch @@ -2168,6 +2168,15 @@ get_packages() { # Other (Needs complex command) has kpm-pkg && ((packages+=$(kpm --get-selections | grep -cv deinstall$))) + nix-user-pkgs() { + if [ -d ~/.nix-profile ]; then + nix-store -qR ~/.nix-profile + elif [ -d "$XDG_STATE_HOME/nix/profile" ]; then + nix-store -qR "$XDG_STATE_HOME/nix/profile" + fi + nix-store -qR /etc/profiles/per-user/"$USER" + } + # Separate system and user packages if [[ $package_separate == on ]]; then has guix && { @@ -2177,10 +2186,6 @@ get_packages() { } has nix-store && { - nix-user-pkgs() { - nix-store -qR ~/.nix-profile - nix-store -qR /etc/profiles/per-user/"$USER" - } manager=nix-system && tot nix-store -qR /run/current-system/sw manager=nix-user && tot nix-user-pkgs manager=nix-default && tot nix-store -qR /nix/var/nix/profiles/default @@ -2202,8 +2207,7 @@ get_packages() { has nix-store && { nix-all() { - nix-store -qR ~/.nix-profile - nix-store -qR /etc/profiles/per-user/"$USER" + nix-user-pkgs nix-store -qR /run/current-system/sw nix-store -qR /nix/var/nix/profiles/default } From d8bb0097c171a6bb0489e042305e1cfd6c507a1a Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Wed, 24 Apr 2024 23:45:13 -0400 Subject: [PATCH 17/29] [+] Add win_amd64 build --- tools/build_pkg.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index d0d27651..df51c6ba 100755 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -56,6 +56,7 @@ new_name=${file/-any/-win32} # Zip the wheel to win_amd64.whl cd wheel && zip -qq -y -r "../$new_name" * && cd .. +cp "$new_name" "${new_name/.whl/-win_amd64.whl}" # Check again twine check "$new_name" From c7d6c753d9296d0e431ee6b532ce3a16cd8f5160 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Thu, 25 Apr 2024 00:34:32 -0400 Subject: [PATCH 18/29] [O] Specify glibc version in manylinux package --- tools/build_pkg.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index df51c6ba..568aa565 100755 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -96,13 +96,15 @@ function build_for_platform() { } # See https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/ -build_for_platform "linux-amd64" "manylinux1_x86_64" -build_for_platform "linux-aarch64" "manylinux2014_aarch64" +# The official fastfetch build uses Ubuntu 22.04 with glibc 2.34 +build_for_platform "linux-amd64" "manylinux_2_34_x86_64" +build_for_platform "linux-aarch64" "manylinux_2_34_aarch64" # There doesn't seem to be tags for freebsd? # build_for_platform "freebsd-amd64" "freebsd_x86_64" # build_for_platform "freebsd-aarch64" "freebsd_aarch64" build_for_platform "musl-amd64" "musllinux_1_1_x86_64" build_for_platform "musl-aarch64" "musllinux_1_1_aarch64" +# The official fastfetch build uses macOS 12.0 build_for_platform "macos-universal" "macosx_11_0_x86_64" build_for_platform "macos-universal" "macosx_11_0_arm64" From 51f0ebf3eadeb24f83e2e337d5118dc7369767f0 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Fri, 26 Apr 2024 02:33:11 -0400 Subject: [PATCH 19/29] [U] Change glibc version according to fastfetch upstream --- tools/build_pkg.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index 568aa565..3f770209 100755 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -96,9 +96,9 @@ function build_for_platform() { } # See https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/ -# The official fastfetch build uses Ubuntu 22.04 with glibc 2.34 -build_for_platform "linux-amd64" "manylinux_2_34_x86_64" -build_for_platform "linux-aarch64" "manylinux_2_34_aarch64" +# The official fastfetch build uses Ubuntu 20.04 with glibc 2.31 +build_for_platform "linux-amd64" "manylinux_2_31_x86_64" +build_for_platform "linux-aarch64" "manylinux_2_31_aarch64" # There doesn't seem to be tags for freebsd? # build_for_platform "freebsd-amd64" "freebsd_x86_64" # build_for_platform "freebsd-aarch64" "freebsd_aarch64" @@ -107,6 +107,7 @@ build_for_platform "musl-aarch64" "musllinux_1_1_aarch64" # The official fastfetch build uses macOS 12.0 build_for_platform "macos-universal" "macosx_11_0_x86_64" build_for_platform "macos-universal" "macosx_11_0_arm64" +# TODO: linux_riscv64 # Finally, remove temporary files rm -rf wheel git From 5bafa5128b6b10367f413118d8da9f7595bfeed1 Mon Sep 17 00:00:00 2001 From: techie2000 <38585780+techie2000@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:12:33 +0100 Subject: [PATCH 20/29] docs: Update README.md Modify method 3. Fixes #258 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a2a210a..2db41b15 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This repo also serves as an updated version of the original `neofetch` since the * Method 1: `pip install -U hyfetch` then run `neowofetch` * Method 2: `npx neowofetch` -* Method 3: `P="$HOME/.local/bin/neowofetch" curl -L nf.hydev.org -o $P && chmod +x $P` +* Method 3: `P="$HOME/.local/bin/neowofetch" && curl -L nf.hydev.org -o "$P" && chmod +x "$P"` * Method 4: Run without install `bash <(curl -sL nf.hydev.org)` From 3a415600d524895d0cea22264042eb92aeabfcdd Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 30 Apr 2024 13:16:49 +0000 Subject: [PATCH 21/29] Add --package_minimal Reduces 'packages' output by omitting language package managers and Steam games, improving execution speed --- neofetch | 71 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/neofetch b/neofetch index 564ff7da..cf233d0e 100755 --- a/neofetch +++ b/neofetch @@ -235,6 +235,15 @@ package_managers="on" # off: '17 packages (flatpak)' package_separate="on" +# Reduce output of packages list by not showing programming language package managers or Steam games +# +# Flag: --package_minimal +# +# Example: +# default: 'Packages: 1 (npm), 991 (emerge), 3 (steam), 23 (flatpak-system)' +# minimal: 'Packages: 991 (emerge), 23 (flatpak-system)' +package_minimal="" + # Shell @@ -2066,28 +2075,29 @@ get_packages() { } } - # OS-independent package managers. - has pipx && tot pipx list --short - has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs" - has am && pac "$(am -f --less)" + # Programming language package managers. + if [[ -z "$package_minimal" ]]; then + has pipx && tot pipx list --short + has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs" - # Special case for npm: If has npm, we should list folders under node_modules instead of using npm list. - # This is because npm list is very slow (2s) - if has npm; then - # Try to apply heuristics to find the global directory. - if [[ -d /usr/lib/node_modules ]]; then - dir /usr/lib/node_modules/*/ - elif [[ -d /usr/local/lib/node_modules ]]; then - dir /usr/local/lib/node_modules/*/ - else - # If neither exist, use npm root -g to get the global directory. - # (still ~10x faster than npm list) - npm_global=$(npm root -g) - [[ -d $npm_global ]] && dir "$npm_global"/*/ + # Special case for npm: If has npm, we should list folders under node_modules instead of using npm list. + # This is because npm list is very slow (2s) + if has npm; then + # Try to apply heuristics to find the global directory. + if [[ -d /usr/lib/node_modules ]]; then + dir /usr/lib/node_modules/*/ + elif [[ -d /usr/local/lib/node_modules ]]; then + dir /usr/local/lib/node_modules/*/ + else + # If neither exist, use npm root -g to get the global directory. + # (still ~10x faster than npm list) + npm_global=$(npm root -g) + [[ -d $npm_global ]] && dir "$npm_global"/*/ - # This may not work in WSL2 (if npm is installed on Windows, not WSL). - # However, if npm is not installed on this WSL subsystem, it doesn't really count - # as a package manager for this subsystem, so let's ignore this case. + # This may not work in WSL2 (if npm is installed on Windows, not WSL). + # However, if npm is not installed on this WSL subsystem, it doesn't really count + # as a package manager for this subsystem, so let's ignore this case. + fi fi fi @@ -2121,6 +2131,7 @@ get_packages() { has squirrel && tot ls /var/packages has pkgx && tot find "$HOME/.pkgx" -maxdepth 2 -mindepth 2 -type d has anise && tot anise s --installed + has am && pac "$(am -f --less)" # Using the dnf package cache is much faster than rpm. if has dnf && type -p sqlite3 >/dev/null && [[ -f /var/cache/dnf/packages.db ]]; then @@ -2155,14 +2166,16 @@ get_packages() { shopt -u nullglob } - # Steam games - STEAM_P=".local/share/Steam/steamapps/common" - if [[ -d "$HOME/$STEAM_P" ]]; then - manager=steam && dir "$HOME/$STEAM_P/*/" - elif [[ -d "$HOME/.var/app/com.valvesoftware.Steam/$STEAM_P" ]]; then - manager=steam && dir "$HOME/.var/app/com.valvesoftware.Steam/$STEAM_P/*/" - elif [[ -d "$HOME/.steam/steam/steamapps/common" ]]; then - manager=steam && dir "$HOME/.steam/steam/steamapps/common/*/" + if [[ -z "$package_minimal" ]]; then + # Steam games + STEAM_P=".local/share/Steam/steamapps/common" + if [[ -d "$HOME/$STEAM_P" ]]; then + manager=steam && dir "$HOME/$STEAM_P/*/" + elif [[ -d "$HOME/.var/app/com.valvesoftware.Steam/$STEAM_P" ]]; then + manager=steam && dir "$HOME/.var/app/com.valvesoftware.Steam/$STEAM_P/*/" + elif [[ -d "$HOME/.steam/steam/steamapps/common" ]]; then + manager=steam && dir "$HOME/.steam/steam/steamapps/common/*/" + fi fi # Other (Needs complex command) @@ -6368,6 +6381,7 @@ INFO: --title_fqdn on/off Hide/Show Fully Qualified Domain Name in title. --package_managers on/off Hide/Show Package Manager names. (on, tiny, off) --package_separate on/off Whether to separate system/user modes for supported package managers + --package_minimal Reduce output of packages list by not showing programming language package managers or Steam games --os_arch on/off Hide/Show OS architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios, @@ -6637,6 +6651,7 @@ get_args() { "--title_fqdn") title_fqdn="$2" ;; "--package_managers") package_managers="$2" ;; "--package_separate") package_separate="$2" ;; + "--package_minimal") package_minimal="1" ;; "--os_arch") os_arch="$2" ;; "--cpu_cores") cpu_cores="$2" ;; "--cpu_speed") cpu_speed="$2" ;; From bb5f45a71cc4b79f93060e11096b28611ebcffc8 Mon Sep 17 00:00:00 2001 From: pokemonpasta Date: Wed, 1 May 2024 12:56:24 +0100 Subject: [PATCH 22/29] Add girlflux and genderflux flags --- hyfetch/presets.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hyfetch/presets.py b/hyfetch/presets.py index d61bbc06..aafd768c 100644 --- a/hyfetch/presets.py +++ b/hyfetch/presets.py @@ -519,6 +519,27 @@ PRESETS: dict[str, ColorProfile] = { '#5276D4', ]).with_weights([1, 1, 1, 1, 1, 5, 5, 5])), + # sourced from https://commons.wikimedia.org/wiki/File:Girlflux_Pride_Flag.jpg + "girlflux": ColorProfile([ + "f9e6d7", + "f2526c", + "bf0311", + "e9c587", + "bf0311", + "f2526c", + "f9e6d7", + ]), + + # sourced from https://www.deviantart.com/pride-flags/art/Genderflux-1-543925589 + "genderflux": ColorProfile([ + "f47694", + "f2a2b9", + "cecece", + "7ce0f7", + "3ecdf9", + "fff48d", + ]), + "finsexual": ColorProfile([ "#B18EDF", "#D7B1E2", From 6816679ad9e138f79bf1e946e4cddbde4e008c80 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Wed, 1 May 2024 21:36:25 -0300 Subject: [PATCH 23/29] Improve pkgx integration --- neofetch | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index cf233d0e..9a9c2a10 100755 --- a/neofetch +++ b/neofetch @@ -2101,6 +2101,13 @@ get_packages() { fi fi + if has pkgx && [[ -d "$HOME/.local/bin" ]]; then + # https://github.com/pkgxdev/pkgx/issues/985#issuecomment-2080999008 + _pkgxpkgs="$(grep -rIhoP 'exec pkgx \+\K[^ ]+' "$HOME/.local/bin" | sort -u)" + tot echo "$_pkgxpkgs" + unset _pkgxpkgs + fi + # OS-specific package managers. case $os in Linux|BSD|"iPhone OS"|Solaris|illumos|Interix) @@ -2129,7 +2136,6 @@ get_packages() { has pm && tot-safe pm list packages has evox && tot cat /var/evox/packages/DB has squirrel && tot ls /var/packages - has pkgx && tot find "$HOME/.pkgx" -maxdepth 2 -mindepth 2 -type d has anise && tot anise s --installed has am && pac "$(am -f --less)" @@ -2275,7 +2281,6 @@ get_packages() { has brew && dir "$(brew --cellar)/* $(brew --caskroom)/*" has pkgin && tot pkgin list has dpkg && tot dpkg-query -f '.\n' -W - has tea && tot find "$HOME/.tea" -maxdepth 2 -mindepth 2 -type d has nix-store && { nix-user-pkgs() { From 8eadfec466173a10c4e3dd4a2ae142a49ac7e437 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Thu, 2 May 2024 17:15:59 -0400 Subject: [PATCH 24/29] Update neofetch --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index cf233d0e..0601fae7 100755 --- a/neofetch +++ b/neofetch @@ -2411,7 +2411,7 @@ get_editor() { [[ -z "$editor_full_path" ]] && return # Actually obtain the full path - editor_full_path="$(which "${editor_full_path}" 2>/dev/null)" + editor_full_path="$(command -v "${editor_full_path}" 2>/dev/null)" # Resolve symlink and get the original name [[ -L "$editor_full_path" ]] && editor_full_path="$(readlink -f "$editor_full_path")" @@ -2426,7 +2426,7 @@ get_editor() { # Obtain editor version case ${editor_name:=${editor_full_path##*/}} in - nano|vim|micro|emacs) + nano|vim|nvim|micro|emacs) editor_v=$("$editor_full_path" --version 2>&1) ;; kak) From 41d767fa4efe5d828ecf1d55bedd19d7e1ceff8d Mon Sep 17 00:00:00 2001 From: Bailey Kasin Date: Thu, 2 May 2024 21:50:58 -0700 Subject: [PATCH 25/29] Use kinfo when plasma6 is detected Signed-off-by: Bailey Kasin --- neofetch | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 27d7bea5..e3bb7836 100755 --- a/neofetch +++ b/neofetch @@ -2546,9 +2546,20 @@ get_de() { esac ((${KDE_SESSION_VERSION:-0} >= 4)) && de=${de/KDE/Plasma} + ((${KDE_SESSION_VERSION:-0} >= 6)) && de=${de/Plasma/Plasma6} if [[ $de_version == on && $de ]]; then case $de in + Plasma6*) + de_ver=$(plasmashell --version) + kf_ver=$(kinfo) + qt_ver=${kf_ver/Kernel*} + qt_ver=${qt_ver/*:} + qt_ver=$(trim "$qt_ver") + kf_ver=${kf_ver/Qt*} + kf_ver=${kf_ver/*:} + kf_ver=$(trim "$kf_ver") + ;; Plasma*) de_ver=$(plasmashell --version) kf_ver=$(kf5-config --version) @@ -2582,7 +2593,7 @@ get_de() { de+=" $de_ver" - [[ $de == "Plasma"* ]] && de+=" [KF5 $kf_ver] [Qt $qt_ver]" + [[ $de == "Plasma"* ]] && de="Plasma $de_ver [KF $kf_ver] [Qt $qt_ver]" fi # TODO: From 18107d9601ef1c46ffb9d1f42d25292ea125c313 Mon Sep 17 00:00:00 2001 From: Bailey Kasin <31324979+BKasin@users.noreply.github.com> Date: Sun, 5 May 2024 23:02:01 -0700 Subject: [PATCH 26/29] [+] Add Ubuntu install note --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2db41b15..055348d2 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Currently, these distributions have existing packages for HyFetch: * Homebrew: `brew install hyfetch` (Thanks to [@BKasin](https://github.com/BKasin) and [@osalbahr](https://github.com/osalbahr)) * openSUSE Tumbleweed: `zypper in python311-hyfetch` (Thanks to [@BKasin](https://github.com/BKasin)) * Gentoo: `emerge --ask app-misc/hyfetch` (Thanks to [@BKasin](https://github.com/BKasin)) -* Debian `apt install hyfetch` (for Debian flavor >= [Trixie](https://packages.debian.org/trixie/hyfetch)) +* Debian and Ubuntu `apt install hyfetch` (for Debian flavor >= [Trixie](https://packages.debian.org/trixie/hyfetch), Ubuntu flavor >= [Noble](https://packages.ubuntu.com/noble/hyfetch)) (Thanks to [@BKasin](https://github.com/BKasin)) [![Packaging status](https://repology.org/badge/vertical-allrepos/hyfetch.svg?columns=4&exclude_unsupported=1)](https://repology.org/project/hyfetch/versions) From 413a7d3681a7a8172be0e28a379d49b4fb483b55 Mon Sep 17 00:00:00 2001 From: Bailey Kasin <31324979+BKasin@users.noreply.github.com> Date: Mon, 6 May 2024 19:41:54 -0700 Subject: [PATCH 27/29] Add except for KDE neon to *buntu version check --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index e3bb7836..d90f0e03 100755 --- a/neofetch +++ b/neofetch @@ -1197,7 +1197,7 @@ get_distro() { elif type -p lsb_release >/dev/null; then # Debian does not include .x versions in /etc/os-version, but does in debian_version # So if that file exists, and we are not *buntu, build name from there - if [[ -f /etc/debian_version ]] && [[ $(lsb_release -si) != *"buntu"* ]]; then + if [[ -f /etc/debian_version ]] && [[ $(lsb_release -si) != *"buntu"* ]] && [[ $(lsb_release -si) != *"neon"* ]]; then . /etc/os-release case $distro_shorthand in on) distro="${NAME}" ;; From f06c3fda314f5120a5b865a9f0b4ddaf359e7d81 Mon Sep 17 00:00:00 2001 From: Mischa Soderlund <168781923+msoderlund2027@users.noreply.github.com> Date: Wed, 8 May 2024 19:51:08 -0400 Subject: [PATCH 28/29] Added fraysexual flag! In reference to issue #275. --- hyfetch/presets.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hyfetch/presets.py b/hyfetch/presets.py index aafd768c..c5763b0c 100644 --- a/hyfetch/presets.py +++ b/hyfetch/presets.py @@ -670,6 +670,14 @@ PRESETS: dict[str, ColorProfile] = { "#89C7B0", "#F3EDBD", ]), + + # sampled from https://es.m.wikipedia.org/wiki/Archivo:Fraysexual_flag.jpg + 'fraysexual': ColorProfile([ + '#226CB5', + '#94E7DD', + '#FFFFFF', + '#636363', + ]), # Meme flags 'beiyang': ColorProfile([ From 293889b9ad93567e7f29e5d85d2464153417c77e Mon Sep 17 00:00:00 2001 From: topazus <77263945+topazus@users.noreply.github.com> Date: Fri, 10 May 2024 16:55:40 +0800 Subject: [PATCH 29/29] hyfetch is in Fedora official repo --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 055348d2..9e6136c9 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Currently, these distributions have existing packages for HyFetch: * Universal [Lure.sh](https://lure.sh/): `lure in hyfetch` (Thanks to [@Elara6331](https://github.com/Elara6331)) * Arch Linux: `sudo pacman -S hyfetch` (Thanks to [@Aleksana](https://github.com/Aleksanaa) and [@Antiz96](https://github.com/Antiz96)) +* Fedora Linux: `sudo dnf install hyfetch` (packaged by [@topazus](http://github.com/topazus)) * Nix: `nix-env -i hyfetch` (Thanks to [@YisuiDenghua](https://github.com/YisuiDenghua)) * Nix Profile: `nix profile install nixpkgs#hyfetch` * Guix: `guix install hyfetch` (Thanks to [@WammKD](https://github.com/WammKD))