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

Notify only if a command takes more than a configured amount of time #5

Open icyflame opened 7 years ago

icyflame commented 7 years ago

Some commands are long running (like npm install or wget -R) and those are the only ones I would be interested in notifications for. Would you be interested in adding something like this to this package?

kaustubhhiware commented 7 years ago

This is already configured. Although it's not exactly parameterised in the shell file.

P.S: Relevant line in .sh Relevant line in .fish Snippets: sh

    [ $(($(date +%s) - start)) -le 0 ] || .....
    [ $(($(date +%s) - start)) -le 1 ] || ....

fish

    set -x timeout 1
    set -x ring_timeout 2
...
        if test $CMD_DURATION -gt (math "1000 * $ring_timeout") # time set for ring
        ....

This is a max 2 minute fix. But I would rather let someone else do it, since it's Hacktoberfest.

icyflame commented 7 years ago

@kaustubhhiware I see. If I understand it right, there's no central config store right now. I would be interested in three configurable options:

  1. the list of commands that I want to be notified for
  2. whether I want the audio or not (I don't like the audio, keeping it configurable seems like a good way to go)
  3. minimum time interval that a command must take to qualify for a notification

Would you be interested in these options? I will take a stab at implementing these, if you are.

(I have wanted this for a while now, and all the solutions need you to put the command before running it. That's honestly annoying)

kaustubhhiware commented 7 years ago

I pretty much agree with the options you've suggested. I'm hopeful someone new to open source contributes, else you or I can do this in an hour or so.

icyflame commented 7 years ago

Ah, I just saw this. I was delving into the code, and I fixed it. Have a look!

kaustubhhiware commented 7 years ago

Close in favor of #6

kaustubhhiware commented 7 years ago

Fish script to be updated.