aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/.local/bin/start-tmux13
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/.local/bin/start-tmux b/bin/.local/bin/start-tmux
index 7ff8106..fa0e110 100755
--- a/bin/.local/bin/start-tmux
+++ b/bin/.local/bin/start-tmux
@@ -1,5 +1,12 @@
#!/bin/sh
-set -e
-tmux new-session -A -s "$USER" -d
-exec tmux attach-session -t "$USER" || true
+readonly SESSION_NAME="$USER"
+
+main() {
+ if ! tmux has-session -t "$SESSION_NAME" 2>/dev/null; then
+ tmux new-session -A -s "$SESSION_NAME" -d
+ fi
+ exec tmux attach-session -t "$SESSION_NAME"
+}
+
+main