Override ^p/^n in agent session to switch between root windows

This commit is contained in:
2026-09-14 11:55:27 +01:00
parent 4ac16ee7b4
commit 9ce131462f
4 changed files with 242 additions and 3 deletions

View File

@@ -71,6 +71,9 @@ set -ga terminal-overrides 'xterm*:smxx=\E[9m'
if -b '~/.config/tmux/check-version.sh ">= 3.2" and "< 3.3"' {
bind A if -F '#{==:#{session_name},agent}' { detach-client } {
# Record the opening client so agent-sync.sh can move it along with the
# window selected inside the popup.
run-shell "tmux set -g @agent_popup_client '#{client_name}'"
display-popup -d '#{pane_current_path}' -w 50% -h 90% -E ~/.config/tmux/agent.sh
}
bind H display-popup -w 75% -h 75% -E htop
@@ -81,6 +84,9 @@ if -b '~/.config/tmux/check-version.sh ">= 3.2" and "< 3.3"' {
}
if -b '~/.config/tmux/check-version.sh ">= 3.3"' {
bind A if -F '#{==:#{session_name},agent}' { detach-client } {
# Record the opening client so agent-sync.sh can move it along with the
# window selected inside the popup.
run-shell "tmux set -g @agent_popup_client '#{client_name}'"
display-popup -S fg=#54546D -b rounded -d '#{pane_current_path}' -w 75% -h 90% -E ~/.config/tmux/agent.sh
}
bind H display-popup -S fg=#54546D -b rounded -w 50% -h 75% -E htop
@@ -92,9 +98,19 @@ if -b '~/.config/tmux/check-version.sh ">= 3.3"' {
bind P run-shell ~/.config/tmux/project.sh
# Restore old next/previous window bindings
bind C-n next-window
bind C-p previous-window
# Restore old next/previous window bindings. Inside the agent popup these walk
# the windows of the session underneath instead, skipping any that have no agent
# window, so the popup and the client below it move together.
bind C-n if -F '#{==:#{session_name},agent}' {
run -b '~/.config/tmux/agent-nav.sh next'
} {
next-window
}
bind C-p if -F '#{==:#{session_name},agent}' {
run -b '~/.config/tmux/agent-nav.sh prev'
} {
previous-window
}
# Kill current window
bind W kill-window