diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-05-08 18:25:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-08 18:25:37 +0200 |
| commit | 24f2173fbce61ca6234f4fe4b6ca83833bf3ae64 (patch) | |
| tree | 9e713d10952561889e45e0d3308fc65fa0a236e7 /zellij-server/src/plugins | |
| parent | fix: occasional stall when querying host terminal (introduced in 0.44.1) (#5149) (diff) | |
| download | sl0ppij-24f2173fbce61ca6234f4fe4b6ca83833bf3ae64.tar.gz sl0ppij-24f2173fbce61ca6234f4fe4b6ca83833bf3ae64.tar.xz sl0ppij-24f2173fbce61ca6234f4fe4b6ca83833bf3ae64.zip | |
fix: deadlock with blocking panes (#5152)
* fix: deadlock with blocking panes
* rustfmt
* add pr
Diffstat (limited to 'zellij-server/src/plugins')
14 files changed, 54 insertions, 527 deletions
diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index bf11dbba..69c80e77 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -32,7 +32,7 @@ use zellij_utils::{ data::{ ClientInfo, CommandOrPlugin, Event, EventType, FloatingPaneCoordinates, InputMode, LayoutInfo, LayoutWithError, MessageToPlugin, PermissionStatus, PermissionType, - PipeMessage, PipeSource, PluginCapabilities, WebServerStatus, + PipeMessage, PipeSource, WebServerStatus, }, errors::{prelude::*, ContextType, PluginContext}, input::{ @@ -42,7 +42,6 @@ use zellij_utils::{ layout::{FloatingPaneLayout, Layout, Run, RunPlugin, RunPluginOrAlias, TiledPaneLayout}, plugins::PluginAliases, }, - ipc::ClientAttributes, pane_size::Size, session_serialization, }; @@ -300,8 +299,6 @@ pub(crate) fn plugin_thread_main( path_to_default_shell: PathBuf, zellij_cwd: PathBuf, session_env_vars: std::collections::BTreeMap<String, String>, - capabilities: PluginCapabilities, - client_attributes: ClientAttributes, default_shell: Option<TerminalAction>, plugin_aliases: PluginAliases, default_mode: InputMode, @@ -329,10 +326,7 @@ pub(crate) fn plugin_thread_main( path_to_default_shell, zellij_cwd.clone(), session_env_vars, - capabilities, - client_attributes, default_shell, - layout.clone(), layout_dir, available_layouts, available_layout_errors, diff --git a/zellij-server/src/plugins/pinned_executor.rs b/zellij-server/src/plugins/pinned_executor.rs index e02df637..9dfdba20 100644 --- a/zellij-server/src/plugins/pinned_executor.rs +++ b/zellij-server/src/plugins/pinned_executor.rs @@ -8,7 +8,6 @@ use std::sync::mpsc::{channel, Sender}; use std::sync::{Arc, Mutex}; use std::thread; use wasmi::Engine; -use zellij_utils::input::layout::Layout; /// A dynamic thread pool that pins jobs to specific threads based on plugin_id /// Starts with 1 thread and expands when threads are busy, shrinks when plugins unload @@ -32,7 +31,6 @@ pub struct PinnedExecutor { senders: ThreadSenders, plugin_map: Arc<Mutex<PluginMap>>, connected_clients: Arc<Mutex<Vec<ClientId>>>, - default_layout: Box<Layout>, plugin_cache: PluginCache, engine: Engine, } @@ -49,7 +47,6 @@ enum Job { ThreadSenders, Arc<Mutex<PluginMap>>, Arc<Mutex<Vec<ClientId>>>, - Box<Layout>, PluginCache, Engine, ) + Send @@ -67,7 +64,6 @@ impl PinnedExecutor { senders: &ThreadSenders, plugin_map: &Arc<Mutex<PluginMap>>, connected_clients: &Arc<Mutex<Vec<ClientId>>>, - default_layout: &Box<Layout>, plugin_cache: &PluginCache, engine: &Engine, ) -> Self { @@ -78,7 +74,6 @@ impl PinnedExecutor { senders.clone(), plugin_map.clone(), connected_clients.clone(), - default_layout.clone(), plugin_cache.clone(), engine.clone(), ); @@ -92,7 +87,6 @@ impl PinnedExecutor { senders: senders.clone(), plugin_map: plugin_map.clone(), connected_clients: connected_clients.clone(), - default_layout: default_layout.clone(), plugin_cache: plugin_cache.clone(), engine: engine.clone(), } @@ -103,7 +97,6 @@ impl PinnedExecutor { senders: ThreadSenders, plugin_map: Arc<Mutex<PluginMap>>, connected_clients: Arc<Mutex<Vec<ClientId>>>, - default_layout: Box<Layout>, plugin_cache: PluginCache, engine: Engine, ) -> ExecutionThread { @@ -118,7 +111,6 @@ impl PinnedExecutor { let senders = senders; let plugin_map = plugin_map; let connected_clients = connected_clients; - let default_layout = default_layout; let plugin_cache = plugin_cache; let engine = engine; while let Ok(job) = receiver.recv() { @@ -128,7 +120,6 @@ impl PinnedExecutor { senders.clone(), plugin_map.clone(), connected_clients.clone(), - default_layout.clone(), plugin_cache.clone(), engine.clone(), ); @@ -220,7 +211,6 @@ impl PinnedExecutor { self.senders.clone(), self.plugin_map.clone(), self.connected_clients.clone(), - self.default_layout.clone(), self.plugin_cache.clone(), self.engine.clone(), ); @@ -239,7 +229,6 @@ impl PinnedExecutor { ThreadSenders, Arc<Mutex<PluginMap>>, Arc<Mutex<Vec<ClientId>>>, - Box<Layout>, PluginCache, Engine, ) + Send @@ -283,7 +272,6 @@ impl PinnedExecutor { ThreadSenders, Arc<Mutex<PluginMap>>, Arc<Mutex<Vec<ClientId>>>, - Box<Layout>, PluginCache, Engine, ) + Send @@ -306,7 +294,6 @@ impl PinnedExecutor { ThreadSenders, Arc<Mutex<PluginMap>>, Arc<Mutex<Vec<ClientId>>>, - Box<Layout>, PluginCache, Engine, ) + Send @@ -315,16 +302,9 @@ impl PinnedExecutor { let executor = self.clone(); self.execute_for_plugin( plugin_id, - move |senders, plugin_map, connected_clients, default_layout, plugin_cache, engine| { + move |senders, plugin_map, connected_clients, plugin_cache, engine| { // Execute the cleanup work - f( - senders, - plugin_map, - connected_clients, - default_layout, - plugin_cache, - engine, - ); + f(senders, plugin_map, connected_clients, plugin_cache, engine); // Unregister plugin and potentially shrink the pool executor.unregister_plugin(plugin_id); @@ -423,7 +403,6 @@ mod tests { ThreadSenders, Arc<Mutex<PluginMap>>, Arc<Mutex<Vec<ClientId>>>, - Box<Layout>, PluginCache, Engine, ) { @@ -458,32 +437,22 @@ mod tests { let plugin_map = Arc::new(Mutex::new(PluginMap::default())); let connected_clients = Arc::new(Mutex::new(vec![])); - let layout = Box::new(Layout::default()); - let plugin_cache = Arc::new(Mutex::new( std::collections::HashMap::<PathBuf, Module>::new(), )); let engine = Engine::default(); - ( - senders, - plugin_map, - connected_clients, - layout, - plugin_cache, - engine, - ) + (senders, plugin_map, connected_clients, plugin_cache, engine) } fn create_test_executor(max_threads: usize) -> Arc<PinnedExecutor> { - let (senders, plugin_map, clients, layout, cache, engine) = create_test_dependencies(); + let (senders, plugin_map, clients, cache, engine) = create_test_dependencies(); Arc::new(PinnedExecutor::new( max_threads, &senders, &plugin_map, &clients, - &layout, &cache, &engine, )) @@ -496,12 +465,11 @@ mod tests { ThreadSenders, Arc<Mutex<PluginMap>>, Arc<Mutex<Vec<ClientId>>>, - Box<Layout>, PluginCache, Engine, ) + Send + 'static { - move |_senders, _plugin_map, _clients, _layout, _cache, _engine| { + move |_senders, _plugin_map, _clients, _cache, _engine| { tx.send(()).unwrap(); } } @@ -509,7 +477,7 @@ mod tests { // Helper to verify thread assignment by capturing thread name in job fn get_thread_name_for_plugin(executor: &Arc<PinnedExecutor>, plugin_id: u32) -> String { let (tx, rx) = channel(); - executor.execute_for_plugin(plugin_id, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(plugin_id, move |_s, _p, _c, _ca, _e| { let name = thread::current().name().unwrap().to_string(); tx.send(name).unwrap(); }); @@ -563,7 +531,7 @@ mod tests { // Make thread 0 busy with a barrier let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); @@ -594,7 +562,7 @@ mod tests { // Make thread 0 busy let barrier1 = Arc::new(Barrier::new(2)); let barrier1_clone = barrier1.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier1_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -605,7 +573,7 @@ mod tests { // Make thread 1 busy let barrier2 = Arc::new(Barrier::new(2)); let barrier2_clone = barrier2.clone(); - executor.execute_for_plugin(2, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(2, move |_s, _p, _c, _ca, _e| { barrier2_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -646,7 +614,7 @@ mod tests { // Make thread 0 busy let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -678,7 +646,7 @@ mod tests { // Make thread 0 busy to force plugin 2 to thread 1 let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -726,7 +694,7 @@ mod tests { for i in 1..=3 { let order_clone = order.clone(); let tx_clone = tx.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { order_clone.lock().unwrap().push(i); tx_clone.send(()).unwrap(); }); @@ -767,7 +735,7 @@ mod tests { // Make thread 0 busy to force plugin 2 to thread 1 let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -785,13 +753,13 @@ mod tests { let (tx2, rx2) = channel(); let barrier1 = sync_barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier1.wait(); tx1.send(()).unwrap(); }); let barrier2 = sync_barrier.clone(); - executor.execute_for_plugin(2, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(2, move |_s, _p, _c, _ca, _e| { barrier2.wait(); tx2.send(()).unwrap(); }); @@ -836,7 +804,7 @@ mod tests { let counter_clone = counter.clone(); let (tx_unload, rx_unload) = channel(); - executor.execute_plugin_unload(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_plugin_unload(1, move |_s, _p, _c, _ca, _e| { counter_clone.fetch_add(1, Ordering::SeqCst); tx_unload.send(()).unwrap(); }); @@ -873,7 +841,7 @@ mod tests { let sequence_clone = sequence.clone(); let (tx_unload, rx_unload) = channel(); - executor.execute_plugin_unload(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_plugin_unload(1, move |_s, _p, _c, _ca, _e| { sequence_clone.lock().unwrap().push("cleanup"); tx_unload.send(()).unwrap(); }); @@ -900,7 +868,7 @@ mod tests { // Make thread 0 busy to force plugin 2 to thread 1 let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -977,7 +945,7 @@ mod tests { // Force plugin 2 to thread 1 by making thread 0 busy let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -1035,7 +1003,7 @@ mod tests { // Force plugin 2 to thread 1 let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -1079,7 +1047,7 @@ mod tests { let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); thread::sleep(Duration::from_millis(50)); @@ -1104,7 +1072,7 @@ mod tests { let barrier = Arc::new(Barrier::new(2)); let barrier_clone = barrier.clone(); - executor.execute_for_plugin(1, move |_s, _p, _c, _l, _ca, _e| { + executor.execute_for_plugin(1, move |_s, _p, _c, _ca, _e| { barrier_clone.wait(); }); diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index 31b54df7..8121fbe1 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -25,15 +25,8 @@ use crate::{ use zellij_utils::plugin_api::action::ProtobufPluginConfiguration; use zellij_utils::{ - consts::ZELLIJ_TMP_DIR, - data::{InputMode, PluginCapabilities}, - errors::prelude::*, - input::command::TerminalAction, - input::keybinds::Keybinds, - input::layout::Layout, - input::plugins::PluginConfig, - ipc::ClientAttributes, - pane_size::Size, + consts::ZELLIJ_TMP_DIR, data::InputMode, errors::prelude::*, input::command::TerminalAction, + input::keybinds::Keybinds, input::plugins::PluginConfig, pane_size::Size, }; /// Open a directory as a `File` handle for WASI pre-opening. @@ -77,8 +70,6 @@ pub struct PluginLoader<'a> { tab_index: Option<usize>, path_to_default_shell: PathBuf, session_env_vars: std::collections::BTreeMap<String, String>, - capabilities: PluginCapabilities, - client_attributes: ClientAttributes, default_shell: Option<TerminalAction>, layout_dir: Option<PathBuf>, default_mode: InputMode, @@ -88,7 +79,6 @@ pub struct PluginLoader<'a> { loading_indication: LoadingIndication, senders: ThreadSenders, engine: Engine, - default_layout: Box<Layout>, plugin_cache: PluginCache, plugin_map: &'a mut PluginMap, // we receive a mutable reference rather than the Arc so that it // will be held for the lifetime of this struct and thus loading @@ -102,7 +92,6 @@ impl<'a> PluginLoader<'a> { loading_context: LoadingContext, senders: ThreadSenders, engine: Engine, - default_layout: Box<Layout>, plugin_cache: PluginCache, plugin_map: &'a mut PluginMap, connected_clients: Arc<Mutex<Vec<ClientId>>>, @@ -122,8 +111,6 @@ impl<'a> PluginLoader<'a> { tab_index: loading_context.tab_index, path_to_default_shell: loading_context.path_to_default_shell, session_env_vars: loading_context.session_env_vars, - capabilities: loading_context.capabilities, - client_attributes: loading_context.client_attributes, default_shell: loading_context.default_shell, layout_dir: loading_context.layout_dir, default_mode: loading_context.default_mode, @@ -134,7 +121,6 @@ impl<'a> PluginLoader<'a> { skip_cache, senders, engine, - default_layout, plugin_cache, plugin_map, connected_clients: Some(connected_clients), @@ -282,10 +268,7 @@ impl<'a> PluginLoader<'a> { plugin_own_cache_dir: self.plugin_own_cache_dir.clone(), tab_index: self.tab_index, path_to_default_shell: self.path_to_default_shell.clone(), - capabilities: self.capabilities.clone(), - client_attributes: self.client_attributes.clone(), default_shell: self.default_shell.clone(), - default_layout: self.default_layout.clone(), plugin_cwd: self.plugin_cwd.clone(), session_env_vars: self.session_env_vars.clone(), input_pipes_to_unblock: Arc::new(Mutex::new(HashSet::new())), @@ -397,10 +380,7 @@ impl<'a> PluginLoader<'a> { plugin_own_cache_dir: self.plugin_own_cache_dir.clone(), tab_index: self.tab_index, path_to_default_shell: self.path_to_default_shell.clone(), - capabilities: self.capabilities.clone(), - client_attributes: self.client_attributes.clone(), default_shell: self.default_shell.clone(), - default_layout: self.default_layout.clone(), plugin_cwd: self.plugin_cwd.clone(), session_env_vars: self.session_env_vars.clone(), input_pipes_to_unblock: Arc::new(Mutex::new(HashSet::new())), diff --git a/zellij-server/src/plugins/plugin_map.rs b/zellij-server/src/plugins/plugin_map.rs index f1459dc6..9539bef3 100644 --- a/zellij-server/src/plugins/plugin_map.rs +++ b/zellij-server/src/plugins/plugin_map.rs @@ -15,12 +15,10 @@ use tokio::sync::mpsc::UnboundedSender; use zellij_utils::{ data::EventType, data::InputMode, - data::PluginCapabilities, input::command::TerminalAction, input::keybinds::Keybinds, - input::layout::{Layout, PluginUserConfiguration, RunPlugin, RunPluginLocation}, + input::layout::{PluginUserConfiguration, RunPlugin, RunPluginLocation}, input::plugins::PluginConfig, - ipc::ClientAttributes, }; use zellij_utils::{data::PermissionType, errors::prelude::*}; @@ -285,10 +283,7 @@ pub struct PluginEnv { pub plugin_own_data_dir: PathBuf, pub plugin_own_cache_dir: PathBuf, pub path_to_default_shell: PathBuf, - pub capabilities: PluginCapabilities, - pub client_attributes: ClientAttributes, pub default_shell: Option<TerminalAction>, - pub default_layout: Box<Layout>, pub layout_dir: Option<PathBuf>, pub plugin_cwd: PathBuf, pub session_env_vars: std::collections::BTreeMap<String, String>, diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index 6e087db5..0e3b0637 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -9,7 +9,6 @@ use tempfile::tempdir; use wasmi::Engine; use zellij_utils::data::{ BareKey, Event, InputMode, KeyWithModifier, ModeInfo, PermissionStatus, PermissionType, - PluginCapabilities, }; use zellij_utils::errors::ErrorContext; use zellij_utils::input::actions::Action; @@ -19,7 +18,6 @@ use zellij_utils::input::layout::{ }; use zellij_utils::input::permission::PermissionCache; use zellij_utils::input::plugins::PluginAliases; -use zellij_utils::ipc::ClientAttributes; use zellij_utils::pane_size::Size; use crate::background_jobs::BackgroundJob; @@ -343,8 +341,6 @@ fn create_plugin_thread( let data_dir = PathBuf::from(tempdir().unwrap().path()); let layout_dir = PathBuf::from(tempdir().unwrap().path()); let default_shell = PathBuf::from("."); - let plugin_capabilities = PluginCapabilities::default(); - let client_attributes = ClientAttributes::default(); let default_shell_action = None; // TODO: change me let mut plugin_aliases = PluginAliases::default(); plugin_aliases.aliases.insert( @@ -372,8 +368,6 @@ fn create_plugin_thread( default_shell, zellij_cwd, session_env_vars, - plugin_capabilities, - client_attributes, default_shell_action, plugin_aliases, InputMode::Normal, @@ -445,8 +439,6 @@ fn create_plugin_thread_with_server_receiver( let engine = Engine::new(&config); let data_dir = PathBuf::from(tempdir().unwrap().path()); let default_shell = PathBuf::from("."); - let plugin_capabilities = PluginCapabilities::default(); - let client_attributes = ClientAttributes::default(); let default_shell_action = None; // TODO: change me let initiating_client_id = 1; let plugin_thread = std::thread::Builder::new() @@ -464,8 +456,6 @@ fn create_plugin_thread_with_server_receiver( default_shell, zellij_cwd, session_env_vars, - plugin_capabilities, - client_attributes, default_shell_action, PluginAliases::default(), InputMode::Normal, @@ -545,8 +535,6 @@ fn create_plugin_thread_with_pty_receiver( let data_dir = PathBuf::from(tempdir().unwrap().path()); let layout_dir = layout_dir.unwrap_or_else(|| PathBuf::from(tempdir().unwrap().path())); let default_shell = PathBuf::from("."); - let plugin_capabilities = PluginCapabilities::default(); - let client_attributes = ClientAttributes::default(); let default_shell_action = None; // TODO: change me let initiating_client_id = 1; let plugin_thread = std::thread::Builder::new() @@ -564,8 +552,6 @@ fn create_plugin_thread_with_pty_receiver( default_shell, zellij_cwd, session_env_vars, - plugin_capabilities, - client_attributes, default_shell_action, PluginAliases::default(), InputMode::Normal, @@ -638,8 +624,6 @@ fn create_plugin_thread_with_background_jobs_receiver( let engine = Engine::new(&config); let data_dir = PathBuf::from(tempdir().unwrap().path()); let default_shell = PathBuf::from("."); - let plugin_capabilities = PluginCapabilities::default(); - let client_attributes = ClientAttributes::default(); let default_shell_action = None; // TODO: change me let initiating_client_id = 1; let plugin_thread = std::thread::Builder::new() @@ -657,8 +641,6 @@ fn create_plugin_thread_with_background_jobs_receiver( default_shell, zellij_cwd, session_env_vars, - plugin_capabilities, - client_attributes, default_shell_action, PluginAliases::default(), InputMode::Normal, diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_or_create_tab_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_or_create_tab_plugin_command.snap index cb2d7f0d..833815a3 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_or_create_tab_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_or_create_tab_plugin_command.snap @@ -5,10 +5,6 @@ expression: "format!(\"{:#?}\", new_tab_event)" Some( GoToTabName( "my tab name", - ( - [], - [], - ), None, true, Some( diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab_name_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab_name_plugin_command.snap index f7968649..53e88889 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab_name_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab_name_plugin_command.snap @@ -5,10 +5,6 @@ expression: "format!(\"{:#?}\", new_tab_event)" Some( GoToTabName( "my tab name", - ( - [], - [], - ), None, false, Some( diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tab_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tab_plugin_command.snap index 3479f894..29315e57 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tab_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tab_plugin_command.snap @@ -14,8 +14,8 @@ Some( "new_tab_name", ), ( - [], - [], + None, + None, ), None, false, diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command-2.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command-2.snap index 69271b74..05830618 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command-2.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command-2.snap @@ -66,8 +66,12 @@ Some( [], None, ( - [], - [], + Some( + [], + ), + Some( + [], + ), ), None, false, diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command.snap index b650bbf3..54d7a13f 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command.snap @@ -66,8 +66,12 @@ Some( [], None, ( - [], - [], + Some( + [], + ), + Some( + [], + ), ), None, false, diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__send_configuration_to_plugins.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__send_configuration_to_plugins.snap index e9e3f023..dadde052 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__send_configuration_to_plugins.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__send_configuration_to_plugins.snap @@ -5,10 +5,6 @@ expression: "format!(\"{:#?}\", go_to_tab_event)" Some( GoToTabName( "{\"fake_config_key_1\": \"fake_config_value_1\", \"fake_config_key_2\": \"fake_config_value_2\"}", - ( - [], - [], - ), None, false, Some( diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_mode_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_mode_plugin_command.snap index d8c94ff0..feaaebd7 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_mode_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_mode_plugin_command.snap @@ -4,327 +4,10 @@ expression: "format!(\"{:#?}\", switch_to_mode_event)" --- Some( ChangeMode( - ModeInfo { - mode: Tab, - base_mode: Some( - Normal, - ), - keybinds: [], - style: Style { - colors: Styling { - text_unselected: StyleDeclaration { - base: EightBit( - 245, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 154, - ), - emphasis_3: EightBit( - 201, - ), - }, - text_selected: StyleDeclaration { - base: EightBit( - 245, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 154, - ), - emphasis_3: EightBit( - 201, - ), - }, - ribbon_unselected: StyleDeclaration { - base: EightBit( - 16, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 124, - ), - emphasis_1: EightBit( - 255, - ), - emphasis_2: EightBit( - 45, - ), - emphasis_3: EightBit( - 201, - ), - }, - ribbon_selected: StyleDeclaration { - base: EightBit( - 16, - ), - background: EightBit( - 154, - ), - emphasis_0: EightBit( - 124, - ), - emphasis_1: EightBit( - 166, - ), - emphasis_2: EightBit( - 201, - ), - emphasis_3: EightBit( - 45, - ), - }, - table_title: StyleDeclaration { - base: EightBit( - 154, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 154, - ), - emphasis_3: EightBit( - 201, - ), - }, - table_cell_unselected: StyleDeclaration { - base: EightBit( - 245, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 154, - ), - emphasis_3: EightBit( - 201, - ), - }, - table_cell_selected: StyleDeclaration { - base: EightBit( - 154, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 124, - ), - emphasis_3: EightBit( - 201, - ), - }, - list_unselected: StyleDeclaration { - base: EightBit( - 245, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 154, - ), - emphasis_3: EightBit( - 201, - ), - }, - list_selected: StyleDeclaration { - base: EightBit( - 154, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 124, - ), - emphasis_3: EightBit( - 201, - ), - }, - frame_unselected: None, - frame_selected: StyleDeclaration { - base: EightBit( - 154, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 166, - ), - emphasis_1: EightBit( - 51, - ), - emphasis_2: EightBit( - 201, - ), - emphasis_3: EightBit( - 215, - ), - }, - frame_highlight: StyleDeclaration { - base: EightBit( - 166, - ), - background: EightBit( - 154, - ), - emphasis_0: EightBit( - 201, - ), - emphasis_1: EightBit( - 99, - ), - emphasis_2: EightBit( - 154, - ), - emphasis_3: EightBit( - 154, - ), - }, - exit_code_success: StyleDeclaration { - base: EightBit( - 154, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 51, - ), - emphasis_1: EightBit( - 16, - ), - emphasis_2: EightBit( - 201, - ), - emphasis_3: EightBit( - 45, - ), - }, - exit_code_error: StyleDeclaration { - base: EightBit( - 124, - ), - background: EightBit( - 238, - ), - emphasis_0: EightBit( - 226, - ), - emphasis_1: EightBit( - 136, - ), - emphasis_2: EightBit( - 245, - ), - emphasis_3: EightBit( - 99, - ), - }, - multiplayer_user_colors: MultiplayerColors { - player_1: EightBit( - 201, - ), - player_2: EightBit( - 45, - ), - player_3: EightBit( - 99, - ), - player_4: EightBit( - 226, - ), - player_5: EightBit( - 51, - ), - player_6: EightBit( - 136, - ), - player_7: EightBit( - 124, - ), - player_8: EightBit( - 245, - ), - player_9: EightBit( - 207, - ), - player_10: EightBit( - 215, - ), - }, - }, - rounded_corners: false, - hide_session_name: false, - }, - capabilities: PluginCapabilities { - arrow_fonts: true, - }, - session_name: Some( - "zellij-test", - ), - editor: None, - shell: None, - web_clients_allowed: None, - web_sharing: None, - currently_marking_pane_group: None, - is_web_client: None, - web_server_ip: None, - web_server_port: None, - web_server_capability: None, - }, + Tab, + Some( + Normal, + ), 1, Some( NotificationEnd { diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs index 86db429d..aaaf1971 100644 --- a/zellij-server/src/plugins/wasm_bridge.rs +++ b/zellij-server/src/plugins/wasm_bridge.rs @@ -40,14 +40,13 @@ use crate::{ ServerInstruction, }; use zellij_utils::{ - data::{Event, EventType, PluginCapabilities}, + data::{Event, EventType}, errors::prelude::*, input::{ command::TerminalAction, - layout::{Layout, PluginUserConfiguration, RunPlugin, RunPluginLocation, RunPluginOrAlias}, + layout::{PluginUserConfiguration, RunPlugin, RunPluginLocation, RunPluginOrAlias}, plugins::{PluginAliases, PluginConfig}, }, - ipc::ClientAttributes, pane_size::Size, }; @@ -104,8 +103,6 @@ pub struct LoadingContext { pub tab_index: Option<usize>, pub path_to_default_shell: PathBuf, pub session_env_vars: std::collections::BTreeMap<String, String>, - pub capabilities: PluginCapabilities, - pub client_attributes: ClientAttributes, pub default_shell: Option<TerminalAction>, pub layout_dir: Option<PathBuf>, pub default_mode: InputMode, @@ -151,8 +148,6 @@ impl LoadingContext { path_to_default_shell: wasm_bridge.path_to_default_shell.clone(), session_env_vars: wasm_bridge.session_env_vars.clone(), plugin_cwd: cwd.unwrap_or_else(|| wasm_bridge.zellij_cwd.clone()), - capabilities: wasm_bridge.capabilities.clone(), - client_attributes: wasm_bridge.client_attributes.clone(), default_shell: wasm_bridge.default_shell.clone(), layout_dir: wasm_bridge.layout_dir.clone(), keybinds, @@ -192,8 +187,6 @@ pub struct WasmBridge { watcher: Option<Debouncer<RecommendedWatcher, FileIdMap>>, zellij_cwd: PathBuf, session_env_vars: std::collections::BTreeMap<String, String>, - capabilities: PluginCapabilities, - client_attributes: ClientAttributes, default_shell: Option<TerminalAction>, cached_plugin_map: HashMap<RunPluginLocation, HashMap<PluginUserConfiguration, Vec<(PluginId, ClientId)>>>, @@ -218,10 +211,7 @@ impl WasmBridge { path_to_default_shell: PathBuf, zellij_cwd: PathBuf, session_env_vars: std::collections::BTreeMap<String, String>, - capabilities: PluginCapabilities, - client_attributes: ClientAttributes, default_shell: Option<TerminalAction>, - default_layout: Box<Layout>, layout_dir: Option<PathBuf>, available_layouts: Vec<LayoutInfo>, available_layout_errors: Vec<LayoutWithError>, @@ -240,7 +230,6 @@ impl WasmBridge { &senders, &plugin_map, &connected_clients, - &default_layout, &plugin_cache, &engine, )); @@ -261,8 +250,6 @@ impl WasmBridge { pending_plugin_reloads: HashSet::new(), zellij_cwd, session_env_vars, - capabilities, - client_attributes, default_shell, cached_plugin_map: HashMap::new(), pending_pipes: Default::default(), @@ -399,7 +386,6 @@ impl WasmBridge { move |senders: ThreadSenders, plugin_map: Arc<Mutex<PluginMap>>, connected_clients: Arc<Mutex<Vec<ClientId>>>, - default_layout: Box<Layout>, plugin_cache: PluginCache, engine| { let mut plugin_map = plugin_map.lock().unwrap(); @@ -408,7 +394,6 @@ impl WasmBridge { loading_context, senders.clone(), engine.clone(), - default_layout.clone(), plugin_cache.clone(), &mut plugin_map, connected_clients.clone(), @@ -450,7 +435,6 @@ impl WasmBridge { move |senders, plugin_map, connected_clients, - default_layout, plugin_cache: PluginCache, engine: Engine| { let mut plugin_map = plugin_map.lock().unwrap(); @@ -459,7 +443,6 @@ impl WasmBridge { loading_context, senders.clone(), engine.clone(), - default_layout.clone(), plugin_cache.clone(), &mut plugin_map, connected_clients.clone(), @@ -548,12 +531,7 @@ impl WasmBridge { self.plugin_executor.execute_plugin_unload( plugin_id, - move |senders, - _plugin_map, - _connected_clients, - _default_layout, - _plugin_cache, - _engine| { + move |senders, _plugin_map, _connected_clients, _plugin_cache, _engine| { let subscriptions_guard = subscriptions.lock().unwrap(); let needs_before_close = subscriptions_guard.contains(&EventType::BeforeClose); drop(subscriptions_guard); // Release lock before calling plugin @@ -671,7 +649,7 @@ impl WasmBridge { plugin_executor.execute_for_plugin( plugin_id, - move |senders, plugin_map, connected_clients, default_layout, plugin_cache, engine| { + move |senders, plugin_map, connected_clients, plugin_cache, engine| { let skip_cache = true; // we want to explicitly reload the plugin let mut plugin_map = plugin_map.lock().unwrap(); match PluginLoader::new( @@ -679,7 +657,6 @@ impl WasmBridge { loading_context, senders.clone(), engine.clone(), - default_layout.clone(), plugin_cache.clone(), &mut plugin_map, connected_clients.clone(), @@ -778,12 +755,7 @@ impl WasmBridge { plugin_executor.execute_for_plugin( plugin_id, - move |senders, - plugin_map, - connected_clients, - default_layout, - plugin_cache, - engine| { + move |senders, plugin_map, connected_clients, plugin_cache, engine| { let skip_cache = false; let mut plugin_map = plugin_map.lock().unwrap(); match PluginLoader::new( @@ -791,7 +763,6 @@ impl WasmBridge { loading_context, senders.clone(), engine.clone(), - default_layout.clone(), plugin_cache.clone(), &mut plugin_map, connected_clients.clone(), @@ -853,12 +824,7 @@ impl WasmBridge { // let senders = self.senders.clone(); let running_plugin = running_plugin.clone(); let _s = shutdown_sender.clone(); - move |senders, - _plugin_map, - _connected_clients, - _default_layout, - _plugin_cache, - _engine| { + move |senders, _plugin_map, _connected_clients, _plugin_cache, _engine| { let mut running_plugin = running_plugin.lock().unwrap(); let _s = _s; // guard to allow the task to complete before cleanup/shutdown if running_plugin.apply_event_id(AtomicEvent::Resize, event_id) { @@ -965,7 +931,6 @@ impl WasmBridge { move |senders, _plugin_map, _connected_clients, - _default_layout, _plugin_cache, _engine| { let _s = _s; // guard to allow the task to complete before cleanup/shutdown @@ -1061,12 +1026,7 @@ impl WasmBridge { // Execute directly on pinned thread (no async I/O needed for directory check/change) self.plugin_executor .execute_for_plugin(plugin_id_to_update, { - move |senders, - _plugin_map, - _connected_clients, - _default_layout, - _plugin_cache, - _engine| { + move |senders, _plugin_map, _connected_clients, _plugin_cache, _engine| { match new_host_dir.try_exists() { Ok(false) => { log::error!( @@ -1190,12 +1150,7 @@ impl WasmBridge { let client_id = *client_id; let _s = shutdown_sender.clone(); let notification_end = notification_end.take(); - move |senders, - _plugin_map, - _connected_clients, - _default_layout, - _plugin_cache, - _engine| { + move |senders, _plugin_map, _connected_clients, _plugin_cache, _engine| { let mut running_plugin = running_plugin.lock().unwrap(); let mut plugin_render_assets = vec![]; let _s = _s; // guard to allow the task to complete before cleanup/shutdown @@ -1525,12 +1480,7 @@ impl WasmBridge { let keybinds = keybinds.clone(); let default_shell = default_shell.clone(); let layout_dir = layout_dir.clone(); - move |_senders, - _plugin_map, - _connected_clients, - _default_layout, - _plugin_cache, - _engine| { + move |_senders, _plugin_map, _connected_clients, _plugin_cache, _engine| { let mut running_plugin = running_plugin.lock().unwrap(); if let Some(keybinds) = keybinds { running_plugin.update_keybinds(keybinds); @@ -1578,12 +1528,7 @@ impl WasmBridge { let client_id = *client_id; let _s = shutdown_sender.clone(); let events_or_pipe_messages = events_or_pipe_messages.clone(); - move |senders, - _plugin_map, - _connected_clients, - _default_layout, - _plugin_cache, - _engine| { + move |senders, _plugin_map, _connected_clients, _plugin_cache, _engine| { let _s = _s; // guard to allow the task to complete before cleanup/shutdown for event_or_pipe_message in events_or_pipe_messages { match event_or_pipe_message { diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index 1a941026..e586404f 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -121,12 +121,8 @@ macro_rules! apply_action { None, Some(PaneId::Plugin($env.plugin_id)), $env.senders.clone(), - $env.capabilities.clone(), - $env.client_attributes.clone(), $env.default_shell.clone(), - &$env.default_layout, None, - &$env.keybinds, $env.default_mode.clone(), None, ) { @@ -1430,11 +1426,7 @@ fn run_action(env: &PluginEnv, mut action: Action, context: BTreeMap<String, Str let client_id = env.client_id; let plugin_id = env.plugin_id; let senders = env.senders.clone(); - let capabilities = env.capabilities.clone(); - let client_attributes = env.client_attributes.clone(); let default_shell = env.default_shell.clone(); - let default_layout = env.default_layout.clone(); - let keybinds = env.keybinds.clone(); let default_mode = env.default_mode.clone(); let plugin_name = env.name().to_string(); @@ -1447,12 +1439,8 @@ fn run_action(env: &PluginEnv, mut action: Action, context: BTreeMap<String, Str None, Some(PaneId::Plugin(plugin_id)), senders.clone(), - capabilities, - client_attributes, default_shell, - &default_layout, None, - &keybinds, default_mode, None, ) { @@ -4482,12 +4470,8 @@ fn try_edit_layout( None, Some(PaneId::Plugin(env.plugin_id)), env.senders.clone(), - env.capabilities.clone(), - env.client_attributes.clone(), env.default_shell.clone(), - &env.default_layout, None, - &env.keybinds, env.default_mode.clone(), None, ) |
