Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pomodoro Audio Notifications #999

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions bumblebee_status/modules/contrib/pomodoro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/martindoublem>`_, inspired by `karthink <https://github.com/karthink>`_ - many thanks!
"""

Expand All @@ -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):
Expand Down Expand Up @@ -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":
Expand Down
Loading