2

Recently Sublime Text 3 came out (finally out of beta!). The new version has a new icon. However when I upgraded, I still have the old icon in the launcher.

How can I fix it?

3

in /usr/share/applications you will see the .desktop file for sublime. Open it and change the path of the icon.

I prefer using alacarte, wherein I can directly change the icon from a GUI. Launch alacarte by typing alacarte. If you dnt have it then sudo apt-get install alacarte.

But I guess, for just one single application, I think it is good to edit the .desktop file manually. Remember there are many icons for sublime and the 48*48 fits the best.

  • Where I can locate the new icon? – becko Oct 5 '17 at 14:52
  • 1
    @becko whereever_youhave_installed_sublime/sublime_text_3/Icon/48x48/sublime-text.png – infoclogged Oct 5 '17 at 17:47
0

I was dissatisfied with @infoclogged's answer, since the solution seems hacky and the answer doesn't explain why this is happening in the first place, so I dug into this a bit further.

Themed Icons

In Ubuntu Budgie, and possibly other Ubuntu flavors, Gnome uses an icon theme that includes replacement icons for Sublime Text, Firefox, Thunderbird, and other popular applications. These replacement icons are used instead of the icon packaged with the current version of Sublime Text (and other respective programs).

As noted, /usr/share/applications/sublime_text.desktop refers to an icon named sublime-text. The path and file extension are filled in by Gnome, based on the theme and the size of the icon.

Sizing

If you use find you'll notice that there are multiple copies of the Sublime Text icon in different sizes. These are automatically selected by Gnome depending on your desktop resolution, DPI, and the size of the UI element that is using the icon (menu, dock, tray icons, etc.).

$ find / -name sublime-text.png 2>/dev/null

/usr/share/icons/hicolor/48x48/apps/sublime-text.png
/usr/share/icons/hicolor/128x128/apps/sublime-text.png
/usr/share/icons/hicolor/256x256/apps/sublime-text.png
...
/usr/share/icons/Moka/48x48/apps/sublime-text.png
/usr/share/icons/Moka/64x64/apps/sublime-text.png
...
/opt/sublime_text/Icon/48x48/sublime-text.png
/opt/sublime_text/Icon/16x16/sublime-text.png
/opt/sublime_text/Icon/128x128/sublime-text.png
/opt/sublime_text/Icon/256x256/sublime-text.png
/opt/sublime_text/Icon/32x32/sublime-text.png

Gnome Icon Themes

On my system, which uses Ubuntu Budgie 18.04, the default Gnome theme is Pocillo, and the default icon set is based on Moka. You'll notice if you open the relevant files that Moka provides the "rounded square" icon style for Sublime Text, alongside similar replacement icons for many popular apps like Firefox and Thunderbird. This is where the errant icon is coming from.

Changing the Icon

There are a few ways to use the packaged icon:

  1. Edit the .desktop file to use a full path to a specific file as @infoclogged suggested, though this breaks the sizing code mentioned earlier.
  2. Change your icon theme using the gnome-tweaks tool found in the gnome-tweak-tools package so the vendor's packaged icons are used, instead of the theme's icons.
  3. Edit the theme / delete the theme's Sublime Text icon files, though this will likely break if the theme is updated.
  4. Convince upstream not to ship ugly icons for Sublime Text. This may already be done.

The "correct" way to solve this is to change your icon theme. This uses the built-in features of Gnome, and should continue to work across OS upgrades, package un/re/installs, etc. However, you can also apply a surgical change by editing the .desktop file or deleting the sublime text icons from your theme — just don't be surprised if those changes poof during a package update in the future.

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.