From 6a257631a949785616c3fbc31675b09c785c6c68 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 13 Jul 2012 15:33:03 +0200 Subject: bashrc/common/prompt: fix detection of tmux and screen before even a normal terminal with TERM="screen" was detected as screen and f.e. caused problems with connectbot from android (set TERM="screen" but did not understand the screen escape sequences for setting the title) --- bashrc/common/prompt.sh | 4 ++-- screenrc | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bashrc/common/prompt.sh b/bashrc/common/prompt.sh index 0c14d84..00e95b6 100644 --- a/bashrc/common/prompt.sh +++ b/bashrc/common/prompt.sh @@ -27,7 +27,7 @@ __make_prompt() { fi # environment flags - [[ "${TERM#screen}" != "${TERM}" ]] && PS1F="${PS1F}$(pcolor lcyan)s$(pcolor)" + [[ -n "${TMUX}" || -n "${SCREEN}" ]] && PS1F="${PS1F}$(pcolor lcyan)s$(pcolor)" # python virtual env [[ -n "${VIRTUAL_ENV}" ]] && PS1VE="$(pcolor lred)<${VIRTUAL_ENV#${WORKON_HOME}/}>$(pcolor) " @@ -109,7 +109,7 @@ __make_prompt() { export PS1="${PS1VE}${PS1UH}${PS1D} ${PS1BO}${PS1R}${PS1F}${PS1BC} ${s}${PS1P}" - if [[ "${TERM#screen}" != "${TERM}" ]]; then + if [[ -n "${TMUX}" || -n "${TMUX}" ]]; then echo -ne "\ek$(id -un)@${_hostname%%\.*}\e\\" fi } diff --git a/screenrc b/screenrc index 4e0a8a9..9761ca6 100644 --- a/screenrc +++ b/screenrc @@ -50,3 +50,6 @@ bind = resize = bind + resize +3 bind - resize -3 bind _ resize max + +# register screen +setenv SCREEN 1 -- cgit v1.2.3