From 291c0430805cce6d727ab0364cf2169960f2027f Mon Sep 17 00:00:00 2001 From: Michael Grant Date: Thu, 1 Oct 2026 21:01:50 +0100 Subject: [PATCH] Raise a floating or zoomed pane when its border is clicked. Co-Authored-By: Claude Sonnet 5.5 --- key-bindings.c | 2 +- regress/mouse-raise.sh | 12 +++++++++++- tmux.1 | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/key-bindings.c b/key-bindings.c index 55f016879..c885e0cd2 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -524,7 +524,7 @@ key_bindings_init(void) "bind -n TripleClick1Pane { select-pane -t=; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { copy-mode -H; send -X select-line; run -d0.3; send -X copy-pipe-and-cancel } }", /* Mouse button 1 on border. */ - "bind -n MouseDown1Border { select-pane -t= }", + "bind -n MouseDown1Border { select-pane -t=; if -Ft= '#{||:#{pane_floating_flag},#{pane_zoomed_flag}}' { move-pane -t= -P front } }", /* Mouse button 1 drag on border. */ "bind -n MouseDrag1Border { resize-pane -M }", diff --git a/regress/mouse-raise.sh b/regress/mouse-raise.sh index 64fbdeb8f..9a129c0ab 100644 --- a/regress/mouse-raise.sh +++ b/regress/mouse-raise.sh @@ -1,7 +1,7 @@ #!/bin/sh # Moving the mouse onto a pane with focus-follows-mouse makes it active without -# raising it. +# raising it, but clicking a pane's border always brings it to the front. PATH=/bin:/usr/bin TERM=screen @@ -66,5 +66,15 @@ check "$Y" '#{pane_active}:#{pane_z}' '1:0' mouse '\033[<0;14;12M\033[<0;14;12m' check "$X" '#{pane_active}:#{pane_z}' '1:0' +# A zoomed pane that is active under a floating pane is not raised by clicking +# inside it, but is raised by clicking on its border. +$TMUX resize-pane -Z -t "$A" || fail "zoom failed" +$TMUX select-pane -t "$Y" || fail "select failed" +$TMUX select-pane -t "$A" || fail "select failed" +check "$A" '#{pane_zoomed_flag}:#{pane_active}' '1:1' +check "$Y" '#{pane_z}' 0 +mouse '\033[<0;3;1M\033[<0;3;1m' +check "$A" '#{pane_z}' 0 + cleanup exit 0 diff --git a/tmux.1 b/tmux.1 index dbbb17e0b..54dbf28af 100644 --- a/tmux.1 +++ b/tmux.1 @@ -6064,7 +6064,8 @@ Moving the mouse onto a pane with .Ic focus\-follows\-mouse makes it active without raising it, so .Ic all -is usually wanted with that option. +is usually wanted with that option, and clicking on the border of a floating or +zoomed pane always raises it. .Pp .It Xo Ic pane\-scrollbars .Op Ic off | modal | on | auto\-hide