Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 would like to know, if there is possible to use keyboard shortcut to focus on first idle (non working) terminal window in unity (13.10)? Something like Ctr+Alt+T, but before opening the new instance of terminal, searching for any idle instance?

share|improve this question
up vote 7 down vote accepted

First set the world "Terminal" to appear in the window title of your gnome-terminal. To do this, when you are in gnome-terminal go to EditProfile Preferences, select Title and Command tab and be sure that the field Initial title contain the word "Terminal":

Terminal - Title and Command

Second, add a new custom keyboard shortcut for the following command:

bash -c "[[ \"$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)\" != \"gnome-terminal\" ]] && wmctrl -a Terminal || xdotool key Alt+grave"

To do this, go to System SettingsKeyboard, Shortcuts tab, select Custom Shortcut and add a new custom shortcut:

Add custom shortcut

As you can see, I chose as shortcut F8 key which is working great in this case for me.

Note: wmctrl and xdotool must to be installed in order to use them. If you don't have them installed, you can install them from terminal using:

sudo apt-get install wmctrl xdotool
share|improve this answer
For downvoters: please leave a comment - I can improve the answer only if I can know the reason of downvoting. – Radu Rădeanu Apr 3 '14 at 16:37
What is a purpose of "xdotool key Alt+grave" ? (i've tried your solution, actually it happens noting) – ts01 Apr 4 '14 at 8:39
@ts01 Alt+` should switch to another instance of terminal if you have more than one opened and if the focus is on one of them. What keys did you used for the custom shortcut? F8 like I said in the answer? – Radu Rădeanu Apr 4 '14 at 9:12
Yes. It didn't work, but +25 for efforts, anyway – ts01 Apr 19 '14 at 10:32
I am still using it from when I gave you this answer. So you should review all the steps, maybe you made something wrong. – Radu Rădeanu Apr 19 '14 at 10:36

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.