diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-06 11:52:19 -0500 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-06 11:52:19 -0500 |
| commit | a097de4a649a96fa34403ad0e4bbb009cdce1b47 (patch) | |
| tree | fb41ceedfd130afccfbbe714ae2a652f4e9134e7 | |
| parent | Adjust vim config (diff) | |
| download | dotfiles-a097de4a649a96fa34403ad0e4bbb009cdce1b47.zip | |
Adjust start-tmux script
| -rwxr-xr-x | bin/.local/bin/start-tmux | 13 |
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 |