franciscolourenco / done

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

Add support for done notifications from remote servers via custom command #80

Closed frederickjh closed 3 years ago

frederickjh commented 4 years ago

In #36 it was pointed out that Done does not send message when working on a remote server.

This feature request is to allow the user to use a custom command to allow sending the done message to them. Getting notification message to popup on remote machines is problematic at best.

However there are a number of push and chat services such as PushBullet and Telegram that have APIs that allow one to quickly put together a Fish function or shell script that sends out a message. I have created some of these that I can add to the end of a long running command, however I sometimes forget to add the notification function command after my long running command, ie. sleep 300; telegram-me and then of course do not get notified.

Looking at the done code there are numerous checks to make sure that the terminal window is not in the foreground and that this is not a SSH session.

Done also appears to have the option to run a custom command to notify, but it seems no way to pass the done message to that custom command.

To do list get notifications while ssh into a remote server.

1. Add a way to disable foreground checking
2. Add a to disable SSH checking
3. Add a way to pass the done message to the custom command
4. Document usage.

In my original comment on #36, I suggested that variables could be set for some of these but I think that a configuration file for done might be a better idea for setting the above three items.

If the done project also wants to include sample Fish functions for some of the push and chat services, I could help out by creating on for Telegram.

After the above is finished the user could install done on the remote server then configure it to disable foreground checking, disable SSH checking, and set the custom command that done will call and pass the message to so that it can be delivered.

ammgws commented 4 years ago

For passing the message to your custom command you can do it like this:

set -U __done_notification_command "yourcommand --subject \$title --body \$message myphone"

Perhaps it could be documented.

That just leaves adding some config params for disabling the SSH/window checks.

franciscolourenco commented 3 years ago

Done in v1.15.0