userscripts/tmux-windowizer

14 lines
297 B
Text
Raw Permalink Normal View History

2024-05-31 06:04:56 +00:00
#!/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" "$*"