1

I have installed VSCode in Ubuntu. I wanna change icon. For this I go to the /usr/share/applications/ and try change Visual Code Studio.desktop with content:

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/share/code/code --no-sandbox --unity-launch %F
Icon=com.visualstudio.code
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;
Actions=new-empty-window;
Keywords=vscode;

X-Desktop-File-Install-Version=0.23

[Desktop Action new-empty-window] Name=New Empty Window Exec=/usr/share/code/code --no-sandbox --new-window %F Icon=com.visualstudio.code

What mean path to the icon like this Icon=com.visualstudio.code? How change the icon?

West Side
  • 175
  • 8
  • The normal icon is in /usr/share/pixmaps/com.visualstudio.code.png. Just drop another .png file into the same place, and then edit the .desktop icon= lines (there are two). – heynnema Jul 12 '20 at 19:02

1 Answers1

1

Current icon reference, com.visualstudio.code, only specifies the name of the icon. The system accordingly will look in default locations (~/.icons, ~/local/share/icons, /usr/share/pixmaps, icon folders of current icon themes, ...) for a graphics file with that name and the extension png or svg or xpm. Instead, you can also specify the full file path of a specific icon file to unambiguously define the icon, even if you change icon themes, as in (hypothetical example):

Icon=/home/user/.local/share/icons/com.visualstudio.code.png

You need to make sure the icon file is readable by all intended users if you specify a full file path.

vanadium
  • 88,010
  • The problem with this method is, what if a different "user" tries to start VSCode, they'll get a permissions error as the icon file is in another user's directory path, and/or the icon will not be visible. – heynnema Jul 15 '20 at 22:20
  • Good remark, I will add this caveat in the answer. – vanadium Jul 16 '20 at 07:35