attach to screens automatically
This commit is contained in:
parent
79f7c9aa2c
commit
b36f358d7d
1 changed files with 19 additions and 0 deletions
19
zsh/zshrc
19
zsh/zshrc
|
|
@ -347,3 +347,22 @@ compinit
|
||||||
if command_exists rbenv; then
|
if command_exists rbenv; then
|
||||||
eval "$(rbenv init -)"
|
eval "$(rbenv init -)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 12. Attach to screen
|
||||||
|
# ====================
|
||||||
|
#
|
||||||
|
# Automatically attach to a screen session.
|
||||||
|
|
||||||
|
function not_in_screen() {
|
||||||
|
[[ "$STY" = "" ]] && [[ "$SHLVL" = "1" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_screen_running() {
|
||||||
|
NSCREENS="$(screen -ls | egrep 'Attached|Detached' | wc -l)"
|
||||||
|
[[ "${NSCREENS// /}" != "0" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_interactive && command_exists screen && not_in_screen && is_screen_running; then
|
||||||
|
screen -rx
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue