Etienne Perot avatar Etienne Perot committed 477fcb9

Add `*top` and `*mon` and `watch` to undistract-me blacklist

Comments (0)

Files changed (1)

modules/console/files/zsh/.zsh/custom/plugins/undistract-me/undistract-me.plugin.zsh

 UNDISTRACT_ME_CMD_BLACKLIST=(
-	screen
-	ssh
-	man
+	screen ssh
 	wine
-	less
-	more
-	most
+	less more most man
+	'\S*top' '\S*mon'
+	watch
 )
 
 undistract_me_preexec() {
 	UNDISTRACT_ME_CMD=${${${(pj:\\\\n:)${(f)1}}//\%/%%}//\\/\\\\}
-	UNDISTRACT_ME_CMD_START_TIME=$(date +%s)
+	UNDISTRACT_ME_CMD_START_TIME="$(date +%s)"
 }
 undistract_me_precmd() {
 	local end_time duration
 	if [ "$UNDISTRACT_ME_CMD" != '' ]; then
-		end_time=$(date +%s)
+		end_time="$(date +%s)"
 		validCommand='true'
 		for cmd in "${UNDISTRACT_ME_CMD_BLACKLIST[@]}"; do
 			if echo "$UNDISTRACT_ME_CMD" | grep -qP "^(?:sudo)?\s*$cmd\b"; then
 			fi
 		done
 		if [ -n "$validCommand" ]; then
-			((duration=$end_time - $UNDISTRACT_ME_CMD_START_TIME))
+			((duration="$end_time" - "$UNDISTRACT_ME_CMD_START_TIME"))
 			if [ "$duration" -gt 15 ]; then
 				notify-send --urgency=low --expire-time=1500 --icon=utilities-terminal 'Command executed' "'$UNDISTRACT_ME_CMD' ended in $duration seconds."
 			fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.