feat: Allow plugins to signal to deactivate themselves
Necessary when a plugin is unsupported
This commit is contained in:
parent
5ce96c624b
commit
6efad71f0e
3 changed files with 14 additions and 2 deletions
|
|
@ -25,7 +25,11 @@ impl Type for Item {
|
|||
pub async fn main() {
|
||||
let connection = match Connection::new_session() {
|
||||
Ok(conn) => conn,
|
||||
Err(_) => return,
|
||||
Err(_) => {
|
||||
let mut out = async_stdout();
|
||||
let _ = crate::send(&mut out, PluginResponse::Deactivate);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let mut app = App::new(connection, async_stdout());
|
||||
|
|
|
|||
|
|
@ -139,6 +139,12 @@ impl<O: Write> Service<O> {
|
|||
gpu_preference,
|
||||
});
|
||||
}
|
||||
|
||||
// Report the plugin as finished and remove it from future polling
|
||||
PluginResponse::Deactivate => {
|
||||
self.finished(plugin).await;
|
||||
let _ = self.plugins.remove(plugin);
|
||||
}
|
||||
},
|
||||
|
||||
// When a plugin has exited, the sender attached to the plugin will be dropped
|
||||
|
|
|
|||
|
|
@ -72,11 +72,13 @@ pub enum PluginResponse {
|
|||
Clear,
|
||||
/// Close the launcher.
|
||||
Close,
|
||||
// Additional options for launching a certain item
|
||||
// Additional options for launching a certain item.
|
||||
Context {
|
||||
id: Indice,
|
||||
options: Vec<ContextOption>,
|
||||
},
|
||||
/// Instruct the launcher service to deactivate this plugin.
|
||||
Deactivate,
|
||||
// Notifies that a .desktop entry should be launched by the frontend.
|
||||
DesktopEntry {
|
||||
path: PathBuf,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue