Page 1 of 1

[SOLVED]Where are the Icons for Desktop Shortcuts stored?

PostPosted: May 22nd, '18, 19:38
by banjo
I installed the program "mc" and created a desktop shortcut to it. I could not find the icon for the program, so I created a placeholder icon and called it "mc.svg" and put it into the folder /usr/share/icons/hicolor/scalable/apps/. After I did that, the icon showed up in the dialog box invoked from the Properties dialog of the .desktop file. After selecting it, it showed up in the desktop shortcut. So far so good. It wasn't the correct icon, but it showed up.

Here is where it gets nutty.

I went to another system and found the real mc.svg file, so I replaced the the mc.svg placeholder that I created with the real one. But the old one still showed up in the shortcut. The only mc image that I can find in the system is my mc.svg file, which no longer contains that old image. I have created a new .desktop shortcut to see if the problem persisted after starting from scratch, but when I select mc.svg in the dialog box, it still shows the old icon. As far as I can tell, I have completely removed the old mc.svg file from the system, so I am confused about where Plasma is getting the old image.

The desktop file identifies the image only as "Icon=mc".

Code: Select all
Desktop Entry]
Comment[en_US]=
Comment=
Exec=konsole -e mc
GenericName[en_US]=
GenericName=
Icon=mc
MimeType=
Name[en_US]=MC IconTest
Name=MC IconTest
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=


Plasma must have squirreled away the original image somewhere and is using that image instead of the original. It must still have the old image, or it could not be showing it.

To test this, I copied mc.svg into mc-real.svg and then selected the mc-real icon for the shortcut, and the new icon appears. But then, if I go back to mc.svg, the old icon is back. According to kdiff3, he two files mc.svg and mc-real.svg are identical. The old image is not there.

mc-compare.png
Kdiff3 comparison of mc.svg and mc-real.svg
mc-compare.png (142.52 KiB) Viewed 1345 times


So, does anyone know where Plasma is keeping a copy of that old icon? I would like to reset it, but I cannot find it.

BTW, this is not something that I need to fix, but I am curious about how this software works.

Thanks,
Banjo
(_)=='=~

Re: Where are the Icons for Desktop Shortcuts stored?

PostPosted: May 23rd, '18, 03:41
by banjo
OK. Nevermind. I found it.

The icons appear to be stored in ~/.cache/icon-cache.kcache

I moved that file into ~/.cache/icon-cache.kcache.cya, then I logged out and logged back in, and the new icon was in the shortcut. The icon-cache.kcache file was restored with the new data when I logged back in.

From what I have read, it appears that the icon-cache is used to avoid tons of disk reads to get that information. So in order to change the image after changing an icon image file, just delete the cache and it will be restored with the new image in it.

Banjo
(_)=='=~

Re: [SOLVED]Where are the Icons for Desktop Shortcuts stored

PostPosted: May 23rd, '18, 18:38
by doktor5000
The actual icons (not the cache) are stored in quite a few places. See the Icon key in https://standards.freedesktop.org/deskt ... 01s06.html which links to https://specifications.freedesktop.org/ ... atest.html

Re: [SOLVED]Where are the Icons for Desktop Shortcuts stored

PostPosted: May 23rd, '18, 18:50
by banjo
doktor5000,

Thank you for the links to the documentation. I will go study it.

Banjo
(_)=='=~