2023-01-24 13:21:04 +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,…
|
|
|
|
|
# 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 a new window and splits for authentication
|
|
|
|
|
|
|
|
|
|
# If a session already exists {{{
|
|
|
|
|
#if-shell -b 'tmux has-session' {
|
|
|
|
|
|
|
|
|
|
## Temp window to ensure a ssh-agent is running
|
|
|
|
|
#new-window -nAuth 'ssh-agent -a "${SSH_AGENT_SOCK}" ; logout'
|
|
|
|
|
|
|
|
|
|
## Window for authentication tools
|
|
|
|
|
#display-message "Create a new window for Authentication"
|
|
|
|
|
#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
|
|
|
|
|
#}
|
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
|
|
# If file was source OUTSIDE of a running tmux {{{
|
|
|
|
|
if-shell -b 'test -z $TMUX' {
|
|
|
|
|
|
|
|
|
|
## Attach the last session
|
|
|
|
|
attach-session
|
|
|
|
|
|
|
|
|
|
## Temp window to ensure a ssh-agent is running
|
|
|
|
|
new-window -nSSH-Agent 'ssh-agent -a "${SSH_AGENT_SOCK}" ; logout'
|
|
|
|
|
|
|
|
|
|
## Window for authentication tools
|
|
|
|
|
display-message "Create a new window for Authentication"
|
|
|
|
|
new-window -nAuthTerm 'gpg --quiet --for-your-eyes-only --decrypt ~/.password-store/test.gpg ; tmux detach'
|
|
|
|
|
split-window -h 'ssh-add -l | grep -qi -- "(ed25519)" || ssh-add ~/.ssh/id_ed25519 ; logout'
|
|
|
|
|
set-window-option synchronize-panes on
|
|
|
|
|
|
|
|
|
|
#detach-client
|
|
|
|
|
}
|
|
|
|
|
# }}}
|
|
|
|
|
# If file was source from a running tmux {{{
|
|
|
|
|
if-shell -b 'test -n $TMUX' {
|
|
|
|
|
## Temp window to ensure a ssh-agent is running
|
|
|
|
|
new-window -nSSH-Agent 'ssh-agent -a "${SSH_AGENT_SOCK}" ; logout'
|
|
|
|
|
|
|
|
|
|
## Window for authentication tools
|
|
|
|
|
display-message "Create a new window for Authentication"
|
2023-03-03 08:11:02 +01:00
|
|
|
|
### Gpg key
|
2023-01-24 13:21:04 +01:00
|
|
|
|
new-window -nAuthTmux 'gpg --quiet --for-your-eyes-only --decrypt ~/.password-store/test.gpg ; logout'
|
2023-03-03 08:11:02 +01:00
|
|
|
|
### SSH key ED25519
|
2023-01-24 13:21:04 +01:00
|
|
|
|
split-window -h 'ssh-add -l | grep -qi -- "(ed25519)" || ssh-add ~/.ssh/id_ed25519 ; logout'
|
2023-03-03 08:11:02 +01:00
|
|
|
|
### SSH key RSA (if available)
|
|
|
|
|
if-shell -b 'test -n ~/.ssh/id_rsa' { split-window -v 'ssh-add -l | grep -qi -- "(RSA)" || ssh-add ~/.ssh/id_rsa ; logout' }
|
|
|
|
|
### Enable synchronization between all panels
|
2023-01-24 13:21:04 +01:00
|
|
|
|
set-window-option synchronize-panes on
|
|
|
|
|
}
|
|
|
|
|
# }}}
|