mirror of
https://github.com/philippdieter/zsh-auto-notify.git
synced 2025-10-13 03:58:44 +00:00
parent
cac2c193d9
commit
eb2b3ed741
@ -159,7 +159,6 @@ NOTE: This configuration option currently only works for Linux.
|
|||||||
|
|
||||||
You can configure whether notifications will be cancelled when procees is terminated with SIGINT by setting the environment
|
You can configure whether notifications will be cancelled when procees is terminated with SIGINT by setting the environment
|
||||||
variable ``AUTO_NOTIFY_CANCEL_ON_SIGINT`` to enable ("1") or disable ("0"). The default value is set to 0.
|
variable ``AUTO_NOTIFY_CANCEL_ON_SIGINT`` to enable ("1") or disable ("0"). The default value is set to 0.
|
||||||
NOTE: This configuration option currently only works for Linux.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
@ -54,6 +54,12 @@ function _auto_notify_message() {
|
|||||||
local DEFAULT_TITLE="\"%command\" Completed"
|
local DEFAULT_TITLE="\"%command\" Completed"
|
||||||
local DEFAULT_BODY="$(echo -e "Total time: %elapsed seconds\nExit code: %exit_code")"
|
local DEFAULT_BODY="$(echo -e "Total time: %elapsed seconds\nExit code: %exit_code")"
|
||||||
|
|
||||||
|
# Exit code 130 indicates termination by SIGINT (Ctrl+C).
|
||||||
|
# If AUTO_NOTIFY_CANCEL_ON_SIGINT is enabled, suppress the notification.
|
||||||
|
if [[ "$exit_code" -eq 130 ]] && [[ "${AUTO_NOTIFY_CANCEL_ON_SIGINT}" -eq 1 ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
local title="${AUTO_NOTIFY_TITLE:-$DEFAULT_TITLE}"
|
local title="${AUTO_NOTIFY_TITLE:-$DEFAULT_TITLE}"
|
||||||
local text="${AUTO_NOTIFY_BODY:-$DEFAULT_BODY}"
|
local text="${AUTO_NOTIFY_BODY:-$DEFAULT_BODY}"
|
||||||
|
|
||||||
@ -68,11 +74,6 @@ function _auto_notify_message() {
|
|||||||
|
|
||||||
# Handle specific exit codes
|
# Handle specific exit codes
|
||||||
if [[ "$exit_code" -eq 130 ]]; then
|
if [[ "$exit_code" -eq 130 ]]; then
|
||||||
# Exit code 130 indicates termination by SIGINT (Ctrl+C).
|
|
||||||
# If AUTO_NOTIFY_CANCEL_ON_SIGINT is enabled, suppress the notification.
|
|
||||||
if [[ "${AUTO_NOTIFY_CANCEL_ON_SIGINT}" -eq 1 ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
urgency="critical"
|
urgency="critical"
|
||||||
transient="--hint=int:transient:1"
|
transient="--hint=int:transient:1"
|
||||||
icon="${AUTO_NOTIFY_ICON_FAILURE:-""}"
|
icon="${AUTO_NOTIFY_ICON_FAILURE:-""}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user