Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I usually have several xterms open, with each one running a different gnu screen session. It would be useful if--at a glance--I could see the session name in the xterm title bar. That way I would be able to quickly tell which screen sessions are running in which xterms. This would be very useful when alt-tabbing.
I know that there are termcap, terminfo, and termcapinfo commands available, but I don't know how to use these. I also know that there's an $STY environment variable that stores the session name.
Also, I do not want to lose my current "hardstatus alwayslastline" bar. It seems like this should be independent from the xterm title, anyways.
If you use screen to set the title, it can be done either as a screen '-t' commandline argument, or from within a screen session with the 'Ctl-A A' command to set the title.
At runtime, you can also include escape sequences in your shell prompt (bash works well for this), which get trapped by the xterm each time the prompt is printed. See How to change the title of an xterm for details.
my xterm title bar contains the text within the single quotes, including, of course, the session name.
If I want, I can use the same string for the screen session name and the xterm title:
xterm -T "Office" -e 'screen -S Office'&
Doing this causes only the expected string to appear in the title bar of the xterm.
It perhaps is not immediately obvious from the link I posted, but by embedding the magic escape sequences to set your xterm title bar into your shell prompt, they do not necessarily become a visible part of the prompt. Since they are like any other escape sequence, they are trapped and handled purely within the xterm, and result in specific behavior by the xterm. The principle is the same as escape sequences that set fonts, move cursors, etc. Using such escape sequences is likely to be the only method of setting the title from within the xterm itself.
I think the essential intractable problem is that the session name cannot by queried from within the session itself.
Thanks. You've given me some useful information that I didn't know. I think we're almost there!
I don't think the xterm -T/-e solution is the best, though, since I often need to reattach an already running screen session. It may work by executing a screen reattach via -e, but it's a little clunky to have to execute a lengthy xterm command each time.
Actually, there is a way to query for the session name from within screen. The $STY environment variable, to be precise. I'm not sure if that can be used from an escape sequence, though. There must be a way!
As far as prompt escape sequences goes, question for you--is there an advantage to putting these magic escapes within the prompt versus setting them in your termcap?