mirror of
https://github.com/philippdieter/zsh-auto-notify.git
synced 2025-10-13 03:58:44 +00:00
Added icon support for linux
Added: AUTO_NOTIFY_ICON_SUCCESS environmental variable, represents path to icon for notify-send to display on command success Added: AUTO_NOTIFY_ICON_FAILURE environmental variable, represents path to icon for notify-send to display on command failure Added: --icon option when icon path is present for notify-send, no additional argument added if environmental variable not specified Modified: Version number to pass test
This commit is contained in:
parent
f4766d6981
commit
2c0059707f
@ -1,4 +1,4 @@
|
||||
export AUTO_NOTIFY_VERSION="0.8.1"
|
||||
export AUTO_NOTIFY_VERSION="0.8.2"
|
||||
|
||||
# Time it takes for a notification to expire
|
||||
[[ -z "$AUTO_NOTIFY_EXPIRE_TIME" ]] &&
|
||||
@ -6,6 +6,7 @@ export AUTO_NOTIFY_VERSION="0.8.1"
|
||||
# Threshold in seconds for when to automatically show a notification
|
||||
[[ -z "$AUTO_NOTIFY_THRESHOLD" ]] &&
|
||||
export AUTO_NOTIFY_THRESHOLD=10
|
||||
|
||||
# List of commands/programs to ignore sending notifications for
|
||||
[[ -z "$AUTO_NOTIFY_IGNORE" ]] &&
|
||||
export AUTO_NOTIFY_IGNORE=(
|
||||
@ -52,11 +53,18 @@ function _auto_notify_message() {
|
||||
if [[ "$platform" == "Linux" ]]; then
|
||||
local urgency="normal"
|
||||
local transient="--hint=int:transient:1"
|
||||
local icon=${AUTO_NOTIFY_ICON_SUCCESS:-""}
|
||||
if [[ "$exit_code" != "0" ]]; then
|
||||
urgency="critical"
|
||||
transient=""
|
||||
icon=${AUTO_NOTIFY_ICON_FAILURE:-""}
|
||||
fi
|
||||
notify-send "$title" "$body" --app-name=zsh $transient "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME"
|
||||
local icon_arg=""
|
||||
if [[ -n "$icon" ]]; then
|
||||
icon_arg=" --icon=$icon"
|
||||
fi
|
||||
|
||||
notify-send "$title" "$body" --app-name=zsh $transient "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME$icon_arg"
|
||||
elif [[ "$platform" == "Darwin" ]]; then
|
||||
osascript \
|
||||
-e 'on run argv' \
|
||||
|
Loading…
x
Reference in New Issue
Block a user