Categories: Ubuntu

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

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.

Sponsored

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.

Sponsored

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

The post Fix Missing App Icon in Left Dock / Panel in Ubuntu 24.04 appeared first on Osgrove.

Ubuntu Server Admin

Recent Posts

Top 11 Linux Log Monitoring Tools for System Administrators

In Linux environments, system administrators need to continuously monitor log files to evaluate system health,…

52 minutes ago

Accelerating AI with open source machine learning infrastructure

The landscape of artificial intelligence is rapidly evolving, demanding robust and scalable infrastructure. To meet…

8 hours ago

Hardening automation for CIS benchmarks now available for Ubuntu 24.04 LTS

We’re pleased to release Ubuntu Security Guide profiles for CIS benchmarks. These profiles will allow…

8 hours ago

Detecting and Fixing Memory Leaks with Valgrind

Memory leaks are among the most frustrating bugs to track down in C and C++…

1 day ago

How to Kill Processes Using Specific Ports on Linux, Windows and MacOS

Have you ever encountered issues starting a server or application because the required port is…

1 day ago

How to Fix the “Native Host Connector Not Detected” Error for GNOME Extensions in Ubuntu 22.04

When upgrading to Ubuntu 22.04 LTS (Jammy Jellyfish), many users encounter the error message: “Although…

1 day ago