feat: dynamic prefix fallback for user plugin prefixes (e.g. :hs for hyprshutdown)

This commit is contained in:
2026-03-26 18:40:23 +01:00
parent d63c7d170b
commit fa671ebd77

View File

@@ -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,