Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize icon_for_app_id to avoid reading all desktop files for each new toplevel #119

Open
ids1024 opened this issue Jan 21, 2025 · 0 comments

Comments

@ids1024
Copy link
Member

ids1024 commented Jan 21, 2025

#117 fixed the most glaring issue here, and 8a4d4b6 make sure it at least doesn't block the UI thread, but it's inefficient to iterate over all desktop files for each opened app. I believe desktop_info_for_app_ids was copied from another Cosmic component (perhaps freedesktop-desktop-entry could provide better helpers here, once a better solution is in place).

If we just want to find a desktop file for an app id, we can only open one desktop file (in the first search directory we find it in), but the StartupWMClass comparison requires iterating over all desktop files. Is that needed? Only for XWayland clients? (What does Gnome do, etc?) Maybe it could only try that if it doesn't find an app with that id? I assume even if it's needed, it's okay for that to take lower precedence vs file name app ids...

It could also cache if there are multiple windows with the same app ID. Or cache icon names for all apps, but it should re-check if applications is changed, at least for newly installed apps.

@ids1024 ids1024 changed the title Optimize icon_for_app_id to avoid Optimize icon_for_app_id to avoid reading all desktop files for each new toplevel Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant