I have two separate .desktop files locked to the panel. Both of them opens terminal windows and runs a series of commands (with user input). Trouble is, while one is opened already, opening the other results in both of them getting grouped together under the same one (one which was opened first). This is a bit troubling since..say if I opened a terminal window by ctrl+alt+t shortcut, instead of opening a new icon in the panel, it gets added in to the already opened .desktop file!

I'm running Ubuntu 12.10 with unity interface.

  • If you like to know (I am not looking for a chance to correct you here), it is Ubuntu 12.10, not 12.1. 12 is the year this version was released and 10 is the month. 12.1 denotes January 2012, but versions are only released in April and October. – Jack Sep 6 '13 at 17:37
  • Sorry for the typo. – Python Student Sep 8 '13 at 16:12
  • Note from 2017: The accepted answer is still supposed to work, however, there is a bug in gnome-terminal which breaks this. You can fix it yourself, by applying this patch to /usr/bin/gnome-terminal (which is just a python wrapper): pastebin.com/wyA8cf5s No warranty on that, it's a gross not-pythonic hack, but it does unbreak it for me. Once it's applied, follow the directions below as posted by @RomanRaguet. – Wug Jun 21 '17 at 20:32

I think the problem could be for the WM_CLASS(STRING) in the gnome-terminal's window properties

If you have two desktop files with different icons but running gnome-terminals... you can check the WM_CLASS with the command xprop

  • xprop | grep WM_CLASS

Then click in the windows (with the cross cursor)... and the result for your applications should be:

WM_CLASS(STRING) = "gnome-terminal", "Gnome-terminal"

In my opinion, due to the windows have the same WM_CLASS they will be grouped together in the Unity Launcher.

Set Class & Name in Gnome-Terminal

To avoid this issue you can try to set a different WM_CLASS string for each desktop file.

The command should be:

  • gnome-terminal --disable-factory --class <appname> --name <appname>

Here you have an example to run gnome-terminal & execute a little script.

  • gnome-terminal --disable-factory --class term-red --name term-red --title Term-Red --window-with-profile=red -e '/home/virtual/Desktop/test1.sh'

Example with 2 desktop files.

I created 2 desktop files that will run scripts (using gnome-terminal), and the gnome-terminal desktop icon locked to the Unity Launcher.

1) gnome-terminal.desktop
2) term-green.desktop
3) term-red.desktop.

enter image description here

When I click in the 3 desktop files they are not grouped under the same icon.

enter image description here

As you can see 3 Terminals are running (with their own icon).

enter image description here

Here you have the content of the term-red.desktop.

enter image description here

The important keys to add in your .desktop files would be:

  • Exec=gnome-terminal --disable-factory --class term-red --name term-red --title Term-Red --window-with-profile=red -e '/home/virtual/Desktop/test1.sh'
  • StartupWMClass=term-red
  • StartupNotify=true

Here you have information about Desktop Entry Specification.

Another option would be to run xterm instead gnome-terminal.
xterm will accept the option class & name.

  • Exec=uxterm -class term-red -name term-red -T Term-Red -e '/home/virtual/Desktop/test1.sh'

NOTE: Please change these examples according to your neeeds.

Hope it helps.

  • This is 'the' perfect answer! Thank you very much. Also, did you had this problem before applying this tweak? Is it a bug or something gone unnoticed in an update? – Python Student Sep 13 '13 at 6:43
  • awesome works on Ubuntu 20-04 with gnomeshell dock – pt123 Jun 23 '20 at 11:44

They are grouped together that way to keep your launcher cleaner (imagine if you had ten windows open). If you click that icon once, focus goes to one of those windows that last had focus. If you click that icon again it should spread all those windows on your desktop and let you pick the one you want - like this:


It is REALLY handy when you get used to it.

  • Thankyou for the answer. This of course is handy when the open windows belong to the same category. In my case they are different thus making opening a new window by clicking on it quite difficult. – Python Student Sep 8 '13 at 16:11
  • When you say open a new window, if you mean you want to start another terminal via the icon, you right click the icon and select "New Terminal". – Jack Sep 8 '13 at 16:40
  • I might've to expand on my last comment; There are three icons: 1.Internet (a python script) 2.Cleaner(another python script) 3.Terminal(gnome-terminal) Opening any one of these would cause them to stack together(since all use terminal window). If I open my Internet.desktop icon and later open the Cleaner it will get attached to Internet! This prevents from opening any new Internet terminals(since it is now shown as active and no, there is no 'new' under this icon). Terminals are quite ok in this aspect since they have 'new' in their submenu. – Python Student Sep 8 '13 at 18:00

Possibly that’s because you use gnome-terminal for Exec. Through the documentation, you can address your executable file and then add a line Terminal=true to execute it in a terminal.

[Desktop Entry]
Name=Your app
Comment=An app for doing something

Here’s a screenshot which shows the result of a test app with an icon the same as Terminal:

Test app with Terminal icon

Since the Exec’s are different, the windows are not grouped.

You can also use your own desired icon to make apps different. Moving the SVG or PNG file to ~/.icons and using just the name.ext of file for Icon will make the best result in Unity.

  • they appear as two icons in the launcher but the actual windows still get grouped in the same icon. – miguel.negrao Feb 18 '14 at 15:34

A very easy but not rewarding approach for those short on time is:

  1. Close all filesystem windows you have open.
  2. Unlock the files icon from the sidebar.
  3. Using launcher, find files and open a window again
  4. Lock the icon to launcher again.

This may or may not solve it for you. I am just a newbie at ubuntu. Hope this helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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