tmux: Bind MouseDragEnd1StatusDefault w/o run-shell

The special token `$` indicates the highest-numbered window. Also switch
to using before `^` when moving to the front for consistency.
This commit is contained in:
2025-03-24 18:27:54 +01:00
parent 52264362f3
commit 0810a83c0b

View File

@@ -169,14 +169,15 @@ bind -r P swap-window -d -t :-1
# Reorder windows by dragging them in the status line.
bind -n MouseDrag1Status swap-window -d -t=
# Move a window to the first or very last position
# TODO: do nothing on drags that don't start on a window name
# NOTE: mouse_{x,y} were not set in status line before 3.3
if -F "#{>=:#{version},3.3}" {
bind -n MouseDragEnd1StatusDefault {
if -F "#{e|>|f|0:#{mouse_x},#{e|/|f:#{window_width},2}}" {
run-shell "tmux move-window -at #{last_window_index}"
move-window -at :$
} {
move-window -t0
move-window -bt :^
}
}
}