I'm looking for a way to get the current window title in GNU screen .
I have a script that use screen -X title something
to change the window title when running and I would like to set it back to it's previous value at the end of the script.
I'm looking for a way to get the current window title in GNU screen .
I have a script that use screen -X title something
to change the window title when running and I would like to set it back to it's previous value at the end of the script.
"screen -X" attach a command to a specified screen session, it has no effect on the window title. Either your script uses an escape sequence to set the screen window title, or your screenrc does. Take notice that screen windows are unrelated to terminal (xterm, etc) windows.
You can take a look at two of my blog posts regarding using zsh kludges to make this work,
I use a combination of factors to do it, primarily a preexec() hook in my shell, which can just as easily work with another shell.
http://blog.psych0tik.net/?p=841
I believe that the code in the post may be outdated, the relevant files are always up to date here:
http://natalya.psych0tik.net/~richo/screenrc
http://natalya.psych0tik.net/~richo/zshrc
http://natalya.psych0tik.net/~richo/profile
If you're a vim user, you'll almost certainly want to
set titleold
to something meaningful as well to avoid your title getting clobbered on exit.