docs(bgnotify): match README with current features (#12057)
Diff
1diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md
2index 1d8fac54d03e77b8d33fba6f15635186e97ab391..6bbe3b3025d30005ebd2b881131813afd754090b 100644
3--- a/plugins/bgnotify/README.md
4+++ b/plugins/bgnotify/README.md
5@@ -1,19 +1,19 @@
6 # bgnotify zsh plugin
7 8-cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux.
9+cross-platform background notifications for long running commands! Supports OSX and Linux.
1011 Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
1213-----------------------------------
14+---
1516-## How to use!
17+## How to use
1819 Just add bgnotify to your plugins list in your `.zshrc`
2021 - On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
22 * `brew install terminal-notifier` (or `gem install terminal-notifier`)
23-- On ubuntu you're already all set!
24-- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
25+- On Linux, make sure you have `notify-send` or `kdialog` installed. If you're using Ubuntu you should already be all set!
26+- On Windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
272829 ## Screenshots
30@@ -36,19 +36,26 @@ Just add bgnotify to your plugins list in your `.zshrc`
31 One can configure a few things:
3233 - `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
34-- `function bgnotify_formatted` lets you change the notification
35+- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
3637 Use these by adding a function definition before the your call to source. Example:
3839-~~~ sh
40+```sh
41 bgnotify_threshold=4 ## set your own notification threshold
4243 function bgnotify_formatted {
44 ## $1=exit_status, $2=command, $3=elapsed_time
45- [ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!"
46- bgnotify "$title -- after $3 s" "$2";
47+
48+ # Humanly readable elapsed time
49+ local elapsed="$(( $3 % 60 ))s"
50+ (( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
51+ (( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
52+
53+ [ $1 -eq 0 ] && title="Holy Smokes Batman" || title="Holy Graf Zeppelin"
54+ [ $1 -eq 0 ] && icon="$HOME/icons/success.png" || icon="$HOME/icons/fail.png"
55+ bgnotify "$title - took ${elapsed}" "$2" "$icon"
56 }
5758 plugins=(git bgnotify) ## add to plugins list
59 source $ZSH/oh-my-zsh.sh ## existing source call
60-~~~
61+```