ac325a7caba6630538c39e1c0ffa192d866cdcff
- Author
- PukNgae Cryolitia <Cryolitia@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(bgnotify): add config to pass extra args (#12679)
Diff
1diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md
2index 33d529f1588b3be73a7e89ae98fd696c615a8e69..1389def86db3229db493d2f4d6f273d279d3062d 100644
3--- a/plugins/bgnotify/README.md
4+++ b/plugins/bgnotify/README.md
5@@ -38,6 +38,7 @@ One can configure a few things:
6 - `bgnotify_bell` enabled or disables the terminal bell (default true)
7 - `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
8 - `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
9+- `bgnotify_extraargs` appends extra args to notifier (e.g. `-e` for notify-send to create a transient notification)
10
11 Use these by adding a function definition before the your call to source. Example:
12
13diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh
14index 7de6f9a91adece7e5ba754d48e58bdbb0752f563..f6ffb6ed535d4b71ce18e154e886b9db5b281392 100644
15--- a/plugins/bgnotify/bgnotify.plugin.zsh
16+++ b/plugins/bgnotify/bgnotify.plugin.zsh
17@@ -117,15 +117,15 @@ function bgnotify {
18 local icon="$3"
19 if (( ${+commands[terminal-notifier]} )); then # macOS
20 local term_id=$(bgnotify_programid)
21- terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} &>/dev/null
22+ terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} ${=bgnotify_extraargs:-} &>/dev/null
23 elif (( ${+commands[growlnotify]} )); then # macOS growl
24- growlnotify -m "$title" "$message"
25+ growlnotify -m "$title" "$message" ${=bgnotify_extraargs:-}
26 elif (( ${+commands[notify-send]} )); then
27- notify-send "$title" "$message" ${=icon:+--icon "$icon"}
28+ notify-send "$title" "$message" ${=icon:+--icon "$icon"} ${=bgnotify_extraargs:-}
29 elif (( ${+commands[kdialog]} )); then # KDE
30- kdialog --title "$title" --passivepopup "$message" 5
31+ kdialog --title "$title" --passivepopup "$message" 5 ${=bgnotify_extraargs:-}
32 elif (( ${+commands[notifu]} )); then # cygwin
33- notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
34+ notifu /m "$message" /p "$title" ${=icon:+/i "$icon"} ${=bgnotify_extraargs:-}
35 fi
36 }
37