aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-03-27 23:53:37 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-03-27 23:53:37 +0300
commit0403775fd2a9458417c5349d5441125ab9b2553c (patch)
tree37f741893e063da7cfb420e5e32c960fff105a1a /src/app
parent1d867053fce00e300c4551ed8087f55885e4d3c2 (diff)
feat: sound notifications for agent state changes
play a chime when an agent finishes work and an alert when one needs input. only triggers for background workspaces. configurable via sound = true/false under [ui] in config.
Diffstat (limited to 'src/app')
-rw-r--r--src/app/actions.rs19
-rw-r--r--src/app/mod.rs1
-rw-r--r--src/app/state.rs2
3 files changed, 21 insertions, 1 deletions
diff --git a/src/app/actions.rs b/src/app/actions.rs
index 8e2e9297..c73ba646 100644
--- a/src/app/actions.rs
+++ b/src/app/actions.rs
@@ -157,12 +157,29 @@ impl AppState {
for (ws_idx, ws) in self.workspaces.iter_mut().enumerate() {
if let Some(pane) = ws.panes.get_mut(&pane_id) {
let is_active_ws = self.active == Some(ws_idx);
+ let prev_state = pane.state;
+
+ // Mark unseen when transitioning to Idle in background
if state == AgentState::Idle
- && pane.state != AgentState::Idle
+ && prev_state != AgentState::Idle
&& !is_active_ws
{
pane.seen = false;
}
+
+ // Sound notifications for background state changes
+ if self.sound && !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);
+ }
+ _ => {}
+ }
+ }
+
pane.detected_agent = agent;
pane.state = state;
break;
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 62250fb8..47aaa3da 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -85,6 +85,7 @@ impl App {
sidebar_collapsed: false,
confirm_close: config.ui.confirm_close,
accent: crate::config::parse_color(&config.ui.accent),
+ sound: config.ui.sound,
keybinds: config.keybinds(),
};
diff --git a/src/app/state.rs b/src/app/state.rs
index b0a81165..440bfc17 100644
--- a/src/app/state.rs
+++ b/src/app/state.rs
@@ -69,6 +69,7 @@ pub struct AppState {
pub sidebar_collapsed: bool,
pub confirm_close: bool,
pub accent: Color,
+ pub sound: bool,
pub keybinds: Keybinds,
}
@@ -119,6 +120,7 @@ impl AppState {
sidebar_collapsed: false,
confirm_close: true,
accent: Color::Cyan,
+ sound: true,
keybinds: Keybinds {
split_vertical: (KeyCode::Char('v'), KeyModifiers::empty()),
split_horizontal: (KeyCode::Char('-'), KeyModifiers::empty()),