Jump to content

Notification from Script Filter (with terminal-notifier)

Recommended Posts

Hello everyone, here's a new riddle for you:


Why would a command like the one below work perfectly in a Run Script Action but not so well in a Script Filter Input?

/usr/bin/terminal-notifier -title "Hello" -message "This is a message" -sender com.runningwithcrayons.Alfred-2 &

What happens exactly is that in the case of the script filter the notification only appears in the notification center but never shows up on the top right corner. It behaves normally in the case of the run script action.


PS: my goal here is to notify the user that some data is loading and that they shouldn't worry (since it can take up to about 10 seconds sometimes).


PPS: it does work when not sent as Alfred (remove `-sender com.runningwithcrayons.Alfred-2`) but that's not what I want...

Edited by Florian
Link to comment

Have you tried:

/usr/bin/terminal-notifier -title "Hello" -message "This is a message" -sender com.runningwithcrayons.Alfred-2 >/dev/null 2>&1 &



If that doesn't work, then you could go a bit more overkill by prepending `nohup`:

nohup /usr/bin/terminal-notifier -title "Hello" -message "This is a message" -sender com.runningwithcrayons.Alfred-2 >/dev/null 2>&1 &
Link to comment

So, my guess is that Alfred has opened the STDERR and STOUT pipes, and it won't do anything until those pipes are closed. Since those pipes remain open until the entire workflow finishes running, it sends them at the end. `nohup` detaches the output of the command from those pipes, letting it happen immediately.


But again, that's my guess.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...