play alarm sound

This commit is contained in:
Daniel Langbein 2025-03-01 12:22:44 +01:00
parent 7304929aa4
commit 2091b86c9d
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,8 @@
#dbus-python
]))
pkgs.libcanberra-gtk3
# Not sure if required
#pkgs.glib
#pkgs.gtk4

View File

@ -1,3 +1,5 @@
import subprocess
import gi
from timer import Timer
@ -30,6 +32,10 @@ class Application(Adw.Application):
notification.add_button(label='Restart', detailed_action='app.restart-timer')
self.send_notification(id=f'{self.get_application_id()}.{Timer.current_time()}', notification=notification)
# https://0pointer.de/public/sound-naming-spec.html
sound_name = 'alarm-clock-elapsed'
subprocess.run(['canberra-gtk-play', '-i', sound_name])
def on_notification_button_restart(self, _action: Gio.SimpleAction, _other: None):
self.window.restart()