I'd like to know or it is possible to set up the GNOME Terminal in a way that when I open up the terminal and there is already an instance open it'll show that instance and not open up a brand new one.
I'd like to know or it is possible to set up the GNOME Terminal in a way that when I open up the terminal and there is already an instance open it'll show that instance and not open up a brand new one.
I wrote a simple shell script using wmctrl to give the Terminal focus. It does exactly what I want.
First, install wmctrl
sudo apt-get install wmctrl
.Next, fire up a text-editor, copy the following lines.
Save the file somewhere where you usually keep your shell scripts. In my case I did:
~/bin/single_instance.sh
cd to the directory (
cd ~/bin
) and make the file executablechmod +x single_instance.sh
Now, open up Main Menu select Accessories » Terminal press properties and replace command with the script:
~/bin/single_instance.sh
Open up System Settings » Keyboard » Shortcuts. Disable Launch Terminal shortcut by giving it a backspace. Make a custom shortcut. Again fill in the path and name to the script and give it the key combination ctrl + alt + t.
You’re done, single instance terminal...
Add --tab to the launcher command. Then you end up with only one app. open.
It is the default behavior if you use
Mod4+#
(Mod4
= Super = "Windows" key,#
is number in launcher) shortcut to open any application.I generalized and simplfied @Mood 's script a bit. Now it takes a command line parameter and use pgrep instead.
The script:
I'd like to add my own script, since I find it extremely useful:
I configured Ctrl+Alt+T shortcut to run this script and I find it even more comfortable than Guake or Tilda.
I use it with QTerminal but I modified to fit your needs. Good luck