]> arthur.barton.de Git - ax-zsh.git/blob - plugins/neofetch/neofetch.ax-io
neofetch: Get rid of the axzsh_neofetch() function
[ax-zsh.git] / plugins / neofetch / neofetch.ax-io
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # neofetch.ax-io: Show fastfetch(1) [preferred] or neofetch(1) system information.
3
4 # Make sure that fastfetch(1) or neofetch(1) is installed.
5 (( $+commands[fastfetch] )) || (( $+commands[neofetch] )) || return 1
6
7 # Don't run this plugin on "check-plugins"!
8 [[ -z "$AXZSH_PLUGIN_CHECK" ]] || return 0
9
10 # Don't show any info when ~/.hushlogin exists ...
11 [[ -r ~/.hushlogin ]] && return 0
12
13 # Check if neofetch(1) infos have been shown during last 60 minutes, and if so,
14 # don't show them now but return.
15 [[ -z $(find "$XDG_CACHE_HOME/axzsh_last_neofetch" -mmin -60 2>/dev/null) ]] || return 0
16
17 if (( $+commands[fastfetch] )); then
18         fastfetch
19 elif (( $+commands[neofetch] )); then
20         neofetch
21 else
22         return 0
23 fi
24
25 # Wtite "stamp" file.
26 [[ -w ~/ ]] && touch "$XDG_CACHE_HOME/axzsh_last_neofetch"