keep only one instance of gnome-terminal open

Asked by komputes

I have a keyboard shortcut to open a terminal, but after a day I end up having 20 or 30 terminal windows open. I was wondering if I could configure opening gnome-terminal to do any of the following:

0 Force Ubuntu to only run one instance of gnome-terminal
1 Icon or Shortcut =Open the existing terminal which has been minimized or is behind other windows
2 Create a new Tab in the existing terminal

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Selene ToyKeeper (toykeeper) said :

You may find a different xterm program more appropriate for that type of use. There are some designed to pop up when you press a hot key, run a few commands, and then hide again. For example:

  - tilda
  - yakuake
  - yeahconsole

For use case 2 (new tab), you could bind a hotkey to "gnome-terminal --tab". That should open a new tab in the last-opened window. However, when I tried it in gutsy, it didn't work. Hopefully it's fixed in hardy.

Also, it's possible to bind a key to "focus existing app if running, or start a new one" in Sawfish... but I don't know of any such feature in the default GNOME desktop. So, to get the exact behavior you wanted, you might need a different window manager, and that's probably more trouble than it's worth.

If you just want to run individual commands, the "grun" program might work. It pops up, runs one command, and disappears.

Revision history for this message
Selene ToyKeeper (toykeeper) said :

BTW, the issue where "gnome-terminal --tab" doesn't work is apparently a long-standing known bug, and it doesn't look like the developers upstream want it fixed. The response, basically, was that the feature is there in case you want to open a new window with more than one tab. It is not intended to open a new tab in an existing window (even though the "--help" docs say so).

Revision history for this message
komputes (komputes) said :

How do you add an advanced hotkey such as "gnome-terminal --tab" to a key? I am using System> Preferences > Keyboard Shortcuts, what method do you use? I have seen that bug and I have been subscribed to it. I will try out your other recommendations.

Revision history for this message
Selene ToyKeeper (toykeeper) said :

This is a short guide to custom keybindings in GNOME:

It explains how to create up to 12 custom keys.

However, this type of thing is somewhat discouraged in GNOME, which is focused more on simplicity than power. If you want to do more extensive customization, a different window manager might be better. Some popular options here are KDE, XFCE, and Fluxbox. They even have Ubuntu variants -- kubuntu, xubuntu, and fluxbuntu. However, reinstalling is not necessary if you'd like to try the other options. It should be sufficient, for example, to run "apt-get install kubuntu-desktop".

Switching to a different desktop will change a lot of things, so I wouldn't recommend it unless you want to spend some time learning.

Revision history for this message
komputes (komputes) said :


Thank you tremendously for your recommendations, I have tested tilda, yakuake and yeahconsole and here were my results (using 8.04):

tilda is nice and sleek (slides down) in that it is very clean but it crashed often during testing. As well, when bringing it up focus does not go to the cursor, making clicking still necessary. 3/5

yakuke is nice and sleek (slides down) , it is very fast and kept in memory ready for your input. it allows you to create tabs or It has enough tweaks to please me. During testing yakuke froze but did not crash (when I was overloading it.) 4/5

yeahconsole - "XError Caught" , doesn't work 0/5

I think I found my new console "yakuke", very much like command line consoles in games, very sleek but has a few small issues. I hoped my bashisms won't break this xterm based terminal console emulator.

Thanks again!