pub struct PluginHost { /* private fields */ }Expand description
All discovered plugins.
Implementations§
Source§impl PluginHost
impl PluginHost
Sourcepub fn discover() -> Self
pub fn discover() -> Self
Discover plugins in Self::roots.
Sourcepub fn roots() -> Vec<PathBuf>
pub fn roots() -> Vec<PathBuf>
Where plugins are discovered, in shadowing order: the user’s data
directory, then the system data directories ($XDG_DATA_DIRS, so
distro packages under /usr/share/jump/plugins are picked up with no
configuration).
The user’s directory is searched first and wins on an id collision, so
copying a packaged plugin into ~/.local/share/jump/plugins to modify
it shadows the packaged one rather than duplicating it.
Sourcepub fn discover_in(roots: &[PathBuf]) -> Self
pub fn discover_in(roots: &[PathBuf]) -> Self
Discover plugins under roots, earlier roots shadowing later ones.
Directories without a readable manifest are skipped with a warning; a malformed plugin must never prevent the launcher from starting.
Sourcepub fn replace_plugins(&mut self, discovered: Self) -> bool
pub fn replace_plugins(&mut self, discovered: Self) -> bool
Take the plugins from a fresh discovery, keeping the user’s disabled set and keyword overrides, which belong to settings rather than to what is on disk. Returns whether the plugin set actually changed.
Sourcepub fn set_disabled<I, S>(&mut self, ids: I)
pub fn set_disabled<I, S>(&mut self, ids: I)
Replace the set of switched-off plugins, e.g. when settings change.
Sourcepub fn set_keyword_overrides<I, K, V>(&mut self, overrides: I)
pub fn set_keyword_overrides<I, K, V>(&mut self, overrides: I)
Replace the keyword overrides, e.g. when settings change.
Sourcepub fn effective_keyword<'a>(&'a self, plugin: &'a Plugin) -> Option<&'a str>
pub fn effective_keyword<'a>(&'a self, plugin: &'a Plugin) -> Option<&'a str>
The keyword plugin currently answers to: the user’s override when
one exists (empty meaning “no keyword”), else the manifest’s.
Sourcepub fn all(&self) -> impl Iterator<Item = (&Plugin, bool)>
pub fn all(&self) -> impl Iterator<Item = (&Plugin, bool)>
Every discovered plugin, the switched-off ones included, with whether each is currently enabled. This is the settings window’s list.
Sourcepub fn get(&self, id: &str) -> Option<&Plugin>
pub fn get(&self, id: &str) -> Option<&Plugin>
Look up an enabled plugin. Activation goes through here, so a plugin disabled between query and click does nothing rather than running.
Sourcepub async fn query(&self, text: &str) -> QueryResults
pub async fn query(&self, text: &str) -> QueryResults
Query every plugin that matches, concurrently.
Plugins run in parallel and share the same deadline, so total latency is the slowest matching plugin rather than the sum.
Sourcepub fn is_claimed(&self, text: &str) -> bool
pub fn is_claimed(&self, text: &str) -> bool
Whether a keyworded plugin claims this query, meaning pop-launcher results should be suppressed.