ice-wm / icewm

IceWM releases only, see Wiki
https://github.com/ice-wm/icewm/releases
Other
289 stars 16 forks source link

Missing icons and patch #132

Closed realsimix closed 1 year ago

realsimix commented 1 year ago

Hi,

While running on RHEL9 I found that some icons were missing which were available on RHEL8. I then found how icons are searched and modified it for newer distributions. I also looked at this https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#context to find out about some new specifications.

Find attached my patch which corrects the issues for me. icewm-3.3.4-icon_contexts.patch.txt

Regards, Simon

Code7R commented 1 year ago

Looks trivial but I am wondering which kind of menu entries were affected. Could add some test examples, i.e. the .desktop files which ended have rendered without an icon?

Code7R commented 1 year ago

@gijsbert I added something similar and reworked it a bit, using find_if instead of the "strchr" optimization, see:

https://github.com/bbidulock/icewm/pull/new/feature/lookup-more-icon-sections

That said, it still did not work everywhere. I expected this to fix the loading of the keyboard icons (loading icons from iso-flags-svg package). But this reveals another strange issue - the icon for the first of KeyboardLayouts languges is drawn as a black box, and for the other ones it does not work and only text is drawn. There is no attempt to load their icons.

gijsbers commented 1 year ago

Thanks @Code7R.

@realsimix Could you give examples of icons (and their paths) which couldn't be found, but can now?

Do really all those directories have to be added? All these directory searches slow icewm down.

realsimix commented 1 year ago

Hi,

I have now tested with only adding legacy/ and it makes things work for me as well.

This is without patch: unpatched This is with legacy/ added: with_legacy

Do you want me to test with the patch you mentioned above?

realsimix commented 1 year ago

I've just tested your commit 2f2afd9 and can confirm that it also fixes the issue. Thanks!

gijsbers commented 1 year ago

Does it now also show icons for Firefox, Sound & Video and Video in your menu? If you set Trace=icon in your preferences and restart, you'll see where it finds the icons. That would be helpful to identify which directories are actually needed.

realsimix commented 1 year ago

No, the Firefox and other icons are not shown with the patch. This is on RHEL9 with a icewm build similar to the one in EPEL which adds an Adwaita theme to the package. So it's not a vanilla icewm and I also don't know if all required packages are installed on the test host :(

One thing I can say is that the Firefox package on RHEL9 only provides the following icons:

/usr/share/icons/hicolor/16x16/apps/firefox.png
/usr/share/icons/hicolor/22x22/apps/firefox.png
/usr/share/icons/hicolor/24x24/apps/firefox.png
/usr/share/icons/hicolor/256x256/apps/firefox.png
/usr/share/icons/hicolor/32x32/apps/firefox.png
/usr/share/icons/hicolor/48x48/apps/firefox.png
/usr/share/icons/hicolor/symbolic/apps/firefox-symbolic.svg

So, as long as icewm is not using /usr/share/icons/hicolor/ to find icons it won't fine the Firefox icons.

Looking at the code I found this in the docs: IconPath = /usr/share/icons/hicolor:/usr/share/icons:/usr/share/pixmaps

and this:

./icewm-3.3.4/src/yprefs.h:
XSV(const char *, iconPath,
                                                "/usr/local/share/icons:"
                                                "/usr/local/share/pixmaps:"
                                                "/usr/share/icons:"
                                                "/usr/share/pixmaps:"

and this:

./icewm-3.3.4/src/testmenus.cc:
    iconPath = "/usr/share/icons/crystalsvg/48x48/apps/:/usr/share/icons/Bluecurve/16x16/apps/:/usr/share/pixmap";

Needless to say this icon and theme handling is a bit a mystery to me.

gijsbers commented 1 year ago

I agree it is a bit complex. There are icon base directories set in IconPath and allowable theme subdirectories in IconThemes.

IconPath="/usr/local/share/icons:/usr/local/share/pixmaps:/usr/share/icons:/usr/share/pixmaps:"
IconThemes="*:-HighContrast"

Is the default and looks OK to me. You can install more icon themes to your liking. Do yum search icon-theme and choose what you like. E.g., gnome-icon-theme seems to have more icons.

realsimix commented 1 year ago

Finally I found out what happens. For the Firefox icon the solution is simple: The menu file asks for an icon called mozilla which doesn't exist on RHEL9 anymore and should simply be called firefox:

--- icewm-3.3.4/lib/menu.in.orig    2023-05-03 12:39:53.000000000 +0200
+++ icewm-3.3.4/lib/menu.in 2023-05-10 11:07:02.070417643 +0200
@@ -7,7 +7,7 @@ prog "@XTERMCMD@" xterm @XTERMCMD@
 prog urxvt xterm urxvt -bg black -cr green -fg white -C -sl 500
 prog gedit fte gedit
 prog NEdit nedit nedit
-prog Firefox mozilla firefox
+prog Firefox firefox firefox
 prog Hexchat xchat hexchat
 prog Gimp gimp gimp
 includeprog icewm-menu-fdo --sep-before --no-sep-others

The other issue with the Sound & Video menu is a missing icon in the default theme (applications-multimedia). I don't care about it for now.

Thanks for your help!