commit
4668a7fbd4
3 changed files with 13 additions and 8 deletions
|
@ -1,6 +1,10 @@
|
||||||
Changelog for zsh-auto-notify
|
Changelog for zsh-auto-notify
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
|
0.5.1
|
||||||
|
-----
|
||||||
|
* Improved handling of MacOS notifications via #16 (Thanks @dmitmel!)
|
||||||
|
|
||||||
0.5.0
|
0.5.0
|
||||||
-----
|
-----
|
||||||
* Support changing notification title and body using AUTO_NOTIFY_TITLE and AUTO_NOTIFY_BODY
|
* Support changing notification title and body using AUTO_NOTIFY_TITLE and AUTO_NOTIFY_BODY
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export AUTO_NOTIFY_VERSION="0.5.0"
|
export AUTO_NOTIFY_VERSION="0.5.1"
|
||||||
|
|
||||||
# Time it takes for a notification to expire
|
# Time it takes for a notification to expire
|
||||||
export AUTO_NOTIFY_EXPIRE_TIME=8000
|
export AUTO_NOTIFY_EXPIRE_TIME=8000
|
||||||
|
@ -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"
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
assert "$lines[4]" same_as "--urgency=normal --expire-time=15000"
|
assert "$lines[4]" same_as "--urgency=normal --expire-time=15000"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test 'auto-notify-send sends notification on MacOSX' {
|
@test 'auto-notify-send sends notification on macOS' {
|
||||||
AUTO_COMMAND="f bar -r"
|
AUTO_COMMAND="f bar -r"
|
||||||
AUTO_COMMAND_FULL="foo bar -r"
|
AUTO_COMMAND_FULL="foo bar -r"
|
||||||
AUTO_COMMAND_START=11080
|
AUTO_COMMAND_START=11080
|
||||||
|
@ -108,8 +108,8 @@
|
||||||
run _auto_notify_send
|
run _auto_notify_send
|
||||||
|
|
||||||
assert $state equals 0
|
assert $state equals 0
|
||||||
assert "$lines[1]" same_as '-e display notification "Total time: 20 seconds'
|
assert "$lines[1]" same_as '-e on run argv -e display notification (item 1 of argv) with title (item 2 of argv) -e end run Total time: 20 seconds'
|
||||||
assert "$lines[2]" same_as 'Exit code: 0" with title "\"f bar -r\" Completed"'
|
assert "$lines[2]" same_as 'Exit code: 0 "f bar -r" Completed'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test 'auto-notify-send sends warning on unsupported platform' {
|
@test 'auto-notify-send sends warning on unsupported platform' {
|
||||||
|
|
Loading…
Add table
Reference in a new issue