Get xterm title string from the UNIX shell

2008-06-07

Sometimes you run programs in xterm windows that try and do you a favour, by setting the xterm title property. Potentially useful enough, but aggravatingly some of them don't restore the previous title when they exit. If you're using some scheme of your own to set meaningful window titles, this is annoying.

Here's a shell one liner that you can use to grab the current title in an xterm. You could use this to write a wrapper script that gracefully launches any such rude application, and restores the rightful title property when it's done

/usr/X11R6/bin/xprop -id $WINDOWID | perl -nle 'print $1 if /^WM_NAME.+= \"(.*)\"$/'

posted by cms on 2008-06-07 14:21:10
tagged as
  • uncategorized
  • computers
  • programming
This is beatworm.co.uk
A blog by cms
Front page
RSS