suport long lived plugin, and sort top level manually

This commit is contained in:
wiiznokes 2024-07-03 03:42:39 +02:00 committed by Ashley Wulber
parent fca3b25552
commit 593e397b03
12 changed files with 123 additions and 21 deletions

View file

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

View file

@ -30,6 +30,9 @@ pub struct PluginConfig {
#[serde(default)]
pub history: bool,
#[serde(default)]
pub long_lived: bool,
}
#[derive(Debug, Default, Deserialize, Clone)]

View file

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

View file

@ -60,6 +60,9 @@ where
self.exit();
break;
}
Request::Close => {
self.exit();
}
}
}