You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
645 B
Bash

#!/usr/bin/env sh
# Session Name from filename (e.g _tmux_workspace_name,-- description --> name)
SESSION="$(echo "${0##*/}" | cut -d ',' -f1 | cut -d '_' -f4)"
SESSIONEXISTS=$(tmux list-sessions | grep "$SESSION")
# Only create tmux session if it doesn't already exist
if [ "$SESSIONEXISTS" = "" ]; then
# create new session
tmux new-session -d -s "$SESSION" -c "$HOME/Public/screencast"
tmux rename-window -t "$SESSION":0 'cast'
tmux new-window -t "$SESSION":1 -n 'demo' -c "$HOME"
# jump to session and window 0
tmux switch-client -t "$SESSION":0
else
# if exist then jump to session
tmux switch-client -t "$SESSION"
fi