From 4a9e4b8e03f4b05a6d209b67c7af8ba233cef2f8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 1 Aug 2019 11:23:33 +0300 Subject: [PATCH] Improve notifications on macOS --- auto-notify.plugin.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/auto-notify.plugin.zsh b/auto-notify.plugin.zsh index 80aad5d..f85da8c 100644 --- a/auto-notify.plugin.zsh +++ b/auto-notify.plugin.zsh @@ -42,10 +42,11 @@ function _auto_notify_message() { fi notify-send "$title" "$body" "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME" elif [[ "$platform" == "Darwin" ]]; then - # We need to escape quotes since we are passing a script into a command - body="${body//\"/\\\"}" - title="${title//\"/\\\"}" - osascript -e "display notification \"$body\" with title \"$title\"" + osascript \ + -e 'on run argv' \ + -e 'display notification (item 1 of argv) with title (item 2 of argv)' \ + -e 'end run' \ + "$body" "$title" else printf "Unknown platform for sending notifications: $platform\n" printf "Please post an issue on gitub.com/MichaelAquilina/zsh-auto-notify/issues/\n"