From 5cb25194951c36fea046347c9573d4d254ec6558 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 10 Mar 2009 16:48:27 +0100 Subject: [PATCH] zsh: Automatically start screen. This prevents problems when X11 crashes or the network connection is lost on remote servers. --- zsh/rc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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. -- 2.45.2