diff --git a/bumblebee_status/modules/contrib/pomodoro.py b/bumblebee_status/modules/contrib/pomodoro.py index 3f1397a2..39491f06 100644 --- a/bumblebee_status/modules/contrib/pomodoro.py +++ b/bumblebee_status/modules/contrib/pomodoro.py @@ -15,6 +15,7 @@ not support command chaining (see https://github.com/tobi-wan-kenobi/bumblebee-status/issues/532 for a detailed explanation) +If you want pomodoro timer to signalize the end of the work and rest session, put the path to your audio file in the sound variable at the beginning of pomodoro.py. contributed by `martindoublem `_, inspired by `karthink `_ - many thanks! """ @@ -25,9 +26,12 @@ import core.module import core.widget import core.input - +import simpleaudio as sa import util.cli +# Recommended to use .wav format +sound= "path/to/musicfile" + class Module(core.module.Module): def __init__(self, config, theme): @@ -96,8 +100,14 @@ def update(self): self.__text = self.remaining_time_str() + self.pomodoro["type"] def notify(self): - if self.__notify_cmd: - util.cli.execute(self.__notify_cmd) + try: + wave = sa.WaveObject.from_wave_file(sound) + play = wave.play() + except FileNotFoundError: + pass + if self.__notify_cmd: + util.cli.execute(self.__notify_cmd) + def timer_play_pause(self, widget): if self.pomodoro["state"] == "OFF":