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.

29 lines
962 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"
tmux rename-window -t "$SESSION":0 'fm'
tmux send-keys -t "$SESSION":0 'ranger ~/Downloads' C-m
tmux new-window -t "$SESSION":1 -n 'spool' -c "$HOME"
tmux send-keys -t "$SESSION":1 'watch tsp' C-m
tmux split-window -t "$SESSION":1 -v -c "$HOME"
tmux send-keys -t "$SESSION":1 'watch TS_SOCKET=/tmp/fm tsp' C-m
tmux split-window -t "$SESSION":1 -v -p 10 -c "$HOME"
tmux new-window -t "$SESSION":2 -n 'cmd' -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