Improve notifications on macOS
This commit is contained in:
parent
2292476f93
commit
4a9e4b8e03
1 changed files with 5 additions and 4 deletions
|
@ -42,10 +42,11 @@ function _auto_notify_message() {
|
||||||
fi
|
fi
|
||||||
notify-send "$title" "$body" "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME"
|
notify-send "$title" "$body" "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME"
|
||||||
elif [[ "$platform" == "Darwin" ]]; then
|
elif [[ "$platform" == "Darwin" ]]; then
|
||||||
# We need to escape quotes since we are passing a script into a command
|
osascript \
|
||||||
body="${body//\"/\\\"}"
|
-e 'on run argv' \
|
||||||
title="${title//\"/\\\"}"
|
-e 'display notification (item 1 of argv) with title (item 2 of argv)' \
|
||||||
osascript -e "display notification \"$body\" with title \"$title\""
|
-e 'end run' \
|
||||||
|
"$body" "$title"
|
||||||
else
|
else
|
||||||
printf "Unknown platform for sending notifications: $platform\n"
|
printf "Unknown platform for sending notifications: $platform\n"
|
||||||
printf "Please post an issue on gitub.com/MichaelAquilina/zsh-auto-notify/issues/\n"
|
printf "Please post an issue on gitub.com/MichaelAquilina/zsh-auto-notify/issues/\n"
|
||||||
|
|
Loading…
Add table
Reference in a new issue