franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
766 stars 70 forks source link

Using tmux and terminal-notifier causes failure #140

Closed oschrenk closed 8 months ago

oschrenk commented 8 months ago

https://github.com/julienXX/terminal-notifier does not like it when message start with open brackets.

terminal-notifier -message '[]'
...
Note that in some circumstances the first character of a message has to be escaped in order to be recognized.
An example of this is when using an open bracket, which has to be escaped like so: ‘\[’.

Combine that with being in tmux

if test -n "$TMUX_PANE"
    set message (tmux lsw  -F"$__done_tmux_pane_format" -f '#{==:#{pane_id},'$TMUX_PANE'}')" $message"
end

with

    set -q __done_tmux_pane_format; or set -g __done_tmux_pane_format '[#{window_index}]'

is kicking in,

so that every message is prepended by the current tmux pane in brackets.

Resulting in every done execution failing when using default config:

franciscolourenco commented 8 months ago

@oschrenk thank you for reporting this. It seems terminal-notifier is a bit unpredictable when it comes to this issue and to which characters need to be escaped. I found that piping the message instead of using the option fixes this issue. Fixed in https://github.com/franciscolourenco/done/releases/tag/1.17.2