From 2091b86c9da53616d8d4b2d0dafe8e5275223996 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sat, 1 Mar 2025 12:22:44 +0100 Subject: [PATCH] play alarm sound --- shell.nix | 2 ++ src/dndbuster/app.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/shell.nix b/shell.nix index c3d98bf..4b64691 100644 --- a/shell.nix +++ b/shell.nix @@ -14,6 +14,8 @@ #dbus-python ])) + pkgs.libcanberra-gtk3 + # Not sure if required #pkgs.glib #pkgs.gtk4 diff --git a/src/dndbuster/app.py b/src/dndbuster/app.py index 522449a..ffeb9e1 100644 --- a/src/dndbuster/app.py +++ b/src/dndbuster/app.py @@ -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()