Skip to content

Commit

Permalink
Merge branch 'MichaelAquilina:master' into fix-notify-send-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
FlowBreeze authored Sep 11, 2023
2 parents af9aa9f + 22b2c61 commit fac4435
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test: &test
- checkout
- run:
name: Install Dependencies
command: apt-get update && apt-get install -y curl git ncurses-bin
command: apt-get update && apt-get install -y curl git ncurses-bin libnotify-bin
- run:
name: Download requirements
command: |
Expand All @@ -25,7 +25,7 @@ test: &test
jobs:
lint:
docker:
- image: "python:3.7-stretch"
- image: "python:3.11"
steps:
- checkout
- run:
Expand Down
6 changes: 4 additions & 2 deletions auto-notify.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export AUTO_NOTIFY_VERSION="0.8.0"
export AUTO_NOTIFY_VERSION="0.8.1"

# Time it takes for a notification to expire
[[ -z "$AUTO_NOTIFY_EXPIRE_TIME" ]] &&
Expand Down Expand Up @@ -51,10 +51,12 @@ function _auto_notify_message() {

if [[ "$platform" == "Linux" ]]; then
local urgency="normal"
local transient="--hint=int:transient:1"
if [[ "$exit_code" != "0" ]]; then
urgency="critical"
transient=""
fi
notify-send "$title" "$body" --app-name=zsh "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME"
notify-send "$title" "$body" --app-name=zsh $transient "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME"
elif [[ "$platform" == "Darwin" ]]; then
osascript \
-e 'on run argv' \
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auto_notify_send.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
assert "$lines[1]" same_as 'Notification Title: "f bar -r" Completed'
assert "$lines[2]" same_as "Notification Body: Total time: 20 seconds"
assert "$lines[3]" same_as "Exit code: 0"
assert "$lines[4]" same_as "--app-name=zsh --urgency=normal --expire-time=15000"
assert "$lines[4]" same_as "--app-name=zsh --hint=int:transient:1 --urgency=normal --expire-time=15000"
}

@test 'auto-notify-send sends notification on macOS' {
Expand Down

0 comments on commit fac4435

Please sign in to comment.