Disable auto-start for multiplexers with SSH
Do not automatically start multiplexers if the machine is access with a remote connection (SSH). This avoids having the 'remote' screen or tmux session embedded in the local session
This commit is contained in:
parent
fb4ffd9883
commit
75682fb87f
5 changed files with 27 additions and 2 deletions
|
@ -14,6 +14,15 @@ To enable this feature, add the following line to *zpreztorc*:
|
||||||
|
|
||||||
zstyle ':prezto:module:screen' auto-start 'yes'
|
zstyle ':prezto:module:screen' auto-start 'yes'
|
||||||
|
|
||||||
|
#### SSH and auto-start
|
||||||
|
|
||||||
|
To avoid having screen sessions inside screen sessions, auto-start is disabled for
|
||||||
|
SSH access.
|
||||||
|
|
||||||
|
It is possible to re-enable auto-start for SSH sessions with
|
||||||
|
|
||||||
|
zstyle ':prezto:module:screen' remote 'yes'
|
||||||
|
|
||||||
Aliases
|
Aliases
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ fi
|
||||||
# Auto Start
|
# Auto Start
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ -z "$STY" ]] && zstyle -t ':prezto:module:screen' auto-start; then
|
if ( [[ -z "$SSH_CLIENT" ]] || zstyle -t ':prezto:module:screen' remote ) &&
|
||||||
|
( [[ -z "$STY" ]] && zstyle -t ':prezto:module:screen' auto-start ); then
|
||||||
session="$(
|
session="$(
|
||||||
screen -list 2> /dev/null \
|
screen -list 2> /dev/null \
|
||||||
| sed '1d;$d' \
|
| sed '1d;$d' \
|
||||||
|
|
|
@ -21,6 +21,15 @@ To avoid keeping open sessions, this module sets `destroy-unattached off` on
|
||||||
the background session and `destroy-unattached on` on every other session
|
the background session and `destroy-unattached on` on every other session
|
||||||
(global setting).
|
(global setting).
|
||||||
|
|
||||||
|
#### SSH and auto-start
|
||||||
|
|
||||||
|
To avoid having tmux sessions inside tmux sessions, auto-start is disabled for
|
||||||
|
SSH access.
|
||||||
|
|
||||||
|
It is possible to re-enable auto-start for SSH sessions with
|
||||||
|
|
||||||
|
zstyle ':prezto:module:tmux' remote 'yes'
|
||||||
|
|
||||||
Aliases
|
Aliases
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ fi
|
||||||
# Auto Start
|
# Auto Start
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ -z "$TMUX" ]] && zstyle -t ':prezto:module:tmux' auto-start; then
|
if ( [[ -z "$SSH_CLIENT" ]] || zstyle -t ':prezto:module:tmux' remote ) &&
|
||||||
|
( [[ -z "$TMUX" ]] && zstyle -t ':prezto:module:tmux' auto-start ); then
|
||||||
tmux_session='#Prezto'
|
tmux_session='#Prezto'
|
||||||
|
|
||||||
if ! tmux has-session -t "$tmux_session" 2> /dev/null; then
|
if ! tmux has-session -t "$tmux_session" 2> /dev/null; then
|
||||||
|
|
|
@ -81,6 +81,9 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
||||||
# Auto start a session when Zsh is launched.
|
# Auto start a session when Zsh is launched.
|
||||||
# zstyle ':prezto:module:screen' auto-start 'yes'
|
# zstyle ':prezto:module:screen' auto-start 'yes'
|
||||||
|
|
||||||
|
# Allow auto-start with an SSH connection
|
||||||
|
# zstyle ':prezto:module:screen' remote 'yes'
|
||||||
|
|
||||||
#
|
#
|
||||||
# SSH-Agent
|
# SSH-Agent
|
||||||
#
|
#
|
||||||
|
@ -118,3 +121,5 @@ zstyle ':prezto:module:terminal' auto-title 'yes'
|
||||||
# Auto start a session when Zsh is launched.
|
# Auto start a session when Zsh is launched.
|
||||||
# zstyle ':prezto:module:tmux' auto-start 'yes'
|
# zstyle ':prezto:module:tmux' auto-start 'yes'
|
||||||
|
|
||||||
|
# Allow auto-start with an SSH connection
|
||||||
|
# zstyle ':prezto:module:tmux' remote 'yes'
|
||||||
|
|
Loading…
Add table
Reference in a new issue