Skip to content

Commit

Permalink
Merge pull request #125 from huafu/feature/notification-expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscolourenco authored Oct 22, 2023
2 parents 30eafb6 + 227482d commit faadb3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ set -U __done_notification_urgency_level_failure normal
```fish
set -U __done_allow_nongraphical 1
```
#### For Linux (except Ubuntu's Notify OSD), set the timeout in milliseconds at which to expire the notification. The default is "3000" (3 seconds). Set to "0" if you want it to never expire.

```fish
set -U __done_notification_duration 5000 # 5 seconds
```
## Support

- [fish](https://fishshell.com) 2.3.0+
Expand Down
3 changes: 2 additions & 1 deletion conf.d/done.fish
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ if set -q __done_enabled
set -q __done_notify_sound; or set -g __done_notify_sound 0
set -q __done_sway_ignore_visible; or set -g __done_sway_ignore_visible 0
set -q __done_tmux_pane_format; or set -g __done_tmux_pane_format '[#{window_index}]'
set -q __done_notification_duration; or set -g __done_notification_duration 3000

function __done_started --on-event fish_preexec
set __done_initial_window_id (__done_get_focused_window_id)
Expand Down Expand Up @@ -282,7 +283,7 @@ if set -q __done_enabled
end
end

notify-send --hint=int:transient:1 --urgency=$urgency --icon=utilities-terminal --app-name=fish "$title" "$message"
notify-send --hint=int:transient:1 --urgency=$urgency --icon=utilities-terminal --app-name=fish --expire-time=$__done_notification_duration "$title" "$message"

if test "$__done_notify_sound" -eq 1
echo -e "\a" # bell sound
Expand Down

0 comments on commit faadb3f

Please sign in to comment.