From: Simon Ruderich Date: Tue, 10 Mar 2009 15:48:27 +0000 (+0100) Subject: zsh: Automatically start screen. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=5cb25194951c36fea046347c9573d4d254ec6558;p=config%2Fdotfiles.git zsh: Automatically start screen. This prevents problems when X11 crashes or the network connection is lost on remote servers. --- diff --git a/zsh/rc b/zsh/rc index 9b371bc..ccd950f 100644 --- a/zsh/rc +++ b/zsh/rc @@ -328,6 +328,20 @@ todo() { } +# RUN COMMANDS + +# If not already in screen reattach to a running session or create a new one. +if [[ $TERM != 'screen' && $TERM != 'dumb' ]]; then + # Create a new session if none is running. + if [[ $(screen -list | grep "Detached" | wc -l) == 0 ]]; then + screen + # Reattach to a running session. + else + screen -r + fi +fi + + # Load rc file for current OS. source_config ~/.zsh os rc $(uname) nolocal # Load rc file for current hostname (first part before a dot) or rc.local.