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,32 +19,37 @@ if-shell -b 'tmux has-session -t toto' {
attach-session -t toto:1.1 attach-session -t toto:1.1
} }
# }}} # }}}
# 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
new-window -d -nch4t 'weechat ; exec ${SHELL}'
# Fourth window named **git** in main repos directory
new-window -d -ngit -c '/home/jegardai/repos'
# Fifth window for authentication tools
new-window -nAuth 'gpg --quiet --for-your-eyes-only --decrypt ~/.password-store/test.gpg ; logout'
split-window -h 'ssh-add -l | grep -qi -- "(ed25519)" || ssh-add ~/.ssh/id_ed25519 ; logout'
set-window-option synchronize-panes on
# Default pane should be toto:5.2 # If file was source from a running tmux
#select-pane -ttoto:5.2 # 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
new-window -d -nch4t 'weechat ; exec ${SHELL}'
# Fourth window named **git** in main repos directory
new-window -d -ngit -c '/home/jegardai/repos'
# Fifth window for authentication tools
new-window -nAuth 'gpg --quiet --for-your-eyes-only --decrypt ~/.password-store/test.gpg ; logout'
split-window -h 'ssh-add -l | grep -qi -- "(ed25519)" || ssh-add ~/.ssh/id_ed25519 ; logout'
set-window-option synchronize-panes on
# 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' {
# Kill it
kill-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,23 +14,31 @@
# 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 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
# Second window named **Ceph** # If file was source from a running tmux
new-window -d -nCeph # 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
# Third window named **Prox7** # Second window named **Ceph**
new-window -d -nProx7 new-window -d -nCeph
# Default pane should be IPR:1.1 # Third window named **Prox7**
#select-pane -tIPR:1.1 new-window -d -nProx7
# Default pane should be IPR:1.1
#select-pane -tIPR:1.1
}
} }