tmux/splitAUTHENTICATION

70 lines
2.7 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 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 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'
#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
## 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'
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' {
## 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"
### Gpg key
new-window -nAuthTmux 'gpg --quiet --for-your-eyes-only --decrypt ~/.password-store/test.gpg ; logout'
### SSH key ED25519
split-window -h -l 0 'ssh-add -l | grep --quiet --ignore-case -- "(ed25519)" || ssh-add ~/.ssh/id_ed25519 ; logout'
### SSH key RSA (if available)
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' }
### Enable synchronization between all panels
set-window-option synchronize-panes on
}
# }}}