From 9179da7b2b377a8bd9992e00ad90a071febadb51 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 21 Aug 2020 03:37:32 +0300 Subject: [PATCH] Feat(screen): Use `shelltitle` trick in `.screenrc` This was an experiment that only partially succeed: In the simplest case `screen` changes the caption to the name of the current program; but it doesn't see programs that run deeper like programs started under `mc` or `vim`. --- .screenrc | 5 +++++ .shellrc | 4 ++-- admin/prog/bash_prompt | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.screenrc b/.screenrc index 2e3ff3e..279a120 100644 --- a/.screenrc +++ b/.screenrc @@ -13,6 +13,11 @@ startup_message off deflogin on shell -$SHELL +# For this to work PS1 prompt must include empty "k\" sequence +# and ends with "$ ". +#shelltitle "\$ |$SHELL" +#bind R screen -t '# |root:' sudo su - + # define a bigger scrollback, default is 100 lines defscrollback 1024 diff --git a/.shellrc b/.shellrc index 1db7013..a5f78d4 100644 --- a/.shellrc +++ b/.shellrc @@ -354,9 +354,9 @@ mc() { OPS1+="\$(prompt_git)" fi fi - OPS1+=" \\$\$SHLVL " + OPS1+=" \$SHLVL\\$ " else - OPS1="\u@\h:\W \\$" + OPS1="\u@\h:\W \$SHLVL\\$ " fi fi diff --git a/admin/prog/bash_prompt b/admin/prog/bash_prompt index f3575b3..f379668 100644 --- a/admin/prog/bash_prompt +++ b/admin/prog/bash_prompt @@ -116,6 +116,8 @@ set_prompts() { OPS1+="\$(prompt_git)" fi fi - OPS1+=" \\$\$SHLVL " + # This is for .screenrc: shelltitle "\$ |$SHELL" + #OPS1+="\[\033k\033\\\\\]" + OPS1+=" \$SHLVL\\$ " export OPS1 } -- 2.39.2