diff options
Diffstat (limited to 'zellij-server')
63 files changed, 5043 insertions, 553 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 4e4911429..9707e61e6 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -778,6 +778,9 @@ fn init_session( let store = get_store(); let layout = layout.clone(); + let client_attributes = client_attributes.clone(); + let default_shell = default_shell.clone(); + let capabilities = capabilities.clone(); move || { plugin_thread_main( plugin_bus, @@ -787,6 +790,9 @@ fn init_session( layout, path_to_default_shell, zellij_cwd, + capabilities, + client_attributes, + default_shell, ) .fatal() } @@ -834,7 +840,7 @@ fn init_session( to_plugin: Some(to_plugin), to_pty_writer: Some(to_pty_writer), to_background_jobs: Some(to_background_jobs), - to_server: None, + to_server: Some(to_server), should_silently_fail: false, }, capabilities, diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index 7b322b054..55e97f031 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -14,13 +14,14 @@ use crate::{pty::PtyInstruction, thread_bus::Bus, ClientId, ServerInstruction}; use wasm_bridge::WasmBridge; use zellij_utils::{ - data::Event, + data::{Event, PluginCapabilities}, errors::{prelude::*, ContextType, PluginContext}, input::{ command::TerminalAction, layout::{FloatingPaneLayout, Layout, Run, RunPlugin, RunPluginLocation, TiledPaneLayout}, plugins::PluginsConfig, }, + ipc::ClientAttributes, pane_size::Size, }; @@ -108,6 +109,9 @@ pub(crate) fn plugin_thread_main( layout: Box<Layout>, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + capabilities: PluginCapabilities, + client_attributes: ClientAttributes, + default_shell: Option<TerminalAction>, ) -> Result<()> { info!("Wasm main thread starts"); @@ -121,6 +125,10 @@ pub(crate) fn plugin_thread_main( plugin_dir, path_to_default_shell, zellij_cwd, + capabilities, + client_attributes, + default_shell, + layout.clone(), ); loop { diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index 4d77bd9e9..324b540d5 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -22,8 +22,12 @@ use crate::{ use zellij_utils::{ consts::{VERSION, ZELLIJ_CACHE_DIR, ZELLIJ_SESSION_CACHE_DIR, ZELLIJ_TMP_DIR}, + data::PluginCapabilities, errors::prelude::*, + input::command::TerminalAction, + input::layout::Layout, input::plugins::PluginConfig, + ipc::ClientAttributes, pane_size::Size, }; @@ -165,6 +169,10 @@ pub struct PluginLoader<'a> { wasm_blob_on_hd: Option<(Vec<u8>, PathBuf)>, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + capabilities: PluginCapabilities, + client_attributes: ClientAttributes, + default_shell: Option<TerminalAction>, + default_layout: Box<Layout>, } impl<'a> PluginLoader<'a> { @@ -179,6 +187,10 @@ impl<'a> PluginLoader<'a> { loading_indication: &mut LoadingIndication, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + capabilities: PluginCapabilities, + client_attributes: ClientAttributes, + default_shell: Option<TerminalAction>, + default_layout: Box<Layout>, ) -> Result<()> { let err_context = || format!("failed to reload plugin {plugin_id} from memory"); let mut connected_clients: Vec<ClientId> = @@ -199,6 +211,10 @@ impl<'a> PluginLoader<'a> { &plugin_dir, path_to_default_shell, zellij_cwd, + capabilities, + client_attributes, + default_shell, + default_layout, )?; plugin_loader .load_module_from_memory() @@ -234,6 +250,10 @@ impl<'a> PluginLoader<'a> { loading_indication: &mut LoadingIndication, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + capabilities: PluginCapabilities, + client_attributes: ClientAttributes, + default_shell: Option<TerminalAction>, + default_layout: Box<Layout>, ) -> Result<()> { let err_context = || format!("failed to start plugin {plugin_id} for client {client_id}"); let mut plugin_loader = PluginLoader::new( @@ -249,6 +269,10 @@ impl<'a> PluginLoader<'a> { size, path_to_default_shell, zellij_cwd, + capabilities, + client_attributes, + default_shell, + default_layout, )?; plugin_loader .load_module_from_memory() @@ -284,6 +308,10 @@ impl<'a> PluginLoader<'a> { loading_indication: &mut LoadingIndication, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + capabilities: PluginCapabilities, + client_attributes: ClientAttributes, + default_shell: Option<TerminalAction>, + default_layout: Box<Layout>, ) -> Result<()> { let mut new_plugins = HashSet::new(); for plugin_id in plugin_map.lock().unwrap().plugin_ids() { @@ -301,6 +329,10 @@ impl<'a> PluginLoader<'a> { &plugin_dir, path_to_default_shell.clone(), zellij_cwd.clone(), + capabilities.clone(), + client_attributes.clone(), + default_shell.clone(), + default_layout.clone(), )?; plugin_loader .load_module_from_memory() @@ -329,6 +361,10 @@ impl<'a> PluginLoader<'a> { loading_indication: &mut LoadingIndication, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + capabilities: PluginCapabilities, + client_attributes: ClientAttributes, + default_shell: Option<TerminalAction>, + default_layout: Box<Layout>, ) -> Result<()> { let err_context = || format!("failed to reload plugin id {plugin_id}"); @@ -350,6 +386,10 @@ impl<'a> PluginLoader<'a> { &plugin_dir, path_to_default_shell, zellij_cwd, + capabilities, |