suport long lived plugin, and sort top level manually
This commit is contained in:
parent
fca3b25552
commit
593e397b03
12 changed files with 123 additions and 21 deletions
|
|
@ -201,6 +201,15 @@ impl<O: futures::Sink<Response> + Unpin> Service<O> {
|
|||
|
||||
break;
|
||||
}
|
||||
Request::Close => {
|
||||
for (_key, plugin) in self.plugins.iter_mut() {
|
||||
if !plugin.config.long_lived {
|
||||
let tx = plugin.sender_exec();
|
||||
_ = tx.send_async(Request::Exit).await;
|
||||
plugin.sender_drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -465,6 +474,8 @@ impl<O: futures::Sink<Response> + Unpin> Service<O> {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
self.no_sort = query.is_empty();
|
||||
|
||||
for plugin_id in query_queue {
|
||||
if let Some(plugin) = self.plugins.get_mut(plugin_id) {
|
||||
if plugin
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ pub struct PluginConfig {
|
|||
|
||||
#[serde(default)]
|
||||
pub history: bool,
|
||||
|
||||
#[serde(default)]
|
||||
pub long_lived: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Clone)]
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ pub const CONFIG: PluginConfig = PluginConfig {
|
|||
},
|
||||
icon: Some(IconSource::Name(Cow::Borrowed("system-help-symbolic"))),
|
||||
history: false,
|
||||
long_lived: false,
|
||||
};
|
||||
pub struct HelpPlugin {
|
||||
pub id: usize,
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ where
|
|||
self.exit();
|
||||
break;
|
||||
}
|
||||
Request::Close => {
|
||||
self.exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue