aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
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()),