onagre-launcher / onagre

A general purpose application launcher for X and wayland inspired by rofi/wofi and alfred
MIT License
511 stars 27 forks source link

All Icons render as gray diamonds with question marks #71

Closed Palladinium closed 4 months ago

Palladinium commented 6 months ago

Describe the bug All Icons render as gray diamonds with question marks

Config No config, fresh install

To Reproduce Fresh install of Onagre on Sway on a not-so-fresh Arch Linux install.

Expected behavior Icons render correctly

Screenshots 20231221_23h15m44s_grim

Window manager (please complete the following information): Sway on Wayland

Additional context Tried both the version on the AUR and building from source with cargo --install, but I couldn't build off of git with the following error:

error[E0432]: unresolved import `cctk::sctk::event_loop`
 --> /home/patrick/.cargo/git/checkouts/launcher-7ded99f59e6d425d/b1f6002/plugins/src/cosmic_toplevel/toplevel_handler.rs:5:9
  |
5 |         event_loop::WaylandSource,
  |         ^^^^^^^^^^ could not find `event_loop` in `sctk`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `pop-launcher-plugins` (lib) due to 1 previous error

This appears different from the issue described in the FAQ entry https://github.com/oknozor/onagre/wiki/Troubleshooting#icon-are-not-rendered, because icons are rendered - they're just all question marks. I tried setting WGPU_BACKEND=vulkan just in case, but it didn't help.

oknozor commented 6 months ago

try to build from git with --locked

Palladinium commented 6 months ago

Ah yep, I should have remembered to try --locked, it builds successfully now - same behaviour.

I did figure it out in the end, this turned out to be a configuration problem on my end. I managed to track it down to a freedesktop_icons lookup. For some reason, every icon is being looked up in the Papirus theme even though I've never had it installed and I can't find where I've set it as my theme. As soon as I installed it, all icons started working.

Palladinium commented 6 months ago

I take it back, it is an issue with onagre defaults: https://github.com/oknozor/onagre/blob/a7628b1d907e9e714197141c87adc2458c7bb7f3/src/app/style/mod.rs#L91-L92

From skimming the freedesktop icons spec, this line stands out:

In order to have a place for third party applications to install their icons there should always exist a theme called "hicolor" [1]. The data for the hicolor theme is available for download at: http://www.freedesktop.org/software/icon-theme/. Implementations are required to look in the "hicolor" theme if an icon was not found in the current theme. [1] This name is chosen for backwards compatibility with the old KDE default theme

I do have the hicolor icon theme, so the icons should be working even without installing Papirus. Sure enough, if I change that line to "hicolor" instead of "Papirus", icons work without having Papirus installed. Most of them do at least, category icons don't seem to exist in hicolor, which makes sense since it's seems like it's mainly meant for applications to put their own icons into.

I think this is a two-faceted issue:

  1. onagre should probably have a better method to find a valid icon theme for the default style - I'm not sure what just setting the default to hicolor does to other environments. Otherwise, maybe just mention in the README or FAQ that the default theme requires the Papirus icon theme and leave it up to the user to either install it, or change their config to use a different theme.
  2. Should freedesktop_icons be falling back to hicolor if the queried theme isn't installed at all? The freedesktop icons spec seems to avoid the issue of what an implementation should do if the "current theme" doesn't actually exist.
oknozor commented 5 months ago

Hey @Palladinium I made some recent changes to the freedesktop icons crate which might fix this issue. Can you confirm this is fixed using the latest version (cargo install --git https://github.com/onagre-launcher/onagre).

Palladinium commented 5 months ago

Same issue with the git version from feb32494 - if I uninstall the Papirus theme, application icons fail to be found.

Looking at your changes in freedesktop-icons, the fallbacks you've added look good but they miss the case where the selected theme (Papirus) doesn't exist, rather than existing but not containing the requested icon.

It's an easy fix, so I opened a PR. Rebuilding onagre against it fixes this issue.

oknozor commented 4 months ago

This is now fixed thanks to @Palladinium contribution on https://github.com/oknozor/freedesktop-icons/pull/14 Thanks a lot :rocket: