kaustubhhiware / NotiFyre

Notify when a terminal task is done/ Terminal task notifier https://kaustubhhiware.github.io/NotiFyre/
MIT License
59 stars 13 forks source link
bash bash-script fish fish-shell linux macos notifications terminal terminal-notifier ubuntu zsh

NotiFyre

MIT Licence Bash Shell PRs Welcome

It's lit :fire:

Notify when a terminal task is done

Image could not be displayed

Sample working video, sped up at x2.

Install dependencies first :

Note: The above dependencies are generally installed on most systems.

Notifyre has been tested on a fresh install of Ubuntu 16.04 running bash, zsh or fish. If you have managed to port this script to another shell or another OS, please open a pull request with the instructions for the same and we will update the README! Got some coverage here.

Table of Contents

Bash / ZSH

(Back to top)

Setup

Configuration

(Back to top)

 SOUND=1
 SOUND_MIN=10
 ALERT=/usr/share/sounds/ubuntu/notifications/Slick.ogg
 MIN_INTERVAL=4

There are four configurable options in NotiFyre:

  1. SOUND

    Options: 0 or 1

    Utility: SOUND=1 will play an alert sound for each notification that takes more time than SOUND_MIN seconds. This value is a boolean.

  2. SOUND_MIN

    Valid values: 1, 2, 3 ...

    Utility: Let's you configure the minimum amount of time a command must take for it to trigger a sound notification. (If SOUND=0, then no sound notification will be played) This value is in seconds.

  3. ALERT

    Options: Path to a sound file

    Utility: The sound file will be played whenever SOUND=1 and a command has taken more time than SOUND_MIN seconds. If the sound file does not exist, it plays an audible-bell sound (varies by terminal) as a fallback.

  4. MIN_INTERVAL

    Options: 1, 2, 3, ...

    Utility: An option to configure the minimum amount of time that a command must take in order to trigger a notification. This value is in seconds.

Fish shell

(Back to top)

Setup

You can learn to write your own functions in fish with this as a starting point.

Configuration

(Back to top)

 set -x timeout 1
 set -x ring_timeout 2
 set -x ALERT /usr/share/sounds/ubuntu/notifications/Slick.ogg

There are three available options:

  1. timeout : Same as option MIN_INTERVAL in the Bash / ZSH section above
  2. ring_timeout : Same as option SOUND_MIN in the Bash / ZSH section above
  3. ALERT : Same as option ALERT in the Bash / ZSH Section above

    Note: The notifications appear in a queue, and cannot be implemented parallely (known bug in notify-send)

Why This?

(Back to top)

I had to reinstall Ubuntu quite a number of times thanks to how awesome Windows messed up my laptop. This script seeks to help anyone who multi-tasks, or does not constantly check their terminals. ntfy wasn't consistent always, so made this.

Tested on fresh install of Ubuntu 16.04, Arch Linux and Mac. Ubuntu 14 may require Slick.ogg whose path must be changed before usage.

Contributing

(Back to top)

Your contributions are always welcome :smile: ! Please have a look at the contribution guidelines first.

Discussion Group: https://www.facebook.com/groups/552015885141292/

You can use refer.md for some previous work I've referred to while making this.

Have a suggestion? Make an issue about it.

Debugging

(Back to top)

Not working/ Message not displayed

check if notify-osd is working with this - notify-send "hi"

If no message pops up, it means notify-osd has stopped working. Reinstall some dependencies and try again:

sudo apt-get --reinstall install libnotify-bin notify-osd

For further customizations, you can use NotifyOSD config

Acknowledgements

(Back to top)

License

(Back to top)

The MIT License (MIT) 2017 - Kaustubh Hiware. Please have a look at the LICENSE.md for more details.