.desktop file Icon= entry How to ensure the icon is found?
All, I have worked to create a .desktop file for small editor package. The desktop file creates the entry in the menu in the proper category/subcategory, but the icon isn't shown. The minimal .desktop file is: [Desktop Entry] Name=GtKate GenericName=GtKate Text Editor Comment=Open Source-Code & Text Files Exec=gtkate Icon=gtkate Terminal=false Type=Application Categories=Qt;KDE;TextEditor;Utility; MimeType=text/plain; The icon is installed to /usr/share/gtkwrite/img I've noticed some apps use /usr/share/appname/icons Is there some part of the xdg icon search that looks in /usr/share/appname for an "icons" directory? The xdg spec says it will search /usr/share/icons/hicolor/48x48/apps, and makes reference to user defined paths, but doesn't provide a great deal of detail. So would changing (or soft-linking) my .../img directory to an .../icons directory do it? Or would I need to specify the full path to search somewhere? I've tried: Icon=/usr/share/gtkate/img/gtkate but that didn't cause the icon to appear (though I didn't reload anything, I simply changed the .desktop file). Or is hicolor/48x48/apps the way to go? I notice many apps do not put anything there, but their icon still appears in the menu. What's the best way to go here? -- David C. Rankin, J.D.,P.E.
Hello David, Am Samstag, 4. Juni 2022, 09:51:34 CEST schrieb David C. Rankin:
I have worked to create a .desktop file for small editor package. The desktop file creates the entry in the menu in the proper category/subcategory, but the icon isn't shown. The minimal .desktop file is:
[Desktop Entry] Name=GtKate GenericName=GtKate Text Editor Comment=Open Source-Code & Text Files Exec=gtkate Icon=gtkate Terminal=false Type=Application Categories=Qt;KDE;TextEditor;Utility; MimeType=text/plain;
The icon is installed to /usr/share/gtkwrite/img
I've noticed some apps use /usr/share/appname/icons
Hm, not sure that is required. Did you try: mkdir -p %{buildroot}%{_datadir}/pixmaps cp <path>/gtkate.png %{buildroot}%{_datadir}/pixmaps/gtkate.png (for example?) HTH Axel
Hm, not sure that is required. Did you try:
mkdir -p %{buildroot}%{_datadir}/pixmaps
cp <path>/gtkate.png %{buildroot}%{_datadir}/pixmaps/gtkate.png
No I haven't, Thank you, I'll give that a go. I seems my search for the xdg icon spec should have been an rpmbuild search for the correct .spec file handling of it. Also, sorry my replies break threading. I have to use https://lists.opensuse.org/archives/list/packaging@lists.opensuse.org to see and reply to my list messages. My ISP has broken mail handling that bounces all mails from the new lists.opensuse.org (all of them, users, factory, packaging, etc..) I get some through and some bounce depending on which mail-host they hit first at my ISP. Per thought he had a work-around, and I get some messages, but not all. So that's why I break threading :( -- David C. Rankin, J.D.,P.E.
Am 04.06.22 um 09:51 schrieb David C. Rankin:
The icon is installed to /usr/share/gtkwrite/img
I've noticed some apps use /usr/share/appname/icons
Is there some part of the xdg icon search that looks in /usr/share/appname for an "icons" directory?
Not aware of anything like that, but it might be possible.
The xdg spec says it will search /usr/share/icons/hicolor/48x48/apps, and makes reference to user defined paths, but doesn't provide a great deal of detail.
That would be the usual way. You probably came across [1] where it recommends that. It depends on the type of image though. This directory should contain 48x48 .png images. If it's a different resolution, put it in the respective directory for that resolution.
So would changing (or soft-linking) my .../img directory to an .../icons directory do it?
Better link single files, in case that directory might gather other files later on.
Or would I need to specify the full path to search somewhere? I've tried:
Icon=/usr/share/gtkate/img/gtkate
but that didn't cause the icon to appear (though I didn't reload anything, I simply changed the .desktop file).
Not so ideal, for example it wouldn't allow overriding the icon in a theme. (At least to my knowledge.)
Or is hicolor/48x48/apps the way to go? I notice many apps do not put anything there, but their icon still appears in the menu.
They might have other resolutions, which are then scaled up/down. It's also possible to provide vector images (.svg). Aaron [1] https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-lates...
On 6/4/22 17:21, David C. Rankin wrote:
All,
I have worked to create a .desktop file for small editor package. The desktop file creates the entry in the menu in the proper category/subcategory, but the icon isn't shown. The minimal .desktop file is:
[Desktop Entry] Name=GtKate GenericName=GtKate Text Editor Comment=Open Source-Code & Text Files Exec=gtkate Icon=gtkate Terminal=false Type=Application Categories=Qt;KDE;TextEditor;Utility; MimeType=text/plain;
but that didn't cause the icon to appear (though I didn't reload anything, I simply changed the .desktop file).
Or is hicolor/48x48/apps the way to go? I notice many apps do not put anything there, but their icon still appears in the menu.
What's the best way to go here?
If you plan to ship multiple icons of different size or an svg then putting it in the hicolor theme is the best solution, generally you should probably ship atleast 2-3 because desktops will commonly use something like 16px in the window border and these days may also use a 256px or larger in places (think gnome shell etc) generally using a single size won't look good in all these places. As Axel said if your only using a single file the xdg standards also state that they will fall back to searching /usr/share/pixmaps as a final option so if your sticking with the single image for now that is your best bet and there are still some applications doing this. -- Simon Lees (Simotek) http://simotek.net Emergency Update Team keybase.io/simotek SUSE Linux Adelaide Australia, UTC+10:30 GPG Fingerprint: 5B87 DB9D 88DC F606 E489 CEC5 0922 C246 02F0 014B
participants (4)
-
Aaron Puchert
-
Axel Braun
-
David C. Rankin
-
Simon Lees