Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions home-manager/programs/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copilot AI Mar 27, 2026

Copy link

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.

Suggested change
# Auto-save on detach/close so kills don't lose state
# Auto-save on detach/normal session close to preserve state

Copilot uses AI. Check for mistakes.
set-hook -g client-detached 'run-shell #{@resurrect-save-script-path}'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The run-shell command executes the save script, but if the script fails (e.g., due to @resurrect-save-script-path being undefined, pointing to a non-executable file, or the script itself encountering an error), the save operation will silently fail. This could lead to unexpected data loss, as the user would assume their session state is being saved on detach/close. It is recommended to add error handling or logging within the script or the run-shell command (e.g., sh -c "script || tmux display-message ...") to provide feedback if the save fails.

set-hook -g session-closed 'run-shell #{@resurrect-save-script-path}'

Copilot AI Mar 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The session-closed hook runs when a session is closed, so @resurrect-save-script-path will snapshot after the session is gone. Because the post-save hook filters the saved file down to work panes, closing the work session can overwrite ~/.tmux/resurrect/last with an effectively empty snapshot, breaking restore. Consider removing the session-closed hook, or wrapping the save command to no-op unless the work session still exists (to avoid clobbering the last good snapshot).

Suggested change
set-hook -g session-closed 'run-shell #{@resurrect-save-script-path}'

Copilot uses AI. Check for mistakes.
Comment on lines +137 to +138

Copilot AI Mar 27, 2026

Copy link

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.

Suggested change
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 uses AI. Check for mistakes.
Comment on lines +136 to +138

Copilot AI Mar 27, 2026

Copy link

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.

Copilot uses AI. Check for mistakes.

# Tmux-thumbs (quick text copy)
set -g @thumbs-key Space

Expand Down
Loading