diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index 21c758b127..3c3c77f94e 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -99,20 +99,6 @@ impl App { app_focused: Arc::new(AtomicBool::new(true)), }; - // Periodic notification task: every 5 seconds, if unfocused, send a reminder. - { - let focused = app.app_focused.clone(); - tokio::spawn(async move { - use tokio::time::{sleep, Duration}; - loop { - sleep(Duration::from_secs(5)).await; - if !focused.load(Ordering::Relaxed) { - crate::notifications::send_os_notification("Codex is running in the background"); - } - } - }); - } - let tui_events = tui.event_stream(); tokio::pin!(tui_events); diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index f2346616de..8c5a3034fc 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -3,6 +3,7 @@ use std::collections::VecDeque; use std::path::PathBuf; use std::sync::Arc; +use crate::notifications; use codex_core::config::Config; use codex_core::protocol::AgentMessageDeltaEvent; use codex_core::protocol::AgentMessageEvent; @@ -504,6 +505,10 @@ impl ChatWidget { pub(crate) fn handle_exec_approval_now(&mut self, id: String, ev: ExecApprovalRequestEvent) { self.flush_answer_stream_with_separator(); + // Send an OS notification summarizing the command requiring approval. + let preview = ev.command.join(" "); + let msg = format!("Approve \"{preview}\"?"); + notifications::send_os_notification(&msg); let request = ApprovalRequest::Exec { id,