diff options
Diffstat (limited to 'crates/dinggerd/src/watcher.rs')
| -rw-r--r-- | crates/dinggerd/src/watcher.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/dinggerd/src/watcher.rs b/crates/dinggerd/src/watcher.rs index a2f5ef1..24a2ecd 100644 --- a/crates/dinggerd/src/watcher.rs +++ b/crates/dinggerd/src/watcher.rs @@ -23,6 +23,7 @@ //! - `@dingger_since` unix ms the pane started needing the user (FIFO) //! - `@dingger_hook` last state an agent extension reported //! - `@dingger_ack` one-shot "the user jumped here" event from `dingger focus` +//! - `@agent_session` the agent's session reference, for restore use std::collections::HashMap; @@ -328,6 +329,16 @@ impl Watcher { if pane.agent.is_none() && !pane.written_hook.is_empty() { let _ = tmux::unset_pane_option(&pane.pane_id, "@dingger_hook"); } + // The session reference, for restore; it goes with the agent. + match (pane.agent, hooks::session(&pane.pane_id)) { + (Some(_), Some(session)) if pane.written_session != session => { + let _ = tmux::set_pane_option(&pane.pane_id, "@agent_session", &session); + } + (None, _) if !pane.written_session.is_empty() => { + let _ = tmux::unset_pane_option(&pane.pane_id, "@agent_session"); + } + _ => {} + } } fn notify(&self, pane: &tmux::Pane, kind: NotificationKind) { |
