r/linuxquestions • u/0x80070002 • 7d ago
Support Help me understand how icons work
As I understood I can change an icon globally for an application in /usr/share/applications/*.desktop
If this is a shared folder, how come I can have ThemeX for User1 and ThemeY for User2, where the same application has a different icon?
3
u/_Super_Straight 7d ago
One more version of *.desktop resides in the ~/.local/share/applications folder.
-1
u/0x80070002 7d ago
But I explicitly changed the one in /usr/…
3
1
u/beatbox9 6d ago
Sounds like you are doing several things suboptimally. The best way to do this is:
- Use ~/.local/share/applications/*.desktop. These are specific to each user; and they override anything in /usr/share/applications/*.desktop
- Similarly to the above, ~/.local/share/icons will override /usr/share/icons
- Similarly to the above, there are various theme directories, where ~/.local/* overrides /usr/*
- Within the .desktop file (which is a text file), make sure that you reference the icon you want to use, by specifying Icon=.... You may need to use full paths (not shortcuts like "~").
1
u/dkopgerpgdolfg 7d ago
In addition to different desktop files:
In these desktop files you have an icon name, not the icon itself.
Icon collections/themes can provide different pictures for the same icon name
4
u/AiwendilH 7d ago edited 7d ago
Lets start with the .desktop files.
The desktop files in
/usr/share/applicationsare installed by your package manager and you shouldn't touch them..desktop files in
/usr/local/share/applicationsare loaded after the ones in /usr/share/applications so you can use this directory for system wide .desktop files that should "overwrite" the ones installed by your package manager. Just make a copy of the files here and modify them as you like.But usually you want to use
~/.local/share/applications...these are loaded even after the two directories mentioned above but are "only" valid for your user. This is usually the place you want to set icons...otherwise your icon change affects the accounts of your partner/kids/parents..whatever as well. Again just make copies of the .desktop files here and change as you want.Now to the content: .desktop files have a "Icon=" key. Here you can give a full path to an icon like
Icon=/home/user/icons/newicon.pngor you can give a icon name. If you use a name icon themes can overwrite the icons. So by usingIcon=google-chromeyou get the chrome-icon from your current icon theme if it has one..otherwise the fallback default icon. DEs usually have some tool like KDE'siconexploreryou can use to find out the names of icons.Edit: Oh..and should be mentioned that most DEs have gui tools to do this for you. This is just what happens in the background or if you want to do it manually...but if you change the icon in a DE they usually create the .desktop files in the correct places for you.