userscripts/tmux-windowizer
2024-05-30 23:04:56 -07:00

13 lines
297 B
Bash
Executable file

#!/bin/bash
branch_name=$(basename "$1")
session_name=$(tmux display-message -p "#S")
clean_name=$(echo "$branch_name" | tr "./" "__")
target="$session_name:$clean_name"
if ! tmux has-session -t "$target" 2>/dev/null; then
tmux neww -dn "$clean_name"
fi
shift
tmux send-keys -t "$target" "$*"