Skip to content

feat(tmux): fix resurrect and add 3rd tab to tmuxinator configs - #1285

Merged
shunkakinoki merged 2 commits into
mainfrom
feat/tmux-resurrect-and-tabs
Mar 27, 2026
Merged

feat(tmux): fix resurrect and add 3rd tab to tmuxinator configs#1285
shunkakinoki merged 2 commits into
mainfrom
feat/tmux-resurrect-and-tabs

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix tmux-resurrect by adding #{continuum_status} to status-right (was being overwritten)
  • Filter resurrect saves to only persist the work session (portable macOS/Linux)
  • Add 3rd shell tab to all tmuxinator configs (work, primary, desktop, mobile)
  • Add input-leap to base packages

Test plan

  • Verify prefix + Ctrl-s saves only work session data in ~/.tmux/resurrect/last
  • Verify continuum auto-saves every 3 minutes
  • Verify tmuxinator start work/primary/desktop/mobile creates 3 tabs

Summary by cubic

Fix tmux session persistence by showing #{continuum_status} and saving only the work session. Add a third shell tab to all tmuxinator profiles and include input-leap in base packages.

  • New Features

    • Filter tmux-resurrect saves to the work session via a post-save hook (portable on macOS/Linux).
    • Add a third shell tab to all tmuxinator configs: work, primary, desktop, mobile.
  • Dependencies

    • Add input-leap to base packages for all Home Manager profiles.

Written for commit 0c2eda7. Summary will update on new commits.

…xinator configs

Entire-Checkpoint: 65ca4648d54b
- The package is now included for every Home Manager profile using this list.
Copilot AI review requested due to automatic review settings March 27, 2026 02:07
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 27, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3155944b-0639-46dc-a8de-e7168cec4d9b

📥 Commits

Reviewing files that changed from the base of the PR and between 67e7181 and 0c2eda7.

📒 Files selected for processing (6)
  • config/tmuxinator/desktop.yml
  • config/tmuxinator/mobile.yml
  • config/tmuxinator/primary.yml
  • config/tmuxinator/work.yml
  • home-manager/packages/default.nix
  • home-manager/programs/tmux/tmux.conf

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added input-leap tool to environment
    • Enhanced tmux status bar with backup/restore status indicator
  • Chores

    • Updated terminal window configurations

Walkthrough

This change introduces new tmuxinator window declarations across four session configurations, adds the input-leap package to home-manager, and updates the tmux status bar to display continuum status along with a custom post-save hook for session resurrection.

Changes

Cohort / File(s) Summary
Tmuxinator Window Declarations
config/tmuxinator/desktop.yml, config/tmuxinator/mobile.yml, config/tmuxinator/primary.yml, config/tmuxinator/work.yml
Added new named window entries (desktop, mobile, primary, work) under the windows: list in each respective session configuration.
Home Manager Packages
home-manager/packages/default.nix
Added input-leap to the list of installed packages.
Tmux Configuration
home-manager/programs/tmux/tmux.conf
Updated status bar right segment to include #{continuum_status} and added a @resurrect-hook-post-save-all post-save hook that filters and rewrites resurrect state to only include pane|window entries with work state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #935: Modifies the same tmuxinator YAML configuration files by introducing window entries to existing session definitions.
  • PR #926: Updates both tmuxinator session configurations and tmux.conf, overlapping with changes to session and terminal multiplexer behavior.
  • PR #774: Adds packages to home-manager/packages/default.nix, representing parallel package list modifications.

Poem

🐰 Tmux windows bloom like garden rows,
Leap input bounds through flowing flows,
Sessions save, in work they sow,
Continuum marks the status' glow!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tmux-resurrect-and-tabs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Mar 27, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixed tmux-resurrect functionality and added a third shell tab to all tmuxinator configurations.

What changed?

  • Fixed tmux-resurrect by adding #{continuum_status} to status-right.
  • Filtered resurrect saves to only persist the work session.
  • Added a 3rd shell tab to all tmuxinator configs (work, primary, desktop, mobile).
  • Added input-leap to base packages.

Description generated by Mesa. Update settings

@shunkakinoki
shunkakinoki merged commit a8f9942 into main Mar 27, 2026
33 of 35 checks passed
@shunkakinoki
shunkakinoki deleted the feat/tmux-resurrect-and-tabs branch March 27, 2026 02:08

@gemini-code-assist gemini-code-assist Bot left a comment

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.

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"'

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 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"'

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

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"'

@cubic-dev-ai cubic-dev-ai Bot Mar 27, 2026

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.

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>
Suggested change
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"'
Fix with Cubic

Copilot AI left a comment

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.

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 into status-right so tmux-continuum can render its status indicator.
  • Add a @resurrect-hook-post-save-all filter intended to persist only work session state in resurrect saves.
  • Add a third window to each tmuxinator config and include input-leap in 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"'

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 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.

Suggested change
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"; }'

Copilot uses AI. Check for mistakes.
@coderabbitai coderabbitai Bot mentioned this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants