diff options
Diffstat (limited to 'crates/dinggerd/src/notify.rs')
| -rw-r--r-- | crates/dinggerd/src/notify.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/dinggerd/src/notify.rs b/crates/dinggerd/src/notify.rs index 11b37b0..ef2c721 100644 --- a/crates/dinggerd/src/notify.rs +++ b/crates/dinggerd/src/notify.rs @@ -8,6 +8,8 @@ use tracing::{info, warn}; pub enum NotificationKind { NeedsAttention, Finished, + /// A run that ended in an error: done, but you have to act. + Failed, } impl NotificationKind { @@ -15,6 +17,7 @@ impl NotificationKind { match self { Self::NeedsAttention => "needs attention", Self::Finished => "finished", + Self::Failed => "failed", } } @@ -22,7 +25,7 @@ impl NotificationKind { /// for completions. fn sound_bytes(&self) -> &'static [u8] { match self { - Self::NeedsAttention => include_bytes!("../assets/request.mp3"), + Self::NeedsAttention | Self::Failed => include_bytes!("../assets/request.mp3"), Self::Finished => include_bytes!("../assets/done.mp3"), } } @@ -34,7 +37,7 @@ 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::NeedsAttention | NotificationKind::Failed => "request", NotificationKind::Finished => "done", }; let _ = Command::new("sh").args(["-c", &command, name]).stdin(Stdio::null()).spawn(); |
