Skip to content

Conversation

ljrk0
Copy link

@ljrk0 ljrk0 commented Apr 20, 2025

Since pop-launcher has been demonized, the desktop_entries plugin isn't relaunched on every search anymore. In consequence, it is not providing up-to-date results when .desktop files have changed (e.g., on un-/installation of a new application) anymore.

Move the app.reload() call into the request loop to trigger a re-index. In a release-build this has been fine performance wise on an 8th Gen i5 laptop device.

Alternatives could include remembering the last time the index was built (initialised to UNIX_EPOCH before the loop) and only conditionally triggering a re-index after a hot-period of 10s since the last run. In our testing this didn't result in any noticeable difference.

NOTE: This has been tested against commit fca3b25 but builds against master too. However, master error'ed with unrelated issues regarding the parsing of CLI arguments.

@Drakulix Drakulix requested a review from a team April 21, 2025 07:46
Copy link
Member

@mmstick mmstick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be better to reload only on an empty search query

@ljrk0 ljrk0 force-pushed the desktop-entries-rebuild branch from 387a8b8 to debc2f7 Compare May 25, 2025 18:25
Since pop-launcher has been demonized, the desktop_entries plugin isn't
relaunched on every search anymore. In consequence, it is not providing
up-to-date results when .desktop files have changed (e.g., on
un-/installation of a new application) anymore.

Move the app.reload() call into the request loop to trigger a re-index.
In a release-build this has been fine performance wise on an 8th Gen i5
laptop device. As a small performance improvement, only trigger this update
on a search event and if the search query is empty.

Alternatives could include remembering the last time the index was built
(initialised to UNIX_EPOCH before the loop) and only conditionally
triggering a re-index after a hot-period of 10s since the last run. In
our testing this didn't result in any noticeable difference.
@ljrk0 ljrk0 force-pushed the desktop-entries-rebuild branch from debc2f7 to cfaa866 Compare May 25, 2025 18:26
@ljrk0
Copy link
Author

ljrk0 commented May 25, 2025

Implemented the requested change + rebased ontop of master, but I cannot reproduce the issue since #270 got merged(?). At least not on fedora with ryan's copr pop-launcher package (nightly).

The new behavior seems that the desktop_entries plugin doesn't reload the .desktop entries anymore, so this behavior is still the same as before:

$ /usr/libexec/pop-launcher/plugins/desktop_entries/desktop-entries
# now install vlc
{ "Search": "vlc" }
# doesn't find vlc

But it seems that the pop-launcher now does some magic to fix this when actually running the launcher itself?

If I understand this correctly, then this PR can be closed?

@wiiznokes
Copy link
Contributor

iirc, a plugin will only be "demonized" when they have long_lived in their manifest (ex: cosmic_toplevel, https://github.com/pop-os/launcher/blob/master/plugins/src/cosmic_toplevel/plugin.ron#L7).
So, the desktop_entries plugin will be reloaded every time cosmic-launcher is shown.

@wiiznokes
Copy link
Contributor

You could also add a watcher on the .desktop dirs. Idk if its better performance wise

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

Successfully merging this pull request may close these issues.

3 participants