aboutsummaryrefslogtreecommitdiff
path: root/tmuxrdr/plugin/bin/confirm-kill
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-10-05 11:27:00 +0300
committerIgor Soarez <igor@soarez.org>2026-10-05 11:27:00 +0300
commit986e760687a2d34051934d410bec71fa2efc349b (patch)
treef57dcc4ba0d7690fdf90eeb2f0970a8ebbefc45a /tmuxrdr/plugin/bin/confirm-kill
parent7b116c05bfda646af39d2524c54e70c751f57ee8 (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/confirm-kill')
-rwxr-xr-xtmuxrdr/plugin/bin/confirm-kill20
1 files changed, 20 insertions, 0 deletions
diff --git a/tmuxrdr/plugin/bin/confirm-kill b/tmuxrdr/plugin/bin/confirm-kill
new file mode 100755
index 00000000..b8826bb8
--- /dev/null
+++ b/tmuxrdr/plugin/bin/confirm-kill
@@ -0,0 +1,20 @@
+#!/bin/sh
+# tmux prefix+x and prefix+& ask before killing -- confirm-before -p
+# "kill-pane #P? (y/n)" and "kill-window #W? (y/n)" -- and so does this, run
+# as a popup from config.toml. y kills; any other key cancels.
+. "$(dirname "$0")/../lib.sh"
+
+p="$(active_pane)"
+case "${1:-}" in
+pane)
+ printf 'kill-pane %s? (y/n)' "$(pane_index "$p")"
+ [ "$(read_key)" = y ] && "$H" pane close "$p" >/dev/null
+ ;;
+window)
+ tab="$(pane_info "$p" tab_id)"
+ name="$("$H" tab get "$tab" | jq -r '.result.tab.label // empty')"
+ printf 'kill-window %s? (y/n)' "$name"
+ [ "$(read_key)" = y ] && "$H" tab close "$tab" >/dev/null
+ ;;
+esac
+exit 0