diff options
Diffstat (limited to 'crates/dinggerd/src/notify.rs')
| -rw-r--r-- | crates/dinggerd/src/notify.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/dinggerd/src/notify.rs b/crates/dinggerd/src/notify.rs index 555299d..11b37b0 100644 --- a/crates/dinggerd/src/notify.rs +++ b/crates/dinggerd/src/notify.rs @@ -31,6 +31,15 @@ impl NotificationKind { static SOUND_SEQ: AtomicU64 = AtomicU64::new(0); pub fn play_sound(kind: &NotificationKind) { + // Test seam: play through a command instead (tests/e2e.sh). + if let Ok(command) = std::env::var("DINGGER_SOUND") { + let name = match kind { + NotificationKind::NeedsAttention => "request", + NotificationKind::Finished => "done", + }; + let _ = Command::new("sh").args(["-c", &command, name]).stdin(Stdio::null()).spawn(); + return; + } // Sounds are embedded; afplay needs a file, so stage the bytes in the // system temp dir. let path = std::env::temp_dir().join(format!( |
