mirror of
https://github.com/openai/codex.git
synced 2026-04-24 06:35:50 +00:00
approval notifs
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user