Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I tend to use the terminal a lot,

So I wondering if there is a way I can make Ctrl+Alt+T focus the existing terminal if there is one, otherwise create a new terminal?

share|improve this question
add comment

2 Answers 2

up vote 15 down vote accepted

Create a small script which will raise the GNOME Terminal:

echo "xdotool windowactivate \`xdotool search --onlyvisible --class gnome-terminal\`" > ~/raiseterminal.sh && chmod +x ~/raiseterminal.sh

or if you want to check if Terminal is already running, use:

echo "if ps aux | grep "[g]nome-terminal" > /dev/null then xdotool windowactivate `xdotool search --onlyvisible --class gnome-terminal` else gnome-terminal & fi" > ~/raiseterminal.sh && chmod +x ~/raiseterminal.sh

Open the preferences to set up a custom keyboard shortcut and set the command to /home/$USER/raiseterminal.sh, but make sure to change $USER to your actual username.

If you only want to raise the terminal on a specific screen or desktop, see xdotool search --help for more information on how to do this.

There are also various other methods which work better with other window managers.

share|improve this answer
add comment

why don't you try tilda or guake, both available in ubuntu repositories. Although they don't specifically do what you're after, I'm sure they are that thing that you were looking for but did not know it existed. ;)

EDIT: ok, I was a bit vague, more information follows:

from wikipedia:

Tilda is a GTK+ terminal emulator. Its design was inspired from consoles in computer games such as Quake which slide down from the top of the screen when a key is pressed, typically the tilde, and slide back up when the key is pressed again.

Running Tilda can be faster than launching a new terminal with a keyboard shortcut because the program is already loaded into memory; it can be useful to people who frequently find themselves opening and closing terminals for odd tasks.

guake is really the same thing, the only difference I noticed is that I couldn't make it open http links by ctrl+click which I found annoying

share|improve this answer
add comment

Your Answer

 
discard

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.