VanDyke Software

Tips

Index

Displaying Text In The SecureCRT® Title Bar

It can be useful to have the SecureCRT title bar update dynamically, especially when using multiple concurrent SecureCRT sessions. There is an option in your Session Options that allows you to statically set the title bar for a particular SecureCRT window. However, this is not always sufficient.

If you need to place information in the SecureCRT title bar dynamically, SecureCRT supports the standard xterm escape sequences for changing the window title bar.

These escape sequences can be sent from the remote system by a variety of means, and allow you to change how the SecureCRT title bar is displayed arbitrarily.

If the remote system sends the following, SecureCRT places "sometext" in the title bar of the SecureCRT window.

ESC ] ; sometext CTRL+G

The following Perl script demonstrates this functionality.

---
#! /usr/bin/perl
# title.pl - sends xterm escape sequence to
# change window title to @ARGV

$esc = "\x1b";
$bel = "\x7";

$txt = join(" ", @ARGV);

print $esc, "];", $txt, $bel;
---

When run from your shell on the remote, it will take any arguments as text to display in the title bar.

For example, if run on a Un*x system:

% title.pl $user@$host\:`pwd`

would place something similar to the following in the SecureCRT title bar.

someuser@somehost:/tmp

The text would depend, of course, on the values of $user, $host, and the current working directory.

There are many possible applications. One common use is to hard-code the escape sequence into your shell prompt, or use a similar mechanism, so that each time you use the cd command on a Un*x host, for example, the title bar is changed to reflect the current working directory, or whatever you want displayed in the title bar.

For additional information on xterm escape sequences, refer to the following web links.

FAQS.org provides specific instructions on this technique:

http://www.faqs.org/faqs/x-faq/part2/section-15.html

Here is an exhaustive list of escape sequences:

https://www.xfree86.org/4.8.0/ctlseqs.html

https://www.vandyke.com/support/tips/vbswin.html

Four Fast Ways to Learn More…

  1. Read or download one of our secure solutions white papers.
  2. Download a free 30-day evaluation copy of our products.
  3. Let us help define the right Secure Shell solution for your company.
  4. Subscribe to our What's New page for tips, solution ideas, and product news.