]> arthur.barton.de Git - ax-zsh.git/commitdiff
neofetch: Add support for fastfetch(1)
authorAlexander Barton <alex@barton.de>
Fri, 14 Apr 2023 11:35:54 +0000 (13:35 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 14 Apr 2023 11:35:54 +0000 (13:35 +0200)
plugins/neofetch/README.md
plugins/neofetch/neofetch.ax-io

index aa1bdaea17ba3737d8a5efa2e8ded96de9bc5930..5e0a7a7f7e5e801315c24fe0b80a1b8a3a786955 100644 (file)
@@ -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).
index aa40183d3b3d5aca0f7871628767aeb0c668870d..51c238e2e153558e423f3efb67252e238498f093 100644 (file)
@@ -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 ...