approval notifs

This commit is contained in:
Daniel Edrisian
2025-08-31 13:20:10 -07:00
parent 9b74053cb7
commit 0bc3b4bcbf
2 changed files with 5 additions and 14 deletions

View File

@@ -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);

View File

@@ -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,