Fix Missing App Icon in Left Dock / Panel in Ubuntu 24.04

0
130

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 (.loca/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 add StartupWMClass string in the .desktop config file, and set the value to the class name of the open windows.

Step 1: Find out the class name of the app window

First, you need to launch 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



LEAVE A REPLY

Please enter your comment!
Please enter your name here