shell script based session management

This commit is contained in:
2025-10-11 16:32:39 +02:00
parent 9dcdc2a6e6
commit 9146724e6c
4 changed files with 56 additions and 0 deletions
+29
View File
@@ -1,3 +1,32 @@
snippet raylibBuildLinux
cc $1.c -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 -o $1
./$1
snippet session
SESSION="${1:[session name]}"
if tmux has-session -t "$SESSION" 2>/dev/null; then
if [ -n "$TMUX" ]; then
tmux switch-client -t "$SESSION"
else
tmux attach -t "$SESSION"
fi
exit 0
fi
tmux new-session -d -s "$SESSION" -c ${2:[path]} -n "${3:[main window name]}"
tmux send-keys -t "$SESSION":"$3" '${4:[main window cmd]}' C-m
tmux new-window -t "$SESSION" -c $2
tmux select-window -t "$SESSION":"$3"
if [ -n "$TMUX" ]; then
tmux switch-client -t "$SESSION"
else
tmux attach -t "$SESSION"
fi
snippet window
tmux new-window -t "$SESSION" -c ${1:[path]} -n "${2:[window name]}"
tmux send-keys -t "$SESSION":"$2" '${3:[cmd]}' C-m