1

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

  • How did you install it? – Nuwan Thisara Jun 29 '16 at 13:30
  • note that Alacarte removes the .png extension when editing the icon. (bug) could you post the content of its launcher? (open with gedit) and run xprop WM_CLASS in a terminal, then click on the window of visual studio, post the output as well? – Jacob Vlijm Jun 29 '16 at 13:32
  • @Nuwan I used the deb package for x64 – Sascha Jun 29 '16 at 16:25
  • @JacobVlijm I edited the question to include the requested informations – Sascha Jun 29 '16 at 16:30
  • @JacobVlijm After posting the content I noticed it seems line properties are exchanged. I test and post the result – Sascha Jun 29 '16 at 16:33
0

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:

Icon=/usr/share/code/resources/app/resources/linux/code

where it should be:

Icon=/usr/share/code/resources/app/resources/linux/code.png

One more issue; incorrect StartupWMClass -line

Also the line:

StartupWMClass=/usr/share/code/resources/app/resources/linux/code.png

is incorrect. If the .desktop file needs the line to represent the window, it should be:

StartupWMClass=code

If you fix these two issues, all should work fine :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.