5

I made a .desktop file for a PyQt5 App, it does show the icon on the desktop, but when I open it and starts running, the icon is not showed in the taskbar, instead there is a gear icon. Thanks for your help

.desktop file:

[Desktop Entry]
StartupWMClass=esmeralda_suites.py
Version=1.0
Type=Application
Name=Esmeralda Software
Comment=
Exec='/home/cattivellio/Documents/Esmeralda BETA 9/esmeralda_suites.py'
Icon=/home/cattivellio/Documents/Esmeralda BETA 9/img/minilogo.png
Path=/home/cattivellio/Documents/Esmeralda BETA 9
Terminal=false
StartupNotify=true

desktop screenshot

3 Answers3

8

You will need to specify the correct wmclass in the `.desktop launcher.

  • Look up the wmclass for your window: for the standard Ubuntu desktop, open the run dialog (lt+F2) while the app is running. Type lg followed by Enter, and look up the wmclass of the app in the list.

  • Then add or edit the key StartupWMClass in the `.desktop launcher such that it mentions the correct wmclass.

    StartupWMClass=<wmclass>
    
vanadium
  • 98,427
  • I got this: WM_CLASS(STRING) = "esmeralda_suites.py", "esmeralda_suites.py" , but when I add it on my .desktop file it like this StartupWMClass=esmeralda_suites.py I still missing the icon in the taskbar, I also tried like this StartupWMClass="esmeralda_suites.py" and like this StartupWMClass=<esmeralda_suites.py> – Cattivellio Aug 22 '23 at 12:28
  • So you are running Xorg. Still, the trick should work, especially after you restarted the system. Indeed, the first version is the correct one, although it may also work with the quotes. – vanadium Aug 22 '23 at 12:58
  • I already restarted the system and still the same problem, Im going to add my .desktop file to the question – Cattivellio Aug 22 '23 at 13:11
  • 2
    There is a nice post explaining this solution here: https://ubuntuhandbook.org/index.php/2024/04/missing-icon-dock-ubuntu-2404/ – TVG Aug 23 '24 at 08:05
  • As soon as I edited the file in ubuntu 24.04, the icon changed to the correct one. I'm on Xorg. – Sergio Nov 19 '24 at 14:38
  • This worked for some apps but not Kate which says wmclass: kate any ideas what untracked means in this context? – teknopaul Aug 22 '25 at 09:40
  • Worked for Jetbrains IntelliJ. For anyone having the same issue with Intellij use this in your .desktop file: StartupWMClass=jetbrains-idea – risingfish Sep 23 '25 at 16:50
0

The first answer is correct if it is showing no icon. However, if you are seeing a gear, look somewhere else in your Applications View, and you will likely find a gear icon with a similar name.

When you launch from the Applications View it is somehow loading that gear icon .desktop entry instead. Find that .desktop entry, probably in /usr/share/applications, remove it, make sure you follow the setup instructions above, and it will work.

0

Your launcher file (.desktop) is missing the StartupWMClass entry. First locate your desktop file. It's likely in

  • ~/.local/share/applications OR
  • /usr/share/applications (need sudo access for this)

Use looking glass (Alt+F2 and then type lg) to find the WM Class for your application (you can try launching the application after you started looking glass to easily identify the new entry. Close looking glass using the Esc key.

Now edit your .desktop file and add a line StartupWMClass=info from looking glass as is without quotes

In a couple of instances, I had to also remove the executable permission from the file (chmod -x app.desktop) and then add it back (chmod +x app.desktop). But I am myself not convinced about this. Most likely this might have caused some refresh or something. Writing it here only as another thing to try.

Hopefully that works. Best of luck.