tmux/splitAUTHENTICATION

70 lines
2.7 KiB
Plaintext
Raw Normal View History

### 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' {
2024-08-22 18:44:11 +02:00
## Temp window to ensure a ssh-agent is running with
## * specific SOCKET path
## * life duration
#new-window -nSSH-Agent 'ssh-agent -a "${SSH_AGENT_SOCK}" -t 4h ; 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'
2024-07-01 10:44:35 +02:00
#split-window -h 'ssh-add -l | grep --quiet --ignore-case -- "(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
2024-08-22 18:44:11 +02:00
## Temp window to ensure a ssh-agent is running with
## * specific SOCKET path
## * life duration
new-window -nSSH-Agent 'ssh-agent -a "${SSH_AGENT_SOCK}" -t 4h ; 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'
2024-04-05 10:26:40 +02:00
split-window -h -l 0 'ssh-add -l | grep --quiet --ignore-case -- "(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' {
2024-08-22 18:44:11 +02:00
## Temp window to ensure a ssh-agent is running with
## * specific SOCKET path
## * life duration
new-window -nSSH-Agent 'ssh-agent -a "${SSH_AGENT_SOCK}" -t 4h ; logout'
## Window for authentication tools
display-message "Create a new window for Authentication"
2023-03-03 08:11:02 +01:00
### Gpg key
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
2024-07-01 10:44:35 +02:00
split-window -h -l 0 'ssh-add -l | grep --quiet --ignore-case -- "(ed25519)" || ssh-add ~/.ssh/id_ed25519 ; logout'
2023-03-03 08:11:02 +01:00
### SSH key RSA (if available)
2024-07-01 10:44:35 +02:00
if-shell -b 'test -n ~/.ssh/id_rsa' { split-window -v 'ssh-add -l | grep --quiet --ignore-case -- "(RSA)" || ssh-add ~/.ssh/id_rsa ; logout' }
2023-03-03 08:11:02 +01:00
### Enable synchronization between all panels
set-window-option synchronize-panes on
}
# }}}