From fa671ebd7739ae016b4e78e6e1633960094ef8a6 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Thu, 26 Mar 2026 18:40:23 +0100 Subject: [PATCH] feat: dynamic prefix fallback for user plugin prefixes (e.g. :hs for hyprshutdown) --- crates/owlry-core/src/filter.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/owlry-core/src/filter.rs b/crates/owlry-core/src/filter.rs index f90ce8b..0ec34bd 100644 --- a/crates/owlry-core/src/filter.rs +++ b/crates/owlry-core/src/filter.rs @@ -360,6 +360,28 @@ impl ProviderFilter { } } + // Dynamic plugin prefix fallback: ":word " or ":word" where word is unknown + // Maps to Plugin(word) so user plugins with custom prefixes work + if let Some(rest) = trimmed.strip_prefix(':') { + if let Some(space_idx) = rest.find(' ') { + let prefix_word = &rest[..space_idx]; + if !prefix_word.is_empty() && prefix_word.chars().all(|c| c.is_alphanumeric() || c == '-' || c == '_') { + return ParsedQuery { + prefix: Some(ProviderType::Plugin(prefix_word.to_string())), + tag_filter: None, + query: rest[space_idx + 1..].to_string(), + }; + } + } else if !rest.is_empty() && rest.chars().all(|c| c.is_alphanumeric() || c == '-' || c == '_') { + // Partial prefix (no space yet) + return ParsedQuery { + prefix: Some(ProviderType::Plugin(rest.to_string())), + tag_filter: None, + query: String::new(), + }; + } + } + let result = ParsedQuery { prefix: None, tag_filter: None,