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

caching of application icons #84

Open Rairosu opened 1 month ago

Rairosu commented 1 month ago

Currently application icons are not being cached, which results in onagre microfreezing everytime I try to search for an application.

If there is no specific reason against caching those icons, I would like those icons to be cached.

oknozor commented 1 month ago

There is a first query to build the icon index then its cached on every subsequent request:

https://github.com/onagre-launcher/onagre/blob/543f1fe827f4b16408cdcc07c19fb839741ca0f5/src/icons/mod.rs#L85

That said, in the current implementation, the cache still need to be loaded on every start.

We could store this in db to make it available on next launch. Note that it has the potential to be out of sync if the user uninstall or add new desktop entries, change their theme etc.

A correct implementation should greedily load the cache on start, then fetch the up to date icon index in the background and replace the current cache with actual runtime values.

PRs welcome :)

Rairosu commented 1 month ago

I looked at this line already and my point is that it is missing for the else case, but i didn't want to submit a pr for one line of code. The idea of storing it in the db sounds nice, as it still stutters on startup a bit, even with caching all icons, maybe i get around to doing a pr for that ^^