hughbien / thyme

Pomodoro timer for tmux

Home Page:https://hughbien.com/thyme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

configuring "before" and "after" hooks

atsalolikhin-spokeo opened this issue · comments

Hi! I just installed thyme and I tried to configure it to play sounds before and after each pomodoro (let's say a ticking sound before, and a ringing sound after, like a kitchen timer).

hooks:
  notify:
    events: ["before"]
    command: "play ticking-sound.mp3" 

  notify:
    events: ["after"]
    command: "play ringing-sound.mp3" 

It would only play the ringing sound.

After staring at the YAML for a while, I realized with this structure, the second value of notify overrides the first one; in other words, if I swap the two and put "after" first and "before" after, then I get the before sound but not the after sound.

So I used this:

hooks:
  notify:
    events: ["before"]
    command: ...

  notify_break:
    events: ["before_break"]
    command: ...

to get both sounds, but that only works if I run thyme -r; I can't get that with a single pomodoro.

What am I missing? :)

On a side note, my actual "before" command is to call a tick.sh shell script which backgrounds the play command, otherwise thyme won't start the timer until after the ticking sound ends:

[~/git/atsaloli/config-files/sounds] [py-3.9.7] master(+0/-0)+* ± cat tick.sh
#!/bin/bash
nohup ~/git/homebrew/bin/play ~/git/atsaloli/config-files/sounds/ticking.mp3 vol 0.25 repeat 75 >/dev/null 2>/dev/null &
[~/git/atsaloli/config-files/sounds] [py-3.9.7] master(+0/-0)+* ±