Re: Re: Re: Persistence of a window's title?

Steve Ross <[email protected]> Tue, 19 May 2020 16:06:56 -0500
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
Neal,

Thanks, thanks, thanks!

You wrote:

    I googled your prompt command, it is probably your system default.

My "/etc/bashrc" looks to be exactly the same one as in the book that 
you referenced.  That explains the particular content of PROMPT_COMMAND.

You wrote:

    ...it is the culprit and recommends "unset PROMPT_COMMAND" ...

I stumbled upon unsetting PROMPT_COMMAND when I looked at another system 
where the window titles persist... and I noticed that that system does 
not have PROMPT_COMMAND set.  I confirmed that unsetting that shell 
variable on my current system does the trick.

(I've referred to the manual page for "screen" many times, but somehow I 
missed the section that explains the "title-string escape-sequence" and 
the "title-escape-sequence".)

Thanks again,

-- Steve Ross

On 5/19/2020 3:15 PM, Neal Fultz wrote:
> I googled your prompt command, it is probably your system default. 
> This book lists it as a default in /etc/bashrc for fedora, for example:
>
> https://books.google.com/books?id=0VRnDwAAQBAJ&pg=PA260&lpg=PA260&dq=printf+%5C033k%25s@%25s:%25s%5C033%5C%5C&source=bl&ots=yDkW0btNGw&sig=ACfU3U0JX62IdmvjkAxx1lMi6ExhfR3kuA&hl=en&sa=X&ved=2ahUKEwiAr5ei3sDpAhU8GDQIHYXYAv8Q6AEwAXoECAoQAQ#v=onepage&q=printf%20%5C033k%25s%40%25s%3A%25s%5C033%5C%5C&f=false
>
> This person https://unix.stackexchange.com/a/163692/50441 says that it 
> is the culprit and recommends "unset PROMPT_COMMAND", and there's a 
> comment to also check $PS1.
>
> Best,
>
> Neal
>
> On Tue, May 19, 2020 at 12:07 PM Steve Ross <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     Neal,
>
>     Thank you very much for your suggestions.  I looked at the links
>     but I am still puzzled (although I know next to nothing about
>     Xterm or "termcapinfo".)
>
>     Here is my PROMPT_COMMAND:
>
>         $ echo $PROMPT_COMMAND
>         printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}"
>     "${PWD/#$HOME/\~}"
>
>     I don't think that does any Xterm title resetting.
>
>     One other line in my "~/.screenrc" file that may be relevant is:
>
>         term screen-256color
>
>     Any other pointers?
>
>     -- Steve Ross
>
>     On 5/18/2020 4:37 PM, Neal Fultz wrote:
>>     I would recommend checking your $PROMPT_COMMAND - some shell
>>     configurations reset the Xterm title, and screen can pick that up
>>     as a window title or pass it through depending on your environment.
>>
>>     See also
>>     https://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x395.html and
>>     https://unix.stackexchange.com/questions/6065/gnu-screen-new-window-name-change for
>>     example
>>
>>     On Mon, May 18, 2020 at 2:33 PM Steve Ross <[email protected]
>>     <mailto:[email protected]>> wrote:
>>
>>         Is a screen-window's title supposed to persist?
>>
>>         I have created two windows in one "screen" session.  I have
>>         titled them both by typing "CONTROL-a" followed by a colon
>>         followed by the word "title" followed by my title, one for
>>         each window.
>>
>>         I have the titles permanently displayed at the bottom of the
>>         window by two lines in my "~/.screenrc" file:
>>
>>         hardstatus alwayslastline
>>             hardstatus string "%w"
>>
>>         I don't know if it makes any difference, but I also have
>>
>>         altscreen on
>>
>>         The problem is that the screen-window titles do not persist. 
>>         After I enter a command like "ls", the title changes to
>>         something like
>>
>>         username@machine:~/Man
>>
>>         where the directory name is the first first three characters
>>         of the name of the current directory in my home directory.
>>
>>         Is the lack of persistence working as designed, a bug, or am
>>         I missing something?
>>
>>         My version/release of "screen" on Fedora is 4.6.2-8.fc30.
>>
>>         Thanks for any help,
>>
>>         -- Steve Ross
>>