-
Notifications
You must be signed in to change notification settings - Fork 0
feat(tmux): auto-save on detach/close and fix restore timing #1287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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}' | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||||||||
| set-hook -g session-closed 'run-shell #{@resurrect-save-script-path}' | ||||||||||||
|
||||||||||||
| set-hook -g session-closed 'run-shell #{@resurrect-save-script-path}' |
Copilot
AI
Mar 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run-shell without -b runs synchronously; on detach/close this can block the tmux hook until resurrect finishes saving (potentially slow when capturing pane contents). Consider using background mode (run-shell -b ...) to avoid UI delays/hangs during detach/close.
| set-hook -g client-detached 'run-shell #{@resurrect-save-script-path}' | |
| set-hook -g session-closed 'run-shell #{@resurrect-save-script-path}' | |
| set-hook -g client-detached 'run-shell -b #{@resurrect-save-script-path}' | |
| set-hook -g session-closed 'run-shell -b #{@resurrect-save-script-path}' |
Copilot
AI
Mar 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR description mentions adding a sleep after resurrect restore in two to fix a race, but _two_function.fish currently has no such delay (it runs tmux run-shell "$restore" and immediately checks for the work session). Either include that change or update the PR description so it matches what’s being shipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment says “kills don't lose state”, but these hooks won’t run if the tmux server is killed (e.g.,
kill-server/SIGKILL). Consider rewording to reflect detach/session-close only, so the config doesn’t over-promise durability.