Also test $TMUX var for "local" host

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

View File

@ -19,15 +19,19 @@ if-shell -b 'tmux has-session -t toto' {
attach-session -t toto:1.1
}
# }}}
# If no session already exists
if-shell '! tmux has-session -t toto' {
# 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-shell '! tmux has-session -t toto' {
display-message "Create a new session for Laptop"
# A first window named **mail**
# with mutt running in the first pane
new-session -A -stoto -nmail 'mutt ; exec ${SHELL}'
## Split the first window for APT upgrade
split-window -h -p 25 -ttoto:1.1 'sudo aptitude update ; sudo aptitude full-upgrade ; exec ${SHELL}'
#
#
# Second window named **Xt0p** with btop running
new-window -d -nXt0p 'btop ; exec ${SHELL}'
# Third window named **ch4t** with weechat running
@ -41,10 +45,11 @@ if-shell '! tmux has-session -t toto' {
# Default pane should be toto:5.2
#select-pane -ttoto:5.2
}
# If a default session still exists {{{
if-shell -b 'tmux has-session -t 0' {
}
# If a default session still exists {{{
if-shell -b 'tmux has-session -t 0' {
# Kill it
kill-session -t 0
}
# }}}
}
# }}}

View File

@ -14,13 +14,20 @@
# If a session already exists {{{
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"
## Attach to the first pane of the first window
attach-session -t IPR:1.1
#}
}
# }}}
# If no session already exists
if-shell '! tmux has-session -t IPR' {
# 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-shell '! tmux has-session -t IPR' {
display-message "Create a new session for Work"
# A first window named **DeLL**
new-session -A -sIPR -nDeLL
@ -33,4 +40,5 @@ if-shell '! tmux has-session -t IPR' {
# Default pane should be IPR:1.1
#select-pane -tIPR:1.1
}
}