diff options
| author | Igor Soarez <igor@soarez.org> | 2026-10-05 11:27:00 +0300 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-10-05 11:27:00 +0300 |
| commit | 986e760687a2d34051934d410bec71fa2efc349b (patch) | |
| tree | f57dcc4ba0d7690fdf90eeb2f0970a8ebbefc45a /tmuxrdr/plugin/bin/select-window | |
| parent | 7b116c05bfda646af39d2524c54e70c751f57ee8 (diff) | |
tmuxrdr: tmux-mode plugin
The tmux default prefix bindings herdr has no built-in action for, as a
herdr plugin built on its CLI and socket: break-pane, swap-pane and
rotate-window by pane order (focus behaviour measured on tmux 3.7c),
mark/clear-mark, last-window and switch-client -l (from focus events, per
session), select-window and move-window by index, paste-buffer -p,
display-message in tmux's default format, select-layout -E, kill-pane and
kill-window behind tmux's y/n prompts, a command prompt taking tmux's
commands, clock-mode, show-messages, and automatic-rename.
Also a .gitignore for secrets scoped to tmuxrdr/, leaving herdr's own
untouched.
Diffstat (limited to 'tmuxrdr/plugin/bin/select-window')
| -rwxr-xr-x | tmuxrdr/plugin/bin/select-window | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tmuxrdr/plugin/bin/select-window b/tmuxrdr/plugin/bin/select-window new file mode 100755 index 00000000..691d7c9f --- /dev/null +++ b/tmuxrdr/plugin/bin/select-window @@ -0,0 +1,22 @@ +#!/bin/sh +# tmux prefix+0 and prefix+' (select-window -t :=N). Herdr numbers tabs by +# their place in the tab bar, from 1 -- like tmux with base-index 1 and +# renumber-windows on -- so N is a position: 0 finds nothing, exactly as +# prefix+0 does under this machine's base-index 1. With no argument it prompts +# for the index, as prefix+' does (run as a popup). +. "$(dirname "$0")/../lib.sh" + +n="${1:-}" +if [ -z "$n" ]; then + printf '(index) ' + IFS= read -r n || exit 0 +fi +[ -n "$n" ] || exit 0 +case "$n" in + *[!0-9]*) fail "can't find window: $n" ;; +esac + +ws="$(pane_info "$(active_pane)" workspace_id)" +tab="$(workspace_tabs "$ws" | sed -n "${n}p" | cut -f1)" +[ "$n" -gt 0 ] && [ -n "$tab" ] || fail "can't find window: $n" +"$H" tab focus "$tab" >/dev/null |
