62 lines
2.2 KiB
Plaintext
62 lines
2.2 KiB
Plaintext
### Session --------------------------------------------------------------
|
||
# -sXX : XX session ID or name
|
||
# -nWINDOW_NAME : Name of the window…
|
||
# -d : Don't attache to the new session/window/pane/…
|
||
# -tXX:YY.ZZ :
|
||
# XX : session ID or name
|
||
# YY : (optional) Window ID
|
||
# ZZ : (optional) Pane ID
|
||
# YY and ZZ should exists to be able to change the parameters,…
|
||
# monitor-activity : permet de mettre en avant une fenêtre quand son contenu reçoit un événement
|
||
# 'exec ${SHELL}' : Allow to keep the pane running after the program exists
|
||
|
||
# Manage session named **jd** for working station
|
||
|
||
# If a session already exists {{{
|
||
if-shell -b 'tmux has-session -t jd' {
|
||
display-message "Attach to **jd** existing session"
|
||
## Attach to the first pane of the first window
|
||
## Only works from a running tmux
|
||
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-shell '! tmux has-session -t jd' {
|
||
display-message "Create a new session for Workstation"
|
||
# A first window named **42**
|
||
new-session -A -sjd -n42
|
||
## Split the first window and move to 42 debops project
|
||
split-window -d -h -tjd:1.1 -c '/home/jegardai/repos/101010.debops'
|
||
## Split again the first window and move to 42 debops project
|
||
split-window -v -tjd:1.1 -c '/home/jegardai/repos/101010.debops'
|
||
# Kill first pane of the first window
|
||
# Little trick to avoid to set this directory as default for any new pane…
|
||
kill-pane -tjd:1.1
|
||
|
||
# Second window named **IPR**
|
||
new-window -d -nIPR -c '/home/jegardai/repos/ipr.debops'
|
||
# with 2 panes in IPR debops project
|
||
split-window -d -h -tjd:2.1 -c '/home/jegardai/repos/ipr.debops'
|
||
|
||
# Third window for authentication tools
|
||
source-file $HOME/.tmux/splitAUTHENTICATION
|
||
|
||
# Fourth window for APT upgrade
|
||
# Run upgrade only if packages to upgrade
|
||
new-window -nAPT 'sudo apt update ; test $(apt list --upgradable 2>/dev/null | wc --lines) -gt 1 && { sudo aptitude full-upgrade ; sudo aptitude clean } ; logout'
|
||
|
||
# Default pane should be jd:4.2
|
||
#select-pane -tjd:4.2
|
||
}
|
||
# If a default session still exists {{{
|
||
if-shell -b 'tmux has-session -t 0' {
|
||
# Kill it
|
||
kill-session -t 0
|
||
}
|
||
# }}}
|
||
}
|