dotfiles/home/user/.config/tmux/scripts/tmux_kill_sessions.sh
2026-02-19 20:23:22 +03:00

25 lines
656 B
Bash
Executable File

#!/bin/sh
readonly tmux_list_sessions_script="${HOME}/.config/tmux/scripts/tmux_list_sessions.sh"
export FZF_DEFAULT_OPTS="\
${FZF_DEFAULT_OPTS}
--multi
--border=rounded
--border-label-pos=bottom
--border-label=' Kill sessions '
--color='border:red,label:red'
--preview-window=follow
--preview='tmux capture-pane -p -e -t {1}'
--bind
ctrl-x:execute\(tmux\ kill-session\ -t\ {1}\)+reload\(${tmux_list_sessions_script}\)\
"
sessions_to_kill="$(~/.config/tmux/scripts/tmux_list_sessions.sh | fzf | awk '{printf $1"\n"}')"
readonly sessions_to_kill
if [ -n "${sessions_to_kill}" ]; then
echo "${sessions_to_kill}" | xargs -n 1 tmux kill-session -t
fi