Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions config/tmuxinator/desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ windows:
panes:
-
-
- desktop:
1 change: 1 addition & 0 deletions config/tmuxinator/mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ windows:
panes:
-
-
- mobile:
1 change: 1 addition & 0 deletions config/tmuxinator/primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ windows:
panes:
-
-
- primary:
1 change: 1 addition & 0 deletions config/tmuxinator/work.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ name: work
windows:
- editor: nvim
- shell:
- work:
1 change: 1 addition & 0 deletions home-manager/packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ with pkgs;
htop
httpie
hyperfine
input-leap
jq
jujutsu
just
Expand Down
5 changes: 3 additions & 2 deletions home-manager/programs/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ set -g clock-mode-style 24
# =============================================================================
set -g status-style "bg=colour22,fg=colour255"
set -g status-left "#[bg=colour28,fg=colour255,bold] #S #[bg=colour22,fg=colour28] "
set -g status-right "#[fg=colour250]#{?#{pane_current_command},#{pane_current_command},} #[fg=colour28]| #[fg=colour255]%Y/%m/%d %H:%M:%S "
set -g status-right "#[fg=colour250]#{?#{pane_current_command},#{pane_current_command},} #[fg=colour28]| #[fg=colour255]%Y/%m/%d %H:%M:%S #{continuum_status}"
set -g status-left-length 30
set -g status-right-length 60

Expand All @@ -126,9 +126,10 @@ set -g message-style "bg=colour28,fg=colour255"
# =============================================================================
# Plugin configuration
# =============================================================================
# Resurrect + Continuum (session persistence)
# 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 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 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.
set -g @continuum-restore 'off'
set -g @continuum-save-interval '3'

Expand Down
Loading