From 305cf8230b6ddef043ce0571ad202de8c9f23429 Mon Sep 17 00:00:00 2001 From: shalecraig Date: Tue, 24 Mar 2015 12:28:18 -0400 Subject: [PATCH] Format the time as mm:ss, not just m I prefer `12:34` over `754s` since it's more readable, but feel free to disreguard if you don't think it's necessary. --- plugins/bgnotify/bgnotify.plugin.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index b70b42f98..a844d9d8c 100755 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -13,8 +13,10 @@ autoload -Uz add-zsh-hook || { print "can't add zsh hook!"; return } if ! (type bgnotify_formatted | grep -q 'function'); then function bgnotify_formatted { - ## exit_status, command, elapsed_time - [ $1 -eq 0 ] && title="#win (took $3 s)" || title="#fail (took $3 s)" + ## exit_status, command, elapsed_seconds + minutes=$(( $3 / 60 )) + seconds=$(( $3 % 60 )) + [ $1 -eq 0 ] && title="#win (took $minutes:$seconds)" || title="#fail (took $minutes:$seconds)" bgnotify "$title" "$2" } fi