66

I have downloaded Aptana Studio 3 and created the following launcher item for using Alacarte:

file: alacarte-made.desktop

[Desktop Entry]
Comment=
Terminal=false
Name=Aptana Studio 3
Exec=AptanaStudio3
Type=Application
Icon=/opt/Aptana-Studio-3/icon.xpm

Then, when I add the icon to the favorites and opens the Aptana Studio 3 I get two icons for it, one for launching new instances, and one for the currently running instance as per the following screenshot:

enter image description here

How do I force the application to use the same icon added to the favorites?

8
  • Can you please specify how you installed Aptana? From the official site all I can see is a standalone zip file. (something like portable applications in windows).
    – hytromo
    Jan 29, 2014 at 6:31
  • Yes, that was it. Jan 29, 2014 at 6:41
  • So, how did it end up in /opt? Also, is it on your $PATH? How by specifying only AptanaStudio3 in your desktop file it is able to run?
    – hytromo
    Jan 29, 2014 at 6:42
  • 1
    I have done it, thank you. I have created a Sym Link in /usr/bin to /opt/.../aptana It was just a mater of naming issue. I had to name the .desktop and bin and link just the same :) Jan 29, 2014 at 6:44
  • 3
    Please answer in detail below how you managed to solve your problem :) (I don't know, I only asked you some questions)
    – hytromo
    Jan 29, 2014 at 6:46

3 Answers 3

99

To save sifting through the thread mentioned by @earthmeLon, you need to do the following:

  1. Launch the application
  2. Fire up a terminal and run xprop WM_CLASS. Click on the window of the the application that is running with a duplicate icon.
  3. You'll get some output like WM_CLASS(STRING) = "Navigator", "Firefox". Choose one of the classes, eg Firefox in this example
  4. Add the class as the value of StartupWMClass in the .desktop file. For example, StartupWMClass=Firefox
  5. Save the .desktop file, close the application and re-open it. There should now only be 1 icon in the launcher
11
  • 3
    For those having the same issue on GNOME you can use MenuLibre: When editing the corresponding entry you will find a field for setting StatupWMClass in the list that shows up when clicking the "Advanced" button Dec 10, 2015 at 13:45
  • 1
    TLDR; *.desktop filename = WM_CLASS(STRING) last item but lowercased. Details: I had to solve this issue while creating "Firefox Developer edition" shortcut. Naming the file "firefox.desktop" simply shadowed the standard firefox icon. Using xprop WM_CLASS and clicking the window returned WM_CLASS(STRING) = "Navigator", "Firefox Developer Edition". In the end I renamed my .desktop file as follows: mv ffde.desktop "firefox developer edition.desktop". (Another issue though, I can not right-click » addToFavorites on the icon from the gnome dock extension)
    – Stphane
    Jun 24, 2018 at 10:59
  • 1
    If you don't want to / can't to modify the original .desktop file into the /usr/share/applications folder, you can copy the file to your local folder, ~/.local/share/applications, and modify the file here. So you will have a system-wide original file (probably provided by the developer/distribution) and a customized file which overrides the original file in the gnome-shell applications panel. Copying to your local folder is desirable as the file into /usr/share/applications can be reversed in the next package update. Jun 27, 2018 at 22:04
  • 1
    No. Useless in Ubuntu 20
    – funicorn
    Nov 6, 2020 at 2:08
  • 1
    Thanks for saving me twice. I would have gave you another up-vote, but I unfortunately can't.
    – Greeso
    Mar 1 at 19:06
4

StartupWMClass

You can use StartupWMClass to group windows by class.

See this thread for additional information.

1
  • In addition, make sure: (1) There's no other desktop file for the same app, also in "AppEditor" or in "Main Menu". (2) Verify that Exec=/path/to/app is an absolute path.
    – Noam Manos
    Mar 30, 2020 at 15:54
-2

I faced this issue when I manually installed Spring Tool Suite 4

Then, after install, I created STS.desktop in following folder of Ubuntu 20

1
  • 1
    Paste the text of the commands, instead of links to images. Oct 24, 2021 at 14:13

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.