My shell does automatically show a notification, if a command ran longer than 10 seconds and the terminal does not have focus. No need to remember to add a command.
What do you use for that?
My self made fish config: https://github.com/qznc/dot/blob/master/config/fish/config.fish#L58
For bash and zsh, search for “undistract me: https://github.com/jml/undistract-me
why not use
$ some –command; osascript -e ‘display notification “Done!!” with title “Done!”’
on your mac? (there are equivalents for gnome, kde, X etc.)
This is actually superior because, I’m guessing, aa probably won’t work with things like shell aliases, so simply using the shell to run your alert after the command finishes is a better option.
Good point! I forgot about shell aliases. I opened an issue to track adding support for that:
One option would be to just always run the command through the user’s shell. Yours isn’t the only otherwise-cool utility that doesn’t work on aliases. I recently found https://github.com/chneukirchen/nq and was super stoked until I realized it barfed on aliases. I may submit a PR to support that if I find time.
How do you like Rust? I haven’t found enough time or motivation to wrap my tiny brain around it yet :-(
I don’t think alert-after actually does this yet, but one advantage of using a wrapper is that it can check the exit status and automatically give you a success/failure notification. You could do that in shell too, but it’d be much more tedious to write out by hand every time.
some --command && osascript -e 'display notification "Success!!"' || osascript -e 'display notification "Failure!!"'
If you simply want to notify with the exit code you can use $? which is bound the exit code of the previous process, e.g.
bash -c "exit 0"; echo Status: $?
A 101-character suffix on a command, versus the OP’s 2-character prefix on a command? Yes, I’d call that “much more tedious”.
(it would be pretty easy to turn your command into a shell-script wrapper with a two-character name, but that’s just an argument about implementation, not about whether a wrapper is a good design)
sure, but it could be a 5 line shell script
shell has functions and aliases that you can add to your profile.
I use zenity on Linux for this exact purpose