Override notification urgency
This commit is contained in:
parent
fb38802d33
commit
ea0984818d
2 changed files with 20 additions and 2 deletions
11
README.rst
11
README.rst
|
@ -122,6 +122,17 @@ NOTE: This configuration option currently only works for Linux.
|
||||||
export AUTO_NOTIFY_EXPIRE_TIME=10000
|
export AUTO_NOTIFY_EXPIRE_TIME=10000
|
||||||
|
|
||||||
|
|
||||||
|
**Notification Urgency Level**
|
||||||
|
|
||||||
|
By default non zero exit codes lead to critical notifications.
|
||||||
|
On some systems (KDE) critical notifications will never expire.
|
||||||
|
You can override notification urgency by setting the environment variable ``"AUTO_NOTIFY_URGENCY"`` to ``"low"``, ``"normal"``, or ``"critical``.
|
||||||
|
NOTE: This configuration option currently only works for Linux.
|
||||||
|
|
||||||
|
::
|
||||||
|
# Force all notifications to have normal urgency
|
||||||
|
export AUTO_NOTIFY_URGENCY="normal"
|
||||||
|
|
||||||
**Ignored Commands**
|
**Ignored Commands**
|
||||||
|
|
||||||
A number of commands do not get notifications for long running times due to their nature (e.g. ``watch`` or ``man``).
|
A number of commands do not get notifications for long running times due to their nature (e.g. ``watch`` or ``man``).
|
||||||
|
|
|
@ -9,6 +9,9 @@ export AUTO_NOTIFY_IGNORE=(
|
||||||
"vim" "nvim" "less" "more" "man" "tig" "watch" "git commit" "top" "htop" "ssh" "nano"
|
"vim" "nvim" "less" "more" "man" "tig" "watch" "git commit" "top" "htop" "ssh" "nano"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Override notification urgency
|
||||||
|
# export AUTO_NOTIFY_URGENCY="normal"
|
||||||
|
|
||||||
function _auto_notify_format() {
|
function _auto_notify_format() {
|
||||||
local MESSAGE="$1"
|
local MESSAGE="$1"
|
||||||
local command="$2"
|
local command="$2"
|
||||||
|
@ -37,8 +40,12 @@ function _auto_notify_message() {
|
||||||
|
|
||||||
if [[ "$platform" == "Linux" ]]; then
|
if [[ "$platform" == "Linux" ]]; then
|
||||||
local urgency="normal"
|
local urgency="normal"
|
||||||
if [[ "$exit_code" != "0" ]]; then
|
if [[ -z $AUTO_NOTIFY_URGENCY ]]; then
|
||||||
urgency="critical"
|
if [[ "$exit_code" != "0" ]]; then
|
||||||
|
urgency="critical"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
urgency=$AUTO_NOTIFY_URGENCY
|
||||||
fi
|
fi
|
||||||
notify-send "$title" "$body" --app-name=zsh "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME"
|
notify-send "$title" "$body" --app-name=zsh "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME"
|
||||||
elif [[ "$platform" == "Darwin" ]]; then
|
elif [[ "$platform" == "Darwin" ]]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue