2022-12-12 11:52:32 +01:00
|
|
|
|
### 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,…
|
2022-12-12 09:51:43 +01:00
|
|
|
|
# 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
|
|
|
|
|
|
2022-12-12 11:52:32 +01:00
|
|
|
|
# Manage session named **jd** for working station
|
2022-12-12 09:51:43 +01:00
|
|
|
|
|
2022-12-12 11:52:32 +01:00
|
|
|
|
# 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
|
2022-12-21 09:32:04 +01:00
|
|
|
|
## Only works from a running tmux
|
2022-12-12 11:52:32 +01:00
|
|
|
|
attach-session -t jd:1.1
|
|
|
|
|
}
|
|
|
|
|
# }}}
|
2022-12-12 09:51:43 +01:00
|
|
|
|
|
2022-12-21 09:32:04 +01:00
|
|
|
|
# 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
|
2022-12-12 09:51:43 +01:00
|
|
|
|
|
2022-12-21 09:32:04 +01:00
|
|
|
|
# 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'
|
2022-12-13 08:44:49 +01:00
|
|
|
|
|
2022-12-21 09:32:04 +01:00
|
|
|
|
# Third window for APT upgrade
|
2023-02-27 10:39:38 +01:00
|
|
|
|
# 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'
|
2022-12-12 15:37:40 +01:00
|
|
|
|
|
2022-12-21 09:32:04 +01:00
|
|
|
|
# Fourth 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 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
|
|
|
|
|
}
|
|
|
|
|
# }}}
|
2022-12-12 11:52:32 +01:00
|
|
|
|
}
|