diff --git a/bumblebee_status/modules/contrib/pomodoro-sound.wav b/bumblebee_status/modules/contrib/pomodoro-sound.wav new file mode 100644 index 0000000..21400b1 Binary files /dev/null and b/bumblebee_status/modules/contrib/pomodoro-sound.wav differ diff --git a/bumblebee_status/modules/contrib/pomodoro.py b/bumblebee_status/modules/contrib/pomodoro.py index 3f1397a..8508938 100644 --- a/bumblebee_status/modules/contrib/pomodoro.py +++ b/bumblebee_status/modules/contrib/pomodoro.py @@ -15,6 +15,8 @@ Parameters: not support command chaining (see https://github.com/tobi-wan-kenobi/bumblebee-status/issues/532 for a detailed explanation) +If you want to change the work and break duration, just change variables in the beginning of the pomodoro.py file. + contributed by `martindoublem `_, inspired by `karthink `_ - many thanks! """ @@ -25,17 +27,22 @@ from math import ceil import core.module import core.widget import core.input - +import simpleaudio as sa import util.cli +# Recommended to use .wav format +sound= "/.config/i3/bumblebee-status/bumblebee_status/modules/contrib/pomodoro-sound.wav" +work_time = 25 +break_time = 5 + class Module(core.module.Module): def __init__(self, config, theme): super().__init__(config, theme, core.widget.Widget(self.text)) # Parameters - self.__work_period = int(self.parameter("work", 25)) - self.__break_period = int(self.parameter("break", 5)) + self.__work_period = int(self.parameter("work", work_time)) + self.__break_period = int(self.parameter("break", break_time)) self.__time_format = self.parameter("format", "%m:%s") self.__notify_cmd = self.parameter("notify", "") @@ -95,9 +102,12 @@ class Module(core.module.Module): self.__text = self.remaining_time_str() + self.pomodoro["type"] - def notify(self): - if self.__notify_cmd: - util.cli.execute(self.__notify_cmd) + def notify(self): + wave = sa.WaveObject.from_wave_file(sound) + play = wave.play() + if self.__notify_cmd: + util.cli.execute(self.__notify_cmd) + def timer_play_pause(self, widget): if self.pomodoro["state"] == "OFF":