{"id":46439,"date":"2024-04-30T15:46:41","date_gmt":"2024-04-30T15:46:41","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=46439"},"modified":"2024-06-17T07:42:47","modified_gmt":"2024-06-17T07:42:47","slug":"missing-icon-dock-ubuntu-2404","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2024\/04\/missing-icon-dock-ubuntu-2404\/","title":{"rendered":"Fix Missing App Icon in Left Dock \/ Panel in Ubuntu 24.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/missing-icon.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-46440\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/missing-icon-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/missing-icon-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/missing-icon-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/missing-icon-700x700.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/missing-icon-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/missing-icon.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>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.<\/p>\n<p>App icons that you see in system app launcher are handled by <code>.desktop<\/code> files. This kind of config file usually include a line <code>Icon=app-icon-name<\/code>, so Ubuntu and many other Linux can find and display the icon image for the app in start menu (or application menu).<\/p>\n<p>If the icon file is missing from both system icons directory (usually <code>\/usr\/share\/icons<\/code> and <code>\/usr\/share\/pixmaps<\/code>) and user&#8217;s local icons folder (<code>.local\/share\/icons<\/code>), then it shows universal executable icon (the gear icon with gray square background, see the image above) instead.<\/p>\n<p><!--more--><\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/fix-missing-icon-noble.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-46441\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/fix-missing-icon-noble.webp\" alt=\"\" width=\"562\" height=\"644\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/fix-missing-icon-noble.webp 562w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/fix-missing-icon-noble-262x300.webp 262w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><\/a><\/p>\n<p>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&#8217;ll get duplicated app icons on the dock. However, in Ubuntu 24.04 it falls back to the executable icon (the gear icon) instead.<\/p>\n<p>In this case, user can simply add <b>StartupWMClass<\/b> string in the associated <code>.desktop<\/code> config file, and set the value to the class name of the open windows to fix the issue.<\/p>\n<h3>Step 1: Find out the class name of the app window<\/h3>\n<p>First, you need to launch and keep the app window. Then, press <b>Alt + F2<\/b> to launch &#8220;Run a Command&#8221; dialog. When the dialog opens, type <b>lg<\/b> and hit Enter.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-runlg.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-46443\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-runlg.webp\" alt=\"\" width=\"582\" height=\"328\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-runlg.webp 582w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-runlg-300x169.webp 300w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/a><br \/>\nIt will drop-down GNOME&#8217;s integrated debugger and inspector tool from the top.<\/p>\n<p>In that window, click <b>Windows<\/b> button, then find out the class name for the target app window. In my case, they are:<\/p>\n<ul>\n<li>Transmission: <code>com.transmissionbt.transmission_66310_4225300<\/code><\/li>\n<li>VirtualBox: <b>Virtualbox Machine<\/b><\/li>\n<\/ul>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-lg.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-46442\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-lg-700x285.webp\" alt=\"\" width=\"610\" height=\"248\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-lg-700x285.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-lg-300x122.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-lg-768x313.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-lg-1320x538.webp 1320w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/noble-lg.webp 1364w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>For non-GNOME desktops with Xorg session, open terminal (Ctrl+Alt+T) and run <b>xprop WM_CLASS<\/b> command. The mouse cursor will become a crosshair, then just click on an app window will output its class name in the terminal output.<\/p>\n<h3>Step 2: Add StartupWMClass string<\/h3>\n<p>Once you got the class name, edit the corresponding <code>.desktop<\/code> file and add the StarupVMClass string.<\/p>\n<p>The <code>.desktop<\/code> file is usually located in the following directories:<\/p>\n<ul>\n<li><code>\/usr\/share\/applications<\/code> for Deb and Snap apps.<\/li>\n<li><code>.local\/share\/applications<\/code> for user manually created, or app auto-created.<\/li>\n<li><code>\/var\/lib\/flatpak\/exports\/share\/applications\/<\/code> for Flatpak apps.<\/li>\n<\/ul>\n<p>Go check the previous directories to find out the corresponding .desktop file for your app, then edit it.<\/p>\n<p>In my case, I ran the command below to edit the .desktop config file for Transmission:<\/p>\n<pre>sudo gnome-text-editor \/usr\/share\/applications\/transmission-gtk.desktop<\/pre>\n<p>And, add line <b>StartupWMClass=com.transmissionbt.transmission_66310_4225300<\/b> under &#8216;[desktop entry]&#8217;. After saved the file, just re-launch Transmission and the icon finally correctly displayed.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/transmission-vmclass.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-46444\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/transmission-vmclass-700x520.webp\" alt=\"\" width=\"610\" height=\"453\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/transmission-vmclass-700x520.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/transmission-vmclass-300x223.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/transmission-vmclass-768x570.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/04\/transmission-vmclass.webp 955w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>Similarly, edit <code>org.gnome.TextEditor.desktop<\/code> file under <code>\/usr\/share\/applications\/<\/code>, and add <code>StartupWMClass=gnome-text-editor<\/code> will make the text editor started from terminal correctly display app icon on the dock.<\/p>\n<p>For Virtualbox, the system package does NOT has a <code>.desktop<\/code> file for creating Virtual Machines windows, since they are started from VM Manager window. You need to manually create one by running command:<\/p>\n<pre>gnome-text-editor ~\/.local\/share\/applications\/virtualvm.desktop<\/pre>\n<p>Then writing following lines and save it. You may change <b>Icon=virtualbox<\/b> to whatever icon file as you want.<\/p>\n<pre>[Desktop Entry]\r\nVersion=1.0\r\nName=Oracle VM VirtualBox\r\nGenericName=Virtual Machine\r\nType=Application\r\nExec=VirtualBoxVM %U\r\nTryExec=VirtualBoxVM\r\nKeywords=virtualization;\r\n<b>Icon=virtualbox<\/b>\r\nCategories=Emulator;System;\r\nActions=Manager;\r\nStartupWMClass=VirtualBox Machine\r\nComment=Run the virtual machine\r\nNoDisplay=true\r\n\r\n[Desktop Action Manager]\r\nExec=VirtualBoxVM\r\nName=Run the Virtual Machine<\/pre>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":46440,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1667,2087],"class_list":["post-46439","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-dash-to-dock","tag-ubuntu-24-04"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/46439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=46439"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/46439\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/46440"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=46439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=46439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=46439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}