From 1d30a401cb68231a0dea465fd976d21b645c5008 Mon Sep 17 00:00:00 2001 From: Joshua Steele Date: Sat, 6 Jun 2026 09:56:42 +0300 Subject: [PATCH] fix(tmux): background the project-accent session-created hook The session-created hook ran project-accent.sh via a foreground run-shell, which blocks tmux's command queue while the script forks bash plus several tmux subprocesses. During `tmuxinator start`, that work landed on the command queue's critical path just as the project's panes were spawning their shells, adding shell-startup contention. Add `-b` so the hook runs in the background, off the critical path. The script's own `refresh-client -S` still repaints the status bar, so the accent continues to appear immediately on new sessions. --- tmux/.config/tmux/project-accent.tmux | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tmux/.config/tmux/project-accent.tmux b/tmux/.config/tmux/project-accent.tmux index 7bcc1937..dfcdfadf 100644 --- a/tmux/.config/tmux/project-accent.tmux +++ b/tmux/.config/tmux/project-accent.tmux @@ -20,8 +20,12 @@ # Switching themes: parameterize the new theme's pills with #{@accent} the same # way (see tokyonight_moon.tmux) — that is all this feature needs from a theme. -# Apply the project color whenever a session is created... -set-hook -g session-created 'run-shell "~/.config/tmux/scripts/project-accent.sh #{hook_session}"' +# Apply the project color whenever a session is created. Background the hook +# (-b) so it stays off tmux's command-queue critical path: a foreground +# run-shell here blocks the server while tmuxinator spawns a project's panes, +# adding shell-startup contention. The script's own `refresh-client -S` still +# paints the accent right away, so backgrounding costs no immediacy. +set-hook -g session-created 'run-shell -b "~/.config/tmux/scripts/project-accent.sh #{hook_session}"' # ...and backfill any sessions that already exist when this file is (re)sourced. run-shell "~/.config/tmux/scripts/project-accent.sh"