]> arthur.barton.de Git - ax-zsh.git/blobdiff - plugins/neofetch/neofetch.ax-io
Correctly test XDG_CACHE_HOME for writability for "stamp files"
[ax-zsh.git] / plugins / neofetch / neofetch.ax-io
index 825a9ff3995272a0474e7d153e9c91823e41df35..5798d58d07f662f5376a7798fc83a81736e46fc3 100644 (file)
@@ -1,8 +1,8 @@
 # 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
 
 # Check if neofetch(1) infos have been shown during last 60 minutes, and if so,
 # don't show them now but return.
-[[ -z `find "$XDG_CACHE_HOME/axzsh_last_neofetch" -mmin -60 2>/dev/null` ]] || return 0
+[[ -z $(find "$XDG_CACHE_HOME/axzsh_last_neofetch" -mmin -60 2>/dev/null) ]] || return 0
 
-neofetch \
-       --color_blocks off \
-       --disable packages \
-       --shell_path on \
-       --underline_char '~'
+if (( $+commands[fastfetch] )); then
+       fastfetch
+elif (( $+commands[neofetch] )); then
+       neofetch
+else
+       return 0
+fi
 
 # Wtite "stamp" file.
-[[ -w ~/ ]] && touch "$XDG_CACHE_HOME/axzsh_last_neofetch"
+[[ -w "$XDG_CACHE_HOME" ]] && touch "$XDG_CACHE_HOME/axzsh_last_neofetch"