#!/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