Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use a script which either activates an already running window of a program, or starts that program if it is not running.  It uses different shortcut-keys; one for each of my most used apps — it checks for a unique window title format.   This has worked fine, until today, when I decided to use terminator along side of gnome-terminal.

These two terminal apps display the same title format, and I don't know how to change them independently (actually I don't know how to change them at all).

I also use konsole (because it displays Unicode better than gnome-terminal), and it has a profile-option which allows changes to the tab-title format which is mirrored in the window's title,  but terminator and gnome-terminal don't have this option.

Is there some way to have different title formats for different terminals?

share|improve this question

From the shell side, you could look at the shell's parent process and include that in the title somehow:

ps -o comm= -p $(ps -o ppid= -p $$)

Or from your script, you might be able to use the window's class attribute which is the third column:

wmctrl -x -l

If you share the script you're using I might be able to provide a more specific answer.

share|improve this answer
Yes, thaks.. I already do something very similar to validate marginal/ambiguous cases, and I did think of doing it for this case, but if there is some way to simply change the title bar, I'd prefer that... and also, it would just be handy to know how to change the formats... This is what I currently use pgrep -f -x -n -c "$procMask" .. and for the title, its: wmctrl -l |grep "$windMask" ... – Peter.O May 7 '11 at 9:29
Re 'sharing the script'.. The main issue for me here is "How can I change the actual default title formats in a Terminal window?".. this is because my approach has been Window-title centric.. I have a script which gives me all Window-IDs for a given regex TitleMask (window-get-id-by-title-mask), and then I can use another script: window-get-exe-by-id .. but I haven't, as yet, set my main script to handle the situation described in my question... This raised the issue of: Can Terminal-window titles be changed on a per Terminal-program basis? .. thanks for the offer though :) – Peter.O May 7 '11 at 18:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.