This commit is contained in:
Yehor Prabhu 2023-11-01 03:09:10 -07:00 committed by GitHub
commit 6f645a3b2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,7 @@ Parameters:
not support command chaining (see https://github.com/tobi-wan-kenobi/bumblebee-status/issues/532 not support command chaining (see https://github.com/tobi-wan-kenobi/bumblebee-status/issues/532
for a detailed explanation) 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 <https://github.com/martindoublem>`_, inspired by `karthink <https://github.com/karthink>`_ - many thanks! contributed by `martindoublem <https://github.com/martindoublem>`_, inspired by `karthink <https://github.com/karthink>`_ - many thanks!
""" """
@ -25,9 +26,12 @@ from math import ceil
import core.module import core.module
import core.widget import core.widget
import core.input import core.input
import simpleaudio as sa
import util.cli import util.cli
# Recommended to use .wav format
sound= "path/to/musicfile"
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config, theme): def __init__(self, config, theme):
@ -96,8 +100,14 @@ class Module(core.module.Module):
self.__text = self.remaining_time_str() + self.pomodoro["type"] self.__text = self.remaining_time_str() + self.pomodoro["type"]
def notify(self): def notify(self):
if self.__notify_cmd: try:
util.cli.execute(self.__notify_cmd) 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): def timer_play_pause(self, widget):
if self.pomodoro["state"] == "OFF": if self.pomodoro["state"] == "OFF":