From 0810a83c0b3b8f39ecf6645e352dc2d04bbf004a Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 24 Mar 2025 18:27:54 +0100 Subject: [PATCH] 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. --- .config/tmux/tmux.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index d9fdc25..ff7dc6f 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -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 :^ } } }