#!/usr/bin/env bash name="$1" shift args="$*" tmux-select-window-globally "$name" || tmux -2 new-window -n "$name" "$args" # exit status 1 if window does not exist afterwards sleep 0.1 tmux select-window -t "$name"