13

There are a few home directory locations that complement /usr locations. Files in these locations override their /usr counterparts. For example:

  • ~/.local/bin complements /usr/bin
  • ~/.local/share/applications complements /usr/share/applications

If I want to override an application, I can create a custom .desktop file and store it in ~/.local/share/applications. This is helpful if I want to tweak how the application is invoked, but overkill if all I want to do is change the icon.

Additionally:

  • if the original .desktop file is non-trivial I either lose the original functionality or need to keep my local copy in-sync
  • I can't modify non-application icons (status icons, etc)

I could modify or maintain icons in /usr/share/icons/hicolor/48x48, but I would prefer to maintain them in my home folder, and these would be fallback icons not overriding icons.

Is there a home folder location that complements /usr/share/icons, where I could store application icons and other icons, and they would override existing theme icons?

For example, I'm using the Papirus theme but I want to use my own icon notepad.svg for the Text Editor application. This icon is defined in /usr/share/applications/org.gnome.gedit.desktop as Icon=gedit. Where should I place notepad.svg?

1

2 Answers 2

20

The historical equivalent is ~/.icons, the XDG equivalent is ~/.local/share/icons (strictly speaking, icons subdirectories of the paths in $XDG_DATA_DIRS). When you specify an icon by name only in a .desktop file, that relies on icon themes, so it’s worth reading the icon theme spec.

Ideally you should use xdg-icon-resource to install icons locally.

3
  • Have you tried using xdg-icon-resource? Or the appropriate subdirectory of ~/.local/share/icons? Nov 16, 2017 at 10:15
  • That’s what it’s supposed to do, yes. By default it installs in the hicolor theme. And yes, “appropriate subdirectory” is THEME/SIZE (but you should just use xdg-icon-resource). Nov 16, 2017 at 10:17
  • I've had a bash at using xdg-icon-resource but I'm not succeeding, so I've updated the question with a concrete example of an app icon replacement, I'll find time tomorrow to expand on my attempts
    – lofidevops
    Nov 16, 2017 at 10:57
3

The xdg-icon-resource program is apparently stupid about "scalable" SVG icons. It requires a --size argument but does not let you specify scalable as the size.

I was trying to get the Alacritty icon to work and here is what did it:

$ mkdir -p ~/.local/share/icons/hicolor/scalable/apps
$ mv /tmp/Alacritty.svg ~/.local/share/icons/hicolor/scalable/apps/

To explain a bit, the "hicolor" theme is the fallback, default parent of most all Gnome themes. You can see its definitions in /usr/share/icons/hicolor/index.theme

You can find your current theme with

$ gsettings get org.gnome.desktop.interface icon-theme
'Yaru'

And you can see how it inherits from hicolor right at the top:

$ head -4 /usr/share/icons/Yaru/index.theme
[Icon Theme]
Name=Yaru
Comment=A desktop adaptation of the Ubuntu mobile icons.
Inherits=Humanity,hicolor

If you are trying to override the icon for a specific theme then you need to put the icon into the directory for that theme because putting it into hicolor would not override it for Yaru, for example.

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.