Also test $TMUX var for "local" host

This commit is contained in:
Jeremy Gardais 2022-12-21 11:39:57 +01:00
parent 729cbff471
commit 42e3e7cc63
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 51 additions and 38 deletions

View File

@ -19,6 +19,10 @@ if-shell -b 'tmux has-session -t toto' {
attach-session -t toto:1.1 attach-session -t toto: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 toto' { if-shell '! tmux has-session -t toto' {
display-message "Create a new session for Laptop" display-message "Create a new session for Laptop"
@ -48,3 +52,4 @@ if-shell -b 'tmux has-session -t 0' {
kill-session -t 0 kill-session -t 0
} }
# }}} # }}}
}

View File

@ -14,11 +14,18 @@
# If a session already exists {{{ # If a session already exists {{{
if-shell -b 'tmux has-session -t IPR' { if-shell -b 'tmux has-session -t IPR' {
# If file was source from a running tmux
#if-shell -b 'test -n $TMUX' {
display-message "Attach to **IPR** existing session" display-message "Attach to **IPR** existing session"
## Attach to the first pane of the first window ## Attach to the first pane of the first window
attach-session -t IPR:1.1 attach-session -t IPR: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 IPR' { if-shell '! tmux has-session -t IPR' {
display-message "Create a new session for Work" display-message "Create a new session for Work"
@ -34,3 +41,4 @@ if-shell '! tmux has-session -t IPR' {
# Default pane should be IPR:1.1 # Default pane should be IPR:1.1
#select-pane -tIPR:1.1 #select-pane -tIPR:1.1
} }
}