Same improvements for laptop and work splits

This commit is contained in:
gardouille 2022-12-12 12:06:13 +01:00
parent 699690deac
commit b4b611faea
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
3 changed files with 72 additions and 25 deletions

View File

@ -1,23 +1,48 @@
#### Session --------------------------------------------------------------
# -sX : numéro de la session
# -nNOM_TERMINAL : nom du terminal
# -d : indique à tmux de ne pas attacher la session et de ne pas prendre les
# nouvelles fenêtres comme une fenêtre courante
# -tX:Y : modifier les paramètres de la fenêtre Y de la session X. !Attention
# la fenêtre doit exister avant de pouvoir modifier ses paramètres!
### 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
# New session with first window in ~
new -A -stoto -nmail 'mutt ; exec ${SHELL}'
splitw -h -p 25 -t 1 'sudo aptitude update ; sudo aptitude full-upgrade ; exec ${SHELL}'
# New window toto:1 with btop (refresh every minute)
neww -d -nXt0p 'btop ; exec ${SHELL}'
# New window toto:2 for remote weechat
neww -d -nw33 'weechat ; exec ${SHELL}'
# New window toto:3 for git repositories
neww -d -ngit -c '/home/jegardai/repos'
# Manage session named **toto** for laptop
# Default window: toto:3
select-window -t 3
# If a session already exists {{{
if-shell -b 'tmux has-session -t toto' {
display-message "Attach to **toto** existing session"
## Attach to the first pane of the first window
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
neww -d -nch4t 'weechat ; exec ${SHELL}'
# Fourth window named **git** in main repos directory
new-window -d -ngit -c '/home/jegardai/repos'
# Default window should be jd:1
#select-window -t 1
# Default pane should be jd:1.2
#select-pane -t 2
}
# If a default session still exists {{{
if-shell -b 'tmux has-session -t 0' {
# Kill it
kill-session -t 0
}
# }}}

View File

@ -3,13 +3,35 @@
# -nNOM_TERMINAL : nom du terminal
# -d : indique à tmux de ne pas attacher la session et de ne pas prendre les
# nouvelles fenêtres comme une fenêtre courante
# -t0:X : modifier les paramètres de la fenêtre X de la session 0. !Attention
# -tX:Y : modifier les paramètres de la fenêtre Y de la session X. !Attention
# la fenêtre doit exister avant de pouvoir modifier ses paramètres!
# monitor-activity : permet de mettre en avant une fenêtre quand son contenu reçoit un événement
#
new -A -sIPR -nDeLL
# 'exec ${SHELL}': Allow to keep the pane running after the program exists
neww -d -nCeph
# New session for work
neww -d -nProx7
# Manage session named **IPR** for work
# If a session already exists {{{
if-shell -b 'tmux has-session -t IPR' {
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' {
display-message "Create a new session for Work"
# A first window named **DeLL**
new-session -A -sIPR -nDeLL
# Second window named **Ceph**
new-window -d -nCeph
# Third window named **Prox7**
new-window -d -nProx7
# Default window should be jd:1
#select-window -t 1
# Default pane should be jd:1.1
}

View File

@ -72,6 +72,6 @@ bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Initialize sessions
bind I source-file ~/.tmux/splitWORK\; display-message "tmux split for Work"
bind H source-file ~/.tmux/splitLAPTOP\; display-message "tmux split for Laptop"
bind I source-file ~/.tmux/splitWORK
bind H source-file ~/.tmux/splitLAPTOP
### }}}