Got app windows that do not show their icons on left (or bottom) dock panel? This tutorial may help to fix the issue in Ubuntu 24.04.
App icons that you see in system app launcher are handled by .desktop
files. This kind of config file usually include a line Icon=app-icon-name
, so Ubuntu and many other Linux can find and display the icon image for the app in start menu (or application menu).
If the icon file is missing from both system icons directory (usually /usr/share/icons
and /usr/share/pixmaps
) and user’s local icons folder (.local/share/icons
), then it shows universal executable icon (the gear icon with gray square background, see the image above) instead.
In Ubuntu 24.04, an app (Transmission in my case) may show its app icon in the app grid and search result, when trying to launch it. Meaning the app icon file is correctly installed on your system. However, after launched the app window, Ubuntu Dock shows a gear icon instead.
If you pin the app to the dock, and then launch it, then there will be 2 icons for it. One correctly displays the app icon, another displays the gear icon meaning icon file cannot found.
This is because the window created by the application is not associated with the shortcut used to start the application. In Ubuntu 22.04 and earlier, you’ll get duplicated app icons on the dock. However, in Ubuntu 24.04 it falls back to the executable icon (the gear icon) instead.
In this case, user can simply add StartupWMClass string in the associated .desktop
config file, and set the value to the class name of the open windows to fix the issue.
Step 1: Find out the class name of the app window
First, you need to launch and keep the app window. Then, press Alt + F2 to launch “Run a Command” dialog. When the dialog opens, type lg and hit Enter.
It will drop-down GNOME’s integrated debugger and inspector tool from the top.
In that window, click Windows button, then find out the class name for the target app window. In my case, they are:
- Transmission:
com.transmissionbt.transmission_66310_4225300
- VirtualBox: Virtualbox Machine
For non-GNOME desktops with Xorg session, open terminal (Ctrl+Alt+T) and run xprop WM_CLASS command. The mouse cursor will become a crosshair, then just click on an app window will output its class name in the terminal output.
Step 2: Add StartupWMClass string
Once you got the class name, edit the corresponding .desktop
file and add the StarupVMClass string.
The .desktop
file is usually located in the following directories:
/usr/share/applications
for Deb and Snap apps..local/share/applications
for user manually created, or app auto-created./var/lib/flatpak/exports/share/applications/
for Flatpak apps.
Go check the previous directories to find out the corresponding .desktop file for your app, then edit it.
In my case, I ran the command below to edit the .desktop config file for Transmission:
sudo gnome-text-editor /usr/share/applications/transmission-gtk.desktop
And, add line StartupWMClass=com.transmissionbt.transmission_66310_4225300 under ‘[desktop entry]’. After saved the file, just re-launch Transmission and the icon finally correctly displayed.
Similarly, edit org.gnome.TextEditor.desktop
file under /usr/share/applications/
, and add StartupWMClass=gnome-text-editor
will make the text editor started from terminal correctly display app icon on the dock.
For Virtualbox, the system package does NOT has a .desktop
file for creating Virtual Machines windows, since they are started from VM Manager window. You need to manually create one by running command:
gnome-text-editor ~/.local/share/applications/virtualvm.desktop
Then writing following lines and save it. You may change Icon=virtualbox to whatever icon file as you want.
[Desktop Entry] Version=1.0 Name=Oracle VM VirtualBox GenericName=Virtual Machine Type=Application Exec=VirtualBoxVM %U TryExec=VirtualBoxVM Keywords=virtualization; Icon=virtualbox Categories=Emulator;System; Actions=Manager; StartupWMClass=VirtualBox Machine Comment=Run the virtual machine NoDisplay=true [Desktop Action Manager] Exec=VirtualBoxVM Name=Run the Virtual Machine
I followed the steps on this tutorial and it fixed my icons on dock.
Thank you!
I have the same issue with Skype downloaded from the new App Center.
On the Skype desktop the StartupWMClass yet it does not show the icon.
Thanks
thank you for posting, very useful!
Now it uses the Virtualbox icon. Is thare anyway to use eache distro with his own icon?
Thank you very much, your post was very useful to me with DigiKam on Ubuntu 24.04!
Thanks
I have the same problem with Skype as @Krushna mentioned. I modified the skype_skypeforlinux.desktop to have the StartupWMClass with either Skype or skype and both didn’t help.
Thank you!
Too much work going to accept no icons as a gnome standard
thanks! it worked! im using ubuntu 24.
Thanks for the detailed description, worked for me..
Not working for me. Slickedit 2018 has a class of “Vs_exe” but even with that set in the .desktop file, I still get the generic icons. I didn’t have this problem in Ubuntu 22.
Thank you! it worked!!
Worked for me on Clementine, but not on the icons on the desktop that are appimage files FreeCAD and Cura
Thank you. I solved using the terminal command then edited the desktop-entry file with the icon name, but I still have a problem when I tried to exit the Alt+f2 command, no way to close the window, strange behaviour in 24.04
Usually, press Esc key should close the window.