anyrun-org / anyrun

A wayland native, highly customizable runner.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to make plugin prefix get matches exlusively

abenz1267 opened this issue · comments

Hi,

i noticed that while several plugins do have the option to have prefixes, Anyrun currently goes over all plugins configured anyways. As in:

  1. plugin configured with "!", f.e. shell
  2. i type in "!" and get websearch as a result

Expected behaviour would be that you only get matches from plugins that have the prefix "!".

I've tried looking into this myself, but i'd need way more time as i don't fully grasp some Rust stuff for now.

I thought you might be able to provide a "quick" fix.

From what i gathered there needs to be a new #[proc_macro_attribute] ... maybe get_prefix.... that can be used to skip irrelevant plugins in main.rs:870 refresh_matches.

What do you think? Maybe there's a better solution, i'm way not familar with Rust to determine that.

Regards

A method where plugins provide the prefix in PluginInfo would work, but it would compromise on the freedom that plugins have to work in basically any way they want. This approach is a bit of a double edged sword, as it means that every plugin has to implement common elements like prefix matching themselves but I think the separation is best to be here.

A way to improve this (and a way to generally reduce code duplication) could be creating more macros/other helper code that could be feature gated in the anyrun-plugin crate, for the plugins that have a "standard" approach.