Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set the notification expiry #125

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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