Problem:
Icon for Visual Studio Code is wrong. It uses the icon from the text editor
Things I have tried so far:
I tried setting the Icon with alacarte
to /usr/share/code/resources/app/resources/linux/code.png
which exists and is the correct icon. The icon within the menu vanishes, the launcher icon when running is still the text editor icon.
I also completely removed the package and then reinstalled Visual Studio Code with no success
How can I assign the correct icon?
Installation: downloaded deb package and installed it using dpkg --install
Contents of desktop file:
[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/bin/code %U
Icon=/usr/share/code/resources/app/resources/linux/code
Type=Application
StartupNotify=true
StartupWMClass=/usr/share/code/resources/app/resources/linux/code.png
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;
Actions=new-window;
X-Desktop-File-Install-Version=0.22
Terminal=false
[Desktop Action new-window]
Name=New Window
Name[de]=Neues Fenster
Name[es]=Nueva ventana
Name[fr]=Nouvelle fenêtre
Name[it]=Nuova finestra
Name[ja]=新規ウインドウ
Name[ko]=새 창
Name[ru]=Новое окно
Name[zh_CN]=新建窗口
Name[zh_TW]=開新視窗
Exec=/usr/bin/code --new-window %U
Icon=/usr/share/code/resources/app/resources/linux/code.png
Output of xprop WM_CLASS
WM_CLASS(STRING) = "code", "Code"
PS: I searched this site and have found a lot of similar questions along with answers, but the answers have not helped
PPS: Created a new user as a test, his icon is correct
About Alacarte
When you edit the icon of a
.desktop
file with Alacarte, Alacarte copies the global.desktop
file to~/.local/share/applications
, and edits that one. Since on the next login the local one will overrule the global one, to fix your issue, you need to manually edit the local one.Alacarte's bug with icon extensions
Alacarte does not handle icons well however if they need to have an extension (like
.png
). This is a known issue; Alacarte simply removes the extension, even if you use the full path to the icon. In your case, Alacarte incorrectly uses:where it should be:
One more issue; incorrect StartupWMClass -line
Also the line:
is incorrect. If the
.desktop
file needs the line to represent the window, it should be:If you fix these two issues, all should work fine :)