refactor(cli): simplify tmux session handling and include mise shims

This commit is contained in:
Prad Nukala committed 2026-10-08 11:41:44 -04:00
1 parent c7486b4694
commit c19387917a
1 file changed
+7 -11
+7 -11
View File
@@ -6,18 +6,14 @@
# after boot starts the server, which is what triggers continuum's restore. # after boot starts the server, which is what triggers continuum's restore.
# ponytail: two windows opened in the same instant can claim the same detached # ponytail: two windows opened in the same instant can claim the same detached
# session; take a lock (flock) here if that ever bites. # session; take a lock (flock) here if that ever bites.
#
# The session's @tab-bg is set to Ghostty's own background (its theme, not # A server started here inherits this PATH. Ghostty launched from the desktop
# Omarchy's), so the tab arrows tmux paints in that color match the window. # has no shell init, so add mise's shims for tools tmux plugins shell out to
# (bun for tmux-palette, fzf, zoxide).
[[ -d $HOME/.local/share/mise/shims ]] && PATH="$HOME/.local/share/mise/shims:$PATH"
oldest=$(tmux list-sessions -f '#{==:#{session_attached},0}' \ oldest=$(tmux list-sessions -f '#{==:#{session_attached},0}' \
-F '#{session_created} #{session_name}' 2>/dev/null | sort -n | head -1 | cut -d' ' -f2-) -F '#{session_created} #{session_name}' 2>/dev/null | sort -n | head -1 | cut -d' ' -f2-)
bg=$(ghostty +show-config 2>/dev/null | sed -n 's/^background = //p') [[ -n $oldest ]] && exec tmux attach-session -t "=$oldest"
set_bg=() exec tmux new-session
[[ -n $bg ]] && set_bg=(\; set-option @tab-bg "$bg")
if [[ -n $oldest ]]; then
exec tmux attach-session -t "=$oldest" "${set_bg[@]}"
fi
exec tmux new-session "${set_bg[@]}"