From 5a888a3e603dd48370999f952f7def20020aff45 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Fri, 27 Mar 2026 12:25:08 +0900 Subject: [PATCH 1/2] feat(tmux): auto-save on detach/close and fix restore timing Entire-Checkpoint: 02031fb40538 --- home-manager/programs/fish/functions/_two_function.fish | 1 + home-manager/programs/tmux/tmux.conf | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/home-manager/programs/fish/functions/_two_function.fish b/home-manager/programs/fish/functions/_two_function.fish index 04c8d4edc..97568aec3 100644 --- a/home-manager/programs/fish/functions/_two_function.fish +++ b/home-manager/programs/fish/functions/_two_function.fish @@ -16,6 +16,7 @@ function _two_function --description "Attach to tmux work session" set -l restore $restore[1] if test -n "$restore" tmux run-shell "$restore" + sleep 1 end # Clean up temp session if restore created work if tmux has-session -t work 2>/dev/null diff --git a/home-manager/programs/tmux/tmux.conf b/home-manager/programs/tmux/tmux.conf index d572a4e0e..e69630476 100644 --- a/home-manager/programs/tmux/tmux.conf +++ b/home-manager/programs/tmux/tmux.conf @@ -133,6 +133,10 @@ set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$ set -g @continuum-restore 'off' set -g @continuum-save-interval '3' +# Auto-save on detach/close so kills don't lose state +set-hook -g client-detached 'run-shell #{@resurrect-save-script-path}' +set-hook -g session-closed 'run-shell #{@resurrect-save-script-path}' + # Tmux-thumbs (quick text copy) set -g @thumbs-key Space From c6350b519edad3fb26a18650b2825e9f20fdb1d6 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki <39187513+shunkakinoki@users.noreply.github.com> Date: Fri, 27 Mar 2026 12:29:56 +0900 Subject: [PATCH 2/2] Update _two_function.fish --- home-manager/programs/fish/functions/_two_function.fish | 1 - 1 file changed, 1 deletion(-) diff --git a/home-manager/programs/fish/functions/_two_function.fish b/home-manager/programs/fish/functions/_two_function.fish index 97568aec3..04c8d4edc 100644 --- a/home-manager/programs/fish/functions/_two_function.fish +++ b/home-manager/programs/fish/functions/_two_function.fish @@ -16,7 +16,6 @@ function _two_function --description "Attach to tmux work session" set -l restore $restore[1] if test -n "$restore" tmux run-shell "$restore" - sleep 1 end # Clean up temp session if restore created work if tmux has-session -t work 2>/dev/null