mirror of
https://github.com/philippdieter/zsh-auto-notify.git
synced 2025-10-13 03:58:44 +00:00
Add option to configure persistence in notification history
Option AUTO_NOTIFY_ENABLE_TRANSIENT has been added to enable and disable persistence in notification history.
This commit is contained in:
parent
cbea4aeb58
commit
0317936051
13
README.rst
13
README.rst
@ -142,6 +142,19 @@ NOTE: This configuration option currently only works for Linux.
|
|||||||
# Disable notification forwarding to SSH client
|
# Disable notification forwarding to SSH client
|
||||||
export AUTO_NOTIFY_ENABLE_SSH=0
|
export AUTO_NOTIFY_ENABLE_SSH=0
|
||||||
|
|
||||||
|
**Notification Persistence in Notification History**
|
||||||
|
|
||||||
|
You can configure whether notifications will persist in notification history by setting the environment
|
||||||
|
variable ``AUTO_NOTIFY_ENABLE_TRANSIENT`` to enable ("1") or disable ("0"). The default value is set to 1.
|
||||||
|
NOTE: This configuration option currently only works for Linux.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# Enable persistent notifications
|
||||||
|
export AUTO_NOTIFY_ENABLE_TRANSIENT=0
|
||||||
|
# Disable persistent notifications
|
||||||
|
export AUTO_NOTIFY_ENABLE_TRANSIENT=1
|
||||||
|
|
||||||
|
|
||||||
**Ignored Commands**
|
**Ignored Commands**
|
||||||
|
|
||||||
|
@ -9,6 +9,9 @@ export AUTO_NOTIFY_VERSION="0.10.2"
|
|||||||
# Enable or disable notifications for SSH sessions (0 = disabled, 1 = enabled)
|
# Enable or disable notifications for SSH sessions (0 = disabled, 1 = enabled)
|
||||||
[[ -z "$AUTO_NOTIFY_ENABLE_SSH" ]] &&
|
[[ -z "$AUTO_NOTIFY_ENABLE_SSH" ]] &&
|
||||||
export AUTO_NOTIFY_ENABLE_SSH=0
|
export AUTO_NOTIFY_ENABLE_SSH=0
|
||||||
|
# Enable transient notifications to prevent them from being saved in the notification history
|
||||||
|
[[ -z "$AUTO_NOTIFY_ENABLE_TRANSIENT" ]] &&
|
||||||
|
export AUTO_NOTIFY_ENABLE_TRANSIENT=1
|
||||||
|
|
||||||
# List of commands/programs to ignore sending notifications for
|
# List of commands/programs to ignore sending notifications for
|
||||||
[[ -z "$AUTO_NOTIFY_IGNORE" ]] &&
|
[[ -z "$AUTO_NOTIFY_IGNORE" ]] &&
|
||||||
@ -55,7 +58,7 @@ function _auto_notify_message() {
|
|||||||
|
|
||||||
if [[ "$platform" == "Linux" ]]; then
|
if [[ "$platform" == "Linux" ]]; then
|
||||||
local urgency="normal"
|
local urgency="normal"
|
||||||
local transient="--hint=int:transient:1"
|
local transient="--hint=int:transient:$AUTO_NOTIFY_ENABLE_TRANSIENT"
|
||||||
local icon=${AUTO_NOTIFY_ICON_SUCCESS:-""}
|
local icon=${AUTO_NOTIFY_ICON_SUCCESS:-""}
|
||||||
# Exit code 130 is returned when a process is terminated with SIGINT.
|
# Exit code 130 is returned when a process is terminated with SIGINT.
|
||||||
# Since the user is already interacting with the program, there is no
|
# Since the user is already interacting with the program, there is no
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
assert "$lines[1]" same_as 'Notification Title: "f bar -r" Completed'
|
assert "$lines[1]" same_as 'Notification Title: "f bar -r" Completed'
|
||||||
assert "$lines[2]" same_as "Notification Body: Total time: 20 seconds"
|
assert "$lines[2]" same_as "Notification Body: Total time: 20 seconds"
|
||||||
assert "$lines[3]" same_as "Exit code: 0"
|
assert "$lines[3]" same_as "Exit code: 0"
|
||||||
assert "$lines[4]" same_as "--app-name=zsh --hint=int:transient:1 --urgency=normal --expire-time=15000"
|
assert "$lines[4]" same_as "--app-name=zsh --hint=int:transient:0 --urgency=normal --expire-time=15000"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test 'auto-notify-send sends notification and icon on Linux on success' {
|
@test 'auto-notify-send sends notification and icon on Linux on success' {
|
||||||
@ -104,7 +104,7 @@
|
|||||||
assert "$lines[1]" same_as 'Notification Title: "f bar -r" Completed'
|
assert "$lines[1]" same_as 'Notification Title: "f bar -r" Completed'
|
||||||
assert "$lines[2]" same_as "Notification Body: Total time: 20 seconds"
|
assert "$lines[2]" same_as "Notification Body: Total time: 20 seconds"
|
||||||
assert "$lines[3]" same_as "Exit code: 0"
|
assert "$lines[3]" same_as "Exit code: 0"
|
||||||
assert "$lines[4]" same_as "--app-name=zsh --hint=int:transient:1 --urgency=normal --expire-time=15000 --icon=/path/to/success/icon.png"
|
assert "$lines[4]" same_as "--app-name=zsh --hint=int:transient:0 --urgency=normal --expire-time=15000 --icon=/path/to/success/icon.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test 'auto-notify-send sends notification on macOS' {
|
@test 'auto-notify-send sends notification on macOS' {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user