]> arthur.barton.de Git - ax-zsh.git/commitdiff
New "neofetch" plugin
authorAlexander Barton <alex@barton.de>
Fri, 31 Jul 2020 17:09:06 +0000 (19:09 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 31 Jul 2020 17:09:06 +0000 (19:09 +0200)
plugins/neofetch/README.md [new file with mode: 0644]
plugins/neofetch/neofetch.ax-io [new file with mode: 0644]

diff --git a/plugins/neofetch/README.md b/plugins/neofetch/README.md
new file mode 100644 (file)
index 0000000..aa1bdae
--- /dev/null
@@ -0,0 +1,3 @@
+## neofetch
+
+Show neofetch(1) system information, but not more often than once every hour.
diff --git a/plugins/neofetch/neofetch.ax-io b/plugins/neofetch/neofetch.ax-io
new file mode 100644 (file)
index 0000000..825a9ff
--- /dev/null
@@ -0,0 +1,24 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# neofetch.ax-io: Show neofetch(1) system information.
+
+# Make sure that "neofetch(1)" is installed.
+(( $+commands[neofetch] )) || return 1
+
+# Don't run this plugin on "check-plugins"!
+[[ -z "$AXZSH_PLUGIN_CHECK" ]] || return 0
+
+# Don't show any info when ~/.hushlogin exists ...
+[[ -r ~/.hushlogin ]] && 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
+
+neofetch \
+       --color_blocks off \
+       --disable packages \
+       --shell_path on \
+       --underline_char '~'
+
+# Wtite "stamp" file.
+[[ -w ~/ ]] && touch "$XDG_CACHE_HOME/axzsh_last_neofetch"