the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix sound request alerts in active workspace
Ogulcan Celike719c6517d6c
diff --git a/src/app/actions.rs b/src/app/actions.rsindex 98159fccd..787f68696 100644--- a/src/app/actions.rs+++ b/src/app/actions.rs@@ -9,6 +9,24 @@ use crate::layout::{find_in_direction, NavDirection, PaneId};use super::state::{AppState, Mode};+fn notification_sound_for_state_change(+ is_active_ws: bool,+ prev_state: AgentState,+ new_state: AgentState,+) -> Option<crate::sound::Sound> {+ if new_state == prev_state {+ return None;+ }++ match new_state {+ AgentState::Waiting => Some(crate::sound::Sound::Request),+ AgentState::Idle if prev_state != AgentState::Idle && !is_active_ws => {+ Some(crate::sound::Sound::Done)+ }+ _ => None,+ }+}+// ---------------------------------------------------------------------------// Workspace operations// ---------------------------------------------------------------------------@@ -168,16 +186,12 @@ impl AppState {pane.seen = false;}- // Sound notifications for background state changes- if self.sound.allows(agent) && !is_active_ws && state != prev_state {- match state {- AgentState::Idle if prev_state != AgentState::Idle => {- crate::sound::play(crate::sound::Sound::Done);- }- AgentState::Waiting => {- crate::sound::play(crate::sound::Sound::Request);- }- _ => {}+ // Waiting prompts should always make noise; done sounds stay background-only.+ if self.sound.allows(agent) {+ if let Some(sound) =+ notification_sound_for_state_change(is_active_ws, prev_state, state)+ {+ crate::sound::play(sound);}}@@ -408,6 +422,26 @@ mod tests {assert!(!pane.seen);}+ #[test]+ fn waiting_sound_plays_even_in_active_workspace() {+ assert_eq!(+ notification_sound_for_state_change(true, AgentState::Busy, AgentState::Waiting),+ Some(crate::sound::Sound::Request)+ );+ }++ #[test]+ fn done_sound_only_plays_in_background() {+ assert_eq!(+ notification_sound_for_state_change(false, AgentState::Busy, AgentState::Idle),+ Some(crate::sound::Sound::Done)+ );+ assert_eq!(+ notification_sound_for_state_change(true, AgentState::Busy, AgentState::Idle),+ None+ );+ }+#[test]fn toggle_fullscreen_works() {let mut state = app_with_workspaces(&["test"]);diff --git a/src/sound.rs b/src/sound.rsindex e184d02c1..8f7697019 100644--- a/src/sound.rs+++ b/src/sound.rs@@ -10,6 +10,7 @@ static SOUND_DONE: &[u8] = include_bytes!("../assets/sounds/done.mp3");static SOUND_REQUEST: &[u8] = include_bytes!("../assets/sounds/request.mp3");/// Which notification sound to play.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]pub enum Sound {/// Agent finished work (transitioned to Idle).Done,