aboutsummaryrefslogtreecommitdiff
path: root/crates/dinggerd/src/hooks.rs
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-10-23 13:01:52 +0300
committerIgor Soarez <igor@soarez.org>2026-10-23 13:01:52 +0300
commit0f06b0b15d6b064703fa1166fb8e7ceda209aaa8 (patch)
tree4ecb5cf8daa390ef131962d64925ab0d325b6c39 /crates/dinggerd/src/hooks.rs
parentde1a3ce438d31df262a026bfb104ca07e656ee30 (diff)
restore, step 1: layout snapshots and dingger restore
the daemon saves the tmux layout when it changes: sessions, windows (index, name, automatic-rename, layout, size, zoom, active), and panes (directory, active, agent). a new history file for layout changes, a rewrite for details, the last 50 kept, nothing saved while tmux is down. when a different server runs (or none), the old server's last snapshot is pinned as the restore candidate before the new server's snapshots start. dingger restore rebuilds missing sessions by tmux id: panes split from the newest so they keep their order, the saved layout applied at the saved size, then the size released so windows follow clients again. a bare session of the same name (a terminal's `new-session -As 0`) is replaced, its clients switched over first; used sessions are kept. --dry-run, --list, --from, --session. e2e step 16 kills a server with a client attached like ghostty's, restarts it, restores, and compares every window and pane; splitting the wrong pane, not replacing bare sessions, not pinning, or keeping the saved size each fail it. e2e keeps its state in its temp dir.
Diffstat (limited to 'crates/dinggerd/src/hooks.rs')
-rw-r--r--crates/dinggerd/src/hooks.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/crates/dinggerd/src/hooks.rs b/crates/dinggerd/src/hooks.rs
index 524fb2d..46077cf 100644
--- a/crates/dinggerd/src/hooks.rs
+++ b/crates/dinggerd/src/hooks.rs
@@ -31,14 +31,7 @@ pub fn socket_path() -> PathBuf {
if let Some(path) = std::env::var_os("DINGGER_AGENT_SOCKET") {
return PathBuf::from(path);
}
- let state = std::env::var_os("DINGGER_STATE_DIR")
- .map(PathBuf::from)
- .or_else(|| {
- std::env::var_os("HOME")
- .map(|home| PathBuf::from(home).join(".local").join("state").join("dingger"))
- })
- .unwrap_or_else(|| PathBuf::from(".dingger"));
- state.join("agent.sock")
+ crate::snapshot::state_dir().join("agent.sock")
}
#[derive(Debug, Default)]