LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (http://www.linuxquestions.org/questions/fedora-35/)
-   -   GNU Screen Caption Display Problem (http://www.linuxquestions.org/questions/fedora-35/gnu-screen-caption-display-problem-4175475934/)

sadarax 09-04-2013 05:12 PM

GNU Screen Caption Display Problem
 
I just installed Fedora 19 and tried running GNU screen. I've been using the same screenrc file for years now and something is suddenly changed. (It previously worked correctly on Fedora 18 and has worked on Redhat, Debian and Ubuntu for years as well.)

This is my screenrc caption line:
hardstatus alwayslastline
hardstatus string '%{= g}[ %{G}%H %{g}]%{W}%L= %-Lw%{r}(%{W}%n*%50L>%t%{r})%{W}%+Lw%-0=%{g}'


It should display something like this:

[ host1 ] 0$ (1*) 2- 3$


Now it incorrectly displays the hostname:fullpath, which is wrong.

[ host1 ] 0- root@host1:~ (1*john@host1:~/code/scripts/system)

I've tried fixing this but I'm honestly not sure what went wrong or why it's broken.

I just want a very minimal display like this: [ host1 ] 0$ (1*) 2- 3$. No paths and since screen doesn't seem to update the titles for any programs I open (like Vim) within an existing shell, I don't care about the titles.

Help?

vulcan99 11-17-2013 03:43 PM

Same problem here. I don't know much about all this TERM stuff, but I found what seems to be a solution.

In the file /etc/basrc, it checks the $TERM variable, if it starts with "screen*", it sets a PROMPT_COMMAND variable.

If you change that file to look like:

screen*)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
#PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
PROMPT_COMMAND=''
fi
;;

Then it should do what you want. At least it did for me. Notice I commented out the original PROMPT_COMMAND line and set it to an empty string.

sadarax 11-17-2013 11:10 PM

Quote:

Originally Posted by vulcan99 (Post 5066271)
Same problem here. I don't know much about all this TERM stuff, but I found what seems to be a solution.

In the file /etc/basrc, it checks the $TERM variable, if it starts with "screen*", it sets a PROMPT_COMMAND variable.

If you change that file to look like:

screen*)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
#PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
PROMPT_COMMAND=''
fi
;;

Then it should do what you want. At least it did for me. Notice I commented out the original PROMPT_COMMAND line and set it to an empty string.

Whoa, thanks man. This fixed the problem completely.
UPDATE: I just found out that you don't need to edit the system configuration files to fix this. Just add the line:

Code:

PROMPT_COMMAND=''
Somewhere into your own bashrc file (typically in ~/.bashrc).


All times are GMT -5. The time now is 11:52 AM.