Skip to content

plugins/applications: several fixes - #326

Open
mlebloi wants to merge 22 commits into
anyrun-org:masterfrom
mlebloi:applications-plugin
Open

plugins/applications: several fixes#326
mlebloi wants to merge 22 commits into
anyrun-org:masterfrom
mlebloi:applications-plugin

Conversation

@mlebloi

@mlebloi mlebloi commented Aug 11, 2026

Copy link
Copy Markdown
  • Code simplification: remove some useless code repetitions, make some parts shorter, more optimized and, in my opinion, easier to read and understand
  • Fix multiple terminal commands (for Terminal=true desktop entries)
  • Add default support for some major terminal emulators (xterm, konsole, gnome-terminal and terminator)
  • Add a prioritize_actions config option to allow user choosing whether to prioritize actions or not (could not be disabled before)
  • Minor fixes for coherency
    • ensure there is an [applications] prefix before all stderr messages (some of them had it, some didn't)
    • avoid calling std::process::exit() for some errors and not others with no reasons
    • don't discard the preprocess_exec_script stderr output
  • handle .desktop files comments
  • support %% in the Exec= property of .desktop files
  • Add #[serde(default)] to the whole struct Config in order to allow partial config files

It is my first pull request by the way, so please tell me if I do something wrong.

mlebloi added 22 commits August 9, 2026 23:53
Makes this function more generic, accepting any &Path as it doesn't need
an &DirEntry.
The return type has been changed from Result<Vec<_>, Box<dyn Error>> to
Vec<_>, removing the two errors which were both unnecessary:
    1. when the XDG_DATA_DIRS were all empty and
    2. when fs::read_dir("/usr/share/applications") failed.

These cases are now ignored by scrubber(), which seems more coherent as
other fs::read_dir() errors were already ignored, and a warning has been
added to init() when scrubber() finds no desktop entries.
They are unnecessary as State.entries is already a Vec so ordered, we
can use the DesktopEntry index as an id (actually, the id was already
equals to the index, so storing it is useless).

Note: It works only because State.entries doesn't change between
get_matches() and handler(), if it did we would need to store an id,
like before this commit.
Ok, the performance impact is negligible here but the repeated
String::replace()s which create a new String everytime... I couldn't let
it like that.
Split into several functions, avoid repetition...
Defaults to true to not change the default behaviour.
The plugin doesn't exit with failure on other error so, to be coherent,
it shouldn't do it for this error neither.
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.

1 participant