diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-01-17 12:10:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-17 12:10:49 +0100 |
| commit | d780bd91052d8282ba5a7f06c6fb7faa7ca7cc18 (patch) | |
| tree | ca08219a38b9e6a3b1c027682359074c86e0dbb5 /zellij-server/src/plugins/plugin_loader.rs | |
| parent | Bump rust version to 1.75.0 (#3039) (diff) | |
| download | sl0ppij-d780bd91052d8282ba5a7f06c6fb7faa7ca7cc18.tar.gz sl0ppij-d780bd91052d8282ba5a7f06c6fb7faa7ca7cc18.tar.xz sl0ppij-d780bd91052d8282ba5a7f06c6fb7faa7ca7cc18.zip | |
feat(plugins): introduce 'pipes', allowing users to pipe data to and control plugins from the command line (#3066)
* prototype - working with message from the cli
* prototype - pipe from the CLI to plugins
* prototype - pipe from the CLI to plugins and back again
* prototype - working with better cli interface
* prototype - working after removing unused stuff
* prototype - working with launching plugin if it is not launched, also fixed event ordering
* refactor: change message to cli-message
* prototype - allow plugins to send messages to each other
* fix: allow cli messages to send plugin parameters (and implement backpressure)
* fix: use input_pipe_id to identify cli pipes instead of their message name
* fix: come cleanups and add skip_cache parameter
* fix: pipe/client-server communication robustness
* fix: leaking messages between plugins while loading
* feat: allow plugins to specify how a new plugin instance is launched when sending messages
* fix: add permissions
* refactor: adjust cli api
* fix: improve cli plugin loading error messages
* docs: cli pipe
* fix: take plugin configuration into account when messaging between plugins
* refactor: pipe message protobuf interface
* refactor: update(event) -> pipe
* refactor - rename CliMessage to CliPipe
* fix: add is_private to pipes and change some naming
* refactor - cli client
* refactor: various cleanups
* style(fmt): rustfmt
* fix(pipes): backpressure across multiple plugins
* style: some cleanups
* style(fmt): rustfmt
* style: fix merge conflict mistake
* style(wording): clarify pipe permission
Diffstat (limited to 'zellij-server/src/plugins/plugin_loader.rs')
| -rw-r--r-- | zellij-server/src/plugins/plugin_loader.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index 1f001db1..c14a324b 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -56,7 +56,7 @@ pub struct PluginLoader<'a> { store: Arc<Mutex<Store>>, plugin: PluginConfig, plugin_dir: &'a PathBuf, - tab_index: usize, + tab_index: Option<usize>, plugin_own_data_dir: PathBuf, size: Size, wasm_blob_on_hd: Option<(Vec<u8>, PathBuf)>, @@ -133,7 +133,7 @@ impl<'a> PluginLoader<'a> { plugin_id: PluginId, client_id: ClientId, plugin: &PluginConfig, - tab_index: usize, + tab_index: Option<usize>, plugin_dir: PathBuf, plugin_cache: Arc<Mutex<HashMap<PathBuf, Module>>>, senders: ThreadSenders, @@ -339,7 +339,7 @@ impl<'a> PluginLoader<'a> { store: Arc<Mutex<Store>>, plugin: PluginConfig, plugin_dir: &'a PathBuf, - tab_index: usize, + tab_index: Option<usize>, size: Size, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, @@ -814,7 +814,9 @@ impl<'a> PluginLoader<'a> { .import_object(store_mut, &module) .with_context(err_context)?; let mut mut_plugin = self.plugin.clone(); - mut_plugin.set_tab_index(self.tab_index); + if let Some(tab_index) = self.tab_index { + mut_plugin.set_tab_index(tab_index); + } let plugin_env = PluginEnv { plugin_id: self.plugin_id, client_id: self.client_id, @@ -830,6 +832,8 @@ impl<'a> PluginLoader<'a> { default_shell: self.default_shell.clone(), default_layout: self.default_layout.clone(), plugin_cwd: self.zellij_cwd.clone(), + input_pipes_to_unblock: Arc::new(Mutex::new(HashSet::new())), + input_pipes_to_block: Arc::new(Mutex::new(HashSet::new())), }; let subscriptions = Arc::new(Mutex::new(HashSet::new())); |
