feat(tmux): fix resurrect and add 3rd tab to tmuxinator configs - #1285
Conversation
…xinator configs Entire-Checkpoint: 65ca4648d54b
- The package is now included for every Home Manager profile using this list.
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
Disabled knowledge base sources:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis change introduces new tmuxinator window declarations across four session configurations, adds the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Mesa DescriptionTL;DRFixed tmux-resurrect functionality and added a third shell tab to all tmuxinator configurations. What changed?
Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Code Review
This pull request updates several tmuxinator configurations to include dedicated windows, adds the input-leap package to the home-manager configuration, and enhances the tmux status bar with continuum status. It also introduces a post-save hook for tmux-resurrect to filter state files specifically for the 'work' session. A review comment suggests replacing the tilde expansion with $HOME in the tmux hook to ensure portability across different shell environments.
| # Resurrect + Continuum (session persistence — work session only) | ||
| set -g @resurrect-capture-pane-contents 'on' | ||
| set -g @resurrect-processes 'btop fish git' | ||
| set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && grep -E "^(pane|window) work " "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"' |
There was a problem hiding this comment.
The tilde ~ in d=~/.tmux/resurrect will not be expanded to your home directory in all shells, as this is a bash-specific extension and not part of the POSIX sh standard that tmux uses to execute commands. This can cause the hook to fail because it won't be able to find the resurrect files.
To ensure portability across different systems (e.g., macOS and Linux), you should use $HOME instead, which is the POSIX-compliant way to refer to the home directory. Quoting the assignment will also make it more robust.
set -g @resurrect-hook-post-save-all 'd="$HOME/.tmux/resurrect" && f="$d/$(readlink "$d/last")" && grep -E "^(pane|window)\twork\t" "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"'
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="home-manager/programs/tmux/tmux.conf">
<violation number="1" location="home-manager/programs/tmux/tmux.conf:132">
P2: The post-save filter aborts when no `work` lines match, so the save file may remain unfiltered.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| # Resurrect + Continuum (session persistence — work session only) | ||
| set -g @resurrect-capture-pane-contents 'on' | ||
| set -g @resurrect-processes 'btop fish git' | ||
| set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && grep -E "^(pane|window) work " "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"' |
There was a problem hiding this comment.
P2: The post-save filter aborts when no work lines match, so the save file may remain unfiltered.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/programs/tmux/tmux.conf, line 132:
<comment>The post-save filter aborts when no `work` lines match, so the save file may remain unfiltered.</comment>
<file context>
@@ -126,9 +126,10 @@ set -g message-style "bg=colour28,fg=colour255"
+# Resurrect + Continuum (session persistence — work session only)
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'btop fish git'
+set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && grep -E "^(pane|window) work " "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"'
set -g @continuum-restore 'off'
set -g @continuum-save-interval '3'
</file context>
| set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && grep -E "^(pane|window) work " "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"' | |
| set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && { grep -E "^(pane|window) work " "$f" > "$f.tmp" || true; } && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"' |
There was a problem hiding this comment.
Pull request overview
This PR updates the Home Manager tmux/tmuxinator setup to restore tmux-resurrect/continuum status display, scope resurrect persistence to the work session, and standardize tmuxinator projects to open three windows by default.
Changes:
- Add
#{continuum_status}back intostatus-rightso tmux-continuum can render its status indicator. - Add a
@resurrect-hook-post-save-allfilter intended to persist onlyworksession state in resurrect saves. - Add a third window to each tmuxinator config and include
input-leapin the base package set.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| home-manager/programs/tmux/tmux.conf | Updates status-right and adds a post-save resurrect filter hook for work-only persistence. |
| home-manager/packages/default.nix | Adds input-leap to the base package list. |
| config/tmuxinator/work.yml | Adds a third window entry to the work tmuxinator project. |
| config/tmuxinator/primary.yml | Adds a third window entry to the primary tmuxinator project. |
| config/tmuxinator/mobile.yml | Adds a third window entry to the mobile tmuxinator project. |
| config/tmuxinator/desktop.yml | Adds a third window entry to the desktop tmuxinator project. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Resurrect + Continuum (session persistence — work session only) | ||
| set -g @resurrect-capture-pane-contents 'on' | ||
| set -g @resurrect-processes 'btop fish git' | ||
| set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && grep -E "^(pane|window) work " "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"' |
There was a problem hiding this comment.
The post-save hook relies on grep -E ... > "$f.tmp" in an && chain. If the resurrect file contains no matching lines (e.g., save triggered while not in the work session), grep exits 1 and the chain stops, leaving the unfiltered resurrect file in place. Consider making the filter step always rewrite the file (even when 0 matches) so it reliably enforces “work only”, and also handle cases where readlink "$d/last" fails or returns an absolute path so $f is computed correctly.
| set -g @resurrect-hook-post-save-all 'd=~/.tmux/resurrect && f="$d/$(readlink "$d/last")" && grep -E "^(pane|window) work " "$f" > "$f.tmp" && printf "state\twork\n" >> "$f.tmp" && mv "$f.tmp" "$f"' | |
| set -g @resurrect-hook-post-save-all 'd="$HOME/.tmux/resurrect" && last=$(readlink "$d/last" 2>/dev/null || true); [ -z "$last" ] && exit 0; case "$last" in /*) f="$last" ;; *) f="$d/$last" ;; esac; { grep -E "^(pane|window) work " "$f" > "$f.tmp" || true; printf "state\twork\n" >> "$f.tmp"; mv "$f.tmp" "$f"; }' |
Summary
#{continuum_status}to status-right (was being overwritten)worksession (portable macOS/Linux)input-leapto base packagesTest plan
prefix + Ctrl-ssaves only work session data in~/.tmux/resurrect/lasttmuxinator start work/primary/desktop/mobilecreates 3 tabsSummary by cubic
Fix tmux session persistence by showing
#{continuum_status}and saving only theworksession. Add a third shell tab to alltmuxinatorprofiles and includeinput-leapin base packages.New Features
tmux-resurrectsaves to theworksession via a post-save hook (portable on macOS/Linux).tmuxinatorconfigs:work,primary,desktop,mobile.Dependencies
input-leapto base packages for all Home Manager profiles.Written for commit 0c2eda7. Summary will update on new commits.