Test if already inside a tmux

This commit is contained in:
Jeremy Gardais 2022-12-21 09:32:04 +01:00
parent 2b12a22861
commit 729cbff471
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 36 additions and 30 deletions

View File

@ -16,9 +16,14 @@
if-shell -b 'tmux has-session -t jd' { if-shell -b 'tmux has-session -t jd' {
display-message "Attach to **jd** existing session" display-message "Attach to **jd** existing session"
## Attach to the first pane of the first window ## Attach to the first pane of the first window
## Only works from a running tmux
attach-session -t jd:1.1 attach-session -t jd:1.1
} }
# }}} # }}}
# If file was source from a running tmux
# This allow to run tmux source-file command outside of Tmux…
if-shell -b 'test -n $TMUX' {
# If no session already exists # If no session already exists
if-shell '! tmux has-session -t jd' { if-shell '! tmux has-session -t jd' {
display-message "Create a new session for Workstation" display-message "Create a new session for Workstation"
@ -54,3 +59,4 @@ if-shell -b 'tmux has-session -t 0' {
kill-session -t 0 kill-session -t 0
} }
# }}} # }}}
}