From 457a90d7d6087155ee839c064a06cbc12c50a7e9 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 14 Apr 2023 13:35:54 +0200 Subject: [PATCH] neofetch: Add support for fastfetch(1) --- plugins/neofetch/README.md | 3 ++- plugins/neofetch/neofetch.ax-io | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/plugins/neofetch/README.md b/plugins/neofetch/README.md index aa1bdae..5e0a7a7 100644 --- a/plugins/neofetch/README.md +++ b/plugins/neofetch/README.md @@ -1,3 +1,4 @@ ## neofetch -Show neofetch(1) system information, but not more often than once every hour. +Show fastfetch(1) or neofetch(1) system information, but not more often than +once every hour. If both tools are installed, prefer fastfetch(1). diff --git a/plugins/neofetch/neofetch.ax-io b/plugins/neofetch/neofetch.ax-io index aa40183..51c238e 100644 --- a/plugins/neofetch/neofetch.ax-io +++ b/plugins/neofetch/neofetch.ax-io @@ -1,18 +1,28 @@ # AX-ZSH: Alex' Modular ZSH Configuration -# neofetch.ax-io: Show neofetch(1) system information. +# neofetch.ax-io: Show fastfetch(1) [preferred] or neofetch(1) system information. -# Make sure that "neofetch(1)" is installed. -(( $+commands[neofetch] )) || return 1 +# Make sure that fastfetch(1) or neofetch(1) is installed. +(( $+commands[fastfetch] )) || (( $+commands[neofetch] )) || return 1 # Don't run this plugin on "check-plugins"! [[ -z "$AXZSH_PLUGIN_CHECK" ]] || return 0 axzsh_neofetch() { - neofetch \ - --color_blocks off \ - --disable packages \ - --shell_path on \ - --underline_char '~' + if (( $+commands[fastfetch] )); then + fastfetch \ + --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Terminal:TerminalFont:CPU:GPU:Memory:Battery:PowerAdapter:Break \ + --percent-type 3 \ + --separator-string '~' + elif (( $+commands[neofetch] )); then + neofetch \ + --color_blocks off \ + --disable packages \ + --shell_path on \ + --underline_char '~' + else + echo "Neither fastfetch(1) nor neofetch(1) was found!" >&2 + return 1 + fi } # Don't show any info when ~/.hushlogin exists ... -- 2.39.2