From f8d525b7eb380e9471a07332d7de56f4b46d92dc Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 14 Aug 2026 09:36:27 +0100 Subject: [PATCH] Add a quick named-session binding and fix theme reload in tmux prefix S now prompts for a name and runs new-session directly, replacing the ` :` then `new -s name` command-mode round trip. Session numbering in choose-tree (prefix s) turned out to be session_id, an internal per-server counter with no base-index equivalent, so it can't be made to start at 1 the way windows do; named sessions plus C-s search in the tree are the workaround. Also fixed a bug found while testing: ` r` re-sources the whole config, and the trailing `source-file ~/.tmux-dark.conf` at the end always ran, clobbering a light-themed session on every manual reload. It now checks the invoking client's theme like the client-attached hook already does. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_013t7aQbc4EyYtab1crvSFTd --- tmux | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tmux b/tmux index 49182f0..45329ff 100644 --- a/tmux +++ b/tmux @@ -14,6 +14,10 @@ set -g renumber-windows on # don't detach when closing a window if other windows remain set -g detach-on-destroy off +# prompt for a name and create a session in one step, instead of +# ` :` then `new -s name` +bind-key S command-prompt -p "New session name:" "new-session -s '%%'" + # reload config file (change file location to your the tmux.conf you want to use) unbind r bind r source-file ~/.tmux.conf @@ -51,5 +55,7 @@ set-hook -g client-dark-theme 'source-file ~/.tmux-dark.conf' # client attaches. Sourcing is idempotent, so the overlap is harmless. set-hook -g client-attached 'if -F "#{==:#{client_theme},light}" "source-file ~/.tmux-light.conf" "source-file ~/.tmux-dark.conf"' -# Default before any client has attached and reported a theme. -source-file ~/.tmux-dark.conf +# Default before any client has attached and reported a theme. This also +# runs on manual reload (`r` below), so check the invoking client's theme +# rather than always falling back to dark and clobbering a light session. +if -F "#{==:#{client_theme},light}" "source-file ~/.tmux-light.conf" "source-file ~/.tmux-dark.conf"