X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=zsh%2Frc;h=cfd3f432c4a76247e64d4e301a619d7d00906c7c;hb=eeab5490994eefc79d00c92d04ddcc31f64c6426;hp=1a30e83094e3b79c399731437295dcabe49d36da;hpb=0388e4464474e155fd41d18266813d9ac5795cac;p=config%2Fdotfiles.git diff --git a/zsh/rc b/zsh/rc index 1a30e83..cfd3f43 100644 --- a/zsh/rc +++ b/zsh/rc @@ -245,6 +245,9 @@ unset red blue green yellow default # screen is running on the remote machine instead of @screen @:hostname # (hostname replaced by the machine's hostname) is displayed. This only works # if the .zshrc on the server also uses this command. +# +# screen* is necessary as `screen` uses screen.linux for example for a linux +# console. if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then # Is set to a non empty value to reset the window name in the next # precmd() call. @@ -532,18 +535,20 @@ source_config ~/.zsh host rc ${$(hostname)//.*/} # RUN COMMANDS # If not already in screen reattach to a running session or create a new one. -# -# screen* is necessary as `screen` uses screen.linux for example for a linux -# console which would otherwise cause an infinite loop. -if [[ $TERM != screen* && $TERM != 'dumb' ]]; then +# This also starts screen one a remote server when connecting through ssh. +if [[ $TERM != dumb && -z $STY ]]; then # Get running detached sessions. session=$(screen -list | grep 'Detached' | awk '{ print $1; exit }') + + # As we exec later we have to set the title here. + window_preexec "screen" + # Create a new session if none is running. if [[ -z $session ]]; then - screen + exec screen # Reattach to a running session. else - screen -r $session + exec screen -r $session fi fi