diff --git a/CHANGELOG.md b/CHANGELOG.md index be43377f6..fb9ac53f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * feat: allow sending keys to other panes from the CLI (https://github.com/zellij-org/zellij/pull/4691) * feat: allow querying tab info (id, name and position) from the CLI as well as general info about all tabs (https://github.com/zellij-org/zellij/pull/4695) * feat: propagate plugin configuration changes to plugins (https://github.com/zellij-org/zellij/pull/4698) +* feat: allow plugins to query env vars set upon session creation (gated behind a relevant permission) (https://github.com/zellij-org/zellij/pull/4700) ## [0.43.1] - 2025-08-08 diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 52c527a0e..6b7f9612c 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -63,6 +63,7 @@ impl ZellijPlugin for State { PermissionType::Reconfigure, PermissionType::WriteToClipboard, PermissionType::RunActionsAsUser, + PermissionType::ReadSessionEnvironmentVariables, ]); self.configuration = configuration; subscribe(&[ @@ -724,6 +725,17 @@ impl ZellijPlugin for State { }, } }, + BareKey::Char('j') + if key.has_only_modifiers(&[KeyModifier::Ctrl, KeyModifier::Shift]) => + { + let env_vars = get_session_environment_variables(); + if !env_vars.is_empty() { + self.explicit_string_to_render = + Some(format!("Got environment variables: {:#?}", env_vars,)); + } else { + self.explicit_string_to_render = Some(format!("Error: Got empty env vars")); + } + }, BareKey::Char('a') if key.has_only_modifiers(&[KeyModifier::Ctrl, KeyModifier::Alt]) => { diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 207f5bedd..e24aa38ea 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -1809,6 +1809,7 @@ fn init_session( .unwrap(); let zellij_cwd = std::env::current_dir().unwrap_or_else(|_| std::path::PathBuf::from(".")); + let session_env_vars: std::collections::BTreeMap = std::env::vars().collect(); let (available_layouts, available_layout_errors) = get_available_layouts(&config_options); @@ -1836,6 +1837,7 @@ fn init_session( .clone() .or_else(|| default_layout_dir()); let background_plugins = config.background_plugins.clone(); + let session_env_vars = session_env_vars.clone(); move || { plugin_thread_main( plugin_bus, @@ -1847,6 +1849,7 @@ fn init_session( available_layout_errors, path_to_default_shell, zellij_cwd, + session_env_vars, capabilities, client_attributes, default_shell, diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index 8ad971732..b58d1a1a3 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -289,6 +289,7 @@ pub(crate) fn plugin_thread_main( available_layout_errors: Vec, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + session_env_vars: std::collections::BTreeMap, capabilities: PluginCapabilities, client_attributes: ClientAttributes, default_shell: Option, @@ -317,6 +318,7 @@ pub(crate) fn plugin_thread_main( plugin_dir, path_to_default_shell, zellij_cwd.clone(), + session_env_vars, capabilities, client_attributes, default_shell, diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index 723b1b5aa..c0b4ee60f 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -60,6 +60,7 @@ pub struct PluginLoader<'a> { plugin_config: PluginConfig, tab_index: Option, path_to_default_shell: PathBuf, + session_env_vars: std::collections::BTreeMap, capabilities: PluginCapabilities, client_attributes: ClientAttributes, default_shell: Option, @@ -104,6 +105,7 @@ impl<'a> PluginLoader<'a> { plugin_config: loading_context.plugin_config, 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, @@ -269,6 +271,7 @@ impl<'a> PluginLoader<'a> { 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())), input_pipes_to_block: Arc::new(Mutex::new(HashSet::new())), layout_dir: self.layout_dir.clone(), @@ -383,6 +386,7 @@ impl<'a> PluginLoader<'a> { 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())), input_pipes_to_block: Arc::new(Mutex::new(HashSet::new())), layout_dir: self.layout_dir.clone(), diff --git a/zellij-server/src/plugins/plugin_map.rs b/zellij-server/src/plugins/plugin_map.rs index 39d8af6a6..8bc46960f 100644 --- a/zellij-server/src/plugins/plugin_map.rs +++ b/zellij-server/src/plugins/plugin_map.rs @@ -291,6 +291,7 @@ pub struct PluginEnv { pub default_layout: Box, pub layout_dir: Option, pub plugin_cwd: PathBuf, + pub session_env_vars: std::collections::BTreeMap, pub input_pipes_to_unblock: Arc>>, pub input_pipes_to_block: Arc>>, pub default_mode: InputMode, diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index 6d1cba660..507220ac9 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -295,12 +295,14 @@ macro_rules! grant_permissions_and_log_actions_in_thread_struct_variant { fn create_plugin_thread( zellij_cwd: Option, + session_env_vars: Option>, ) -> ( SenderWithContext, Receiver<(ScreenInstruction, ErrorContext)>, Box, ) { let zellij_cwd = zellij_cwd.unwrap_or_else(|| PathBuf::from(".")); + let session_env_vars = session_env_vars.unwrap_or_else(|| std::env::vars().collect()); let initiating_client_id = 1; let (to_server, _server_receiver): ChannelWithContext = channels::bounded(50); @@ -368,6 +370,7 @@ fn create_plugin_thread( vec![], default_shell, zellij_cwd, + session_env_vars, plugin_capabilities, client_attributes, default_shell_action, @@ -396,6 +399,7 @@ fn create_plugin_thread( fn create_plugin_thread_with_server_receiver( zellij_cwd: Option, + session_env_vars: Option>, ) -> ( SenderWithContext, Receiver<(ServerInstruction, ErrorContext)>, @@ -403,6 +407,7 @@ fn create_plugin_thread_with_server_receiver( Box, ) { let zellij_cwd = zellij_cwd.unwrap_or_else(|| PathBuf::from(".")); + let session_env_vars = session_env_vars.unwrap_or_else(|| std::env::vars().collect()); let (to_server, server_receiver): ChannelWithContext = channels::bounded(50); let to_server = SenderWithContext::new(to_server); @@ -457,6 +462,7 @@ fn create_plugin_thread_with_server_receiver( vec![], default_shell, zellij_cwd, + session_env_vars, plugin_capabilities, client_attributes, default_shell_action, @@ -491,6 +497,7 @@ fn create_plugin_thread_with_server_receiver( fn create_plugin_thread_with_pty_receiver( zellij_cwd: Option, layout_dir: Option, + session_env_vars: Option>, ) -> ( SenderWithContext, Receiver<(PtyInstruction, ErrorContext)>, @@ -498,6 +505,7 @@ fn create_plugin_thread_with_pty_receiver( Box, ) { let zellij_cwd = zellij_cwd.unwrap_or_else(|| PathBuf::from(".")); + let session_env_vars = session_env_vars.unwrap_or_else(|| std::env::vars().collect()); let (to_server, _server_receiver): ChannelWithContext = channels::bounded(50); let to_server = SenderWithContext::new(to_server); @@ -554,6 +562,7 @@ fn create_plugin_thread_with_pty_receiver( vec![], default_shell, zellij_cwd, + session_env_vars, plugin_capabilities, client_attributes, default_shell_action, @@ -582,6 +591,7 @@ fn create_plugin_thread_with_pty_receiver( fn create_plugin_thread_with_background_jobs_receiver( zellij_cwd: Option, + session_env_vars: Option>, ) -> ( SenderWithContext, Receiver<(BackgroundJob, ErrorContext)>, @@ -589,6 +599,7 @@ fn create_plugin_thread_with_background_jobs_receiver( Box, ) { let zellij_cwd = zellij_cwd.unwrap_or_else(|| PathBuf::from(".")); + let session_env_vars = session_env_vars.unwrap_or_else(|| std::env::vars().collect()); let (to_server, _server_receiver): ChannelWithContext = channels::bounded(50); let to_server = SenderWithContext::new(to_server); @@ -644,6 +655,7 @@ fn create_plugin_thread_with_background_jobs_receiver( vec![], default_shell, zellij_cwd, + session_env_vars, plugin_capabilities, client_attributes, default_shell_action, @@ -698,7 +710,7 @@ pub fn load_new_plugin_from_hd() { let temp_folder = tempdir().unwrap(); // placed explicitly in the test scope because its let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); - let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None); + let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -782,7 +794,7 @@ pub fn load_new_plugin_with_plugin_alias() { let temp_folder = tempdir().unwrap(); // placed explicitly in the test scope because its let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); - let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None); + let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::Alias(PluginAlias { @@ -860,7 +872,7 @@ pub fn load_new_plugin_with_plugin_alias() { pub fn plugin_workers() { let temp_folder = tempdir().unwrap(); // placed explicitly in the test scope because its // destructor removes the directory - let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None); + let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None, None); let plugin_should_float = Some(false); let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); @@ -944,7 +956,7 @@ pub fn plugin_workers() { pub fn plugin_workers_persist_state() { let temp_folder = tempdir().unwrap(); // placed explicitly in the test scope because its // destructor removes the directory - let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None); + let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None, None); let plugin_should_float = Some(false); let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); @@ -1040,7 +1052,7 @@ pub fn can_subscribe_to_hd_events() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1122,7 +1134,7 @@ pub fn switch_to_mode_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1198,7 +1210,7 @@ pub fn switch_to_mode_plugin_command_permission_denied() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1274,7 +1286,7 @@ pub fn new_tabs_with_layout_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1364,7 +1376,7 @@ pub fn new_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1440,7 +1452,7 @@ pub fn go_to_next_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1515,7 +1527,7 @@ pub fn go_to_previous_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1590,7 +1602,7 @@ pub fn resize_focused_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1665,7 +1677,7 @@ pub fn resize_focused_pane_with_direction_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1740,7 +1752,7 @@ pub fn focus_next_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1815,7 +1827,7 @@ pub fn focus_previous_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1890,7 +1902,7 @@ pub fn move_focus_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -1965,7 +1977,7 @@ pub fn move_focus_or_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2040,7 +2052,7 @@ pub fn edit_scrollback_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2115,7 +2127,7 @@ pub fn write_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2190,7 +2202,7 @@ pub fn write_chars_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2265,7 +2277,7 @@ pub fn toggle_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2340,7 +2352,7 @@ pub fn move_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2415,7 +2427,7 @@ pub fn move_pane_with_direction_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2490,7 +2502,7 @@ pub fn clear_screen_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2566,7 +2578,7 @@ pub fn scroll_up_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2642,7 +2654,7 @@ pub fn scroll_down_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2717,7 +2729,7 @@ pub fn scroll_to_top_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2792,7 +2804,7 @@ pub fn scroll_to_bottom_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2867,7 +2879,7 @@ pub fn page_scroll_up_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -2942,7 +2954,7 @@ pub fn page_scroll_down_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3017,7 +3029,7 @@ pub fn toggle_focus_fullscreen_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3092,7 +3104,7 @@ pub fn toggle_pane_frames_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3167,7 +3179,7 @@ pub fn toggle_pane_embed_or_eject_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3242,7 +3254,7 @@ pub fn undo_rename_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3317,7 +3329,7 @@ pub fn close_focus_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3392,7 +3404,7 @@ pub fn toggle_active_tab_sync_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3467,7 +3479,7 @@ pub fn close_focused_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3542,7 +3554,7 @@ pub fn undo_rename_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3617,7 +3629,7 @@ pub fn previous_swap_layout_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3692,7 +3704,7 @@ pub fn next_swap_layout_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3767,7 +3779,7 @@ pub fn go_to_tab_name_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3842,7 +3854,7 @@ pub fn focus_or_create_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3917,7 +3929,7 @@ pub fn go_to_tab() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -3992,7 +4004,7 @@ pub fn start_or_reload_plugin() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4067,7 +4079,7 @@ pub fn quit_zellij_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4149,7 +4161,7 @@ pub fn detach_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4231,7 +4243,7 @@ pub fn open_file_floating_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4317,7 +4329,7 @@ pub fn open_file_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4403,7 +4415,7 @@ pub fn open_file_with_line_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4490,7 +4502,7 @@ pub fn open_file_with_line_floating_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4576,7 +4588,7 @@ pub fn open_terminal_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4658,7 +4670,7 @@ pub fn open_terminal_floating_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4740,7 +4752,7 @@ pub fn open_command_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4822,7 +4834,7 @@ pub fn open_command_pane_floating_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4904,7 +4916,7 @@ pub fn switch_to_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -4979,7 +4991,7 @@ pub fn hide_self_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5054,7 +5066,7 @@ pub fn show_self_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5128,7 +5140,7 @@ pub fn close_terminal_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5203,7 +5215,7 @@ pub fn close_plugin_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5278,7 +5290,7 @@ pub fn focus_terminal_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5353,7 +5365,7 @@ pub fn focus_plugin_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5428,7 +5440,7 @@ pub fn rename_terminal_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5503,7 +5515,7 @@ pub fn rename_plugin_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5578,7 +5590,7 @@ pub fn rename_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5653,7 +5665,7 @@ pub fn send_configuration_to_plugins() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let mut configuration = BTreeMap::new(); @@ -5738,7 +5750,7 @@ pub fn request_plugin_permissions() { let temp_folder = tempdir().unwrap(); let plugin_host_folder = PathBuf::from(temp_folder.path()); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5809,7 +5821,7 @@ pub fn granted_permission_request_result() { let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5904,7 +5916,7 @@ pub fn denied_permission_request_result() { let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -5993,7 +6005,7 @@ pub fn run_command_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, background_jobs_receiver, screen_receiver, teardown) = - create_plugin_thread_with_background_jobs_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_background_jobs_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6075,7 +6087,7 @@ pub fn run_command_with_env_vars_and_cwd_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, background_jobs_receiver, screen_receiver, teardown) = - create_plugin_thread_with_background_jobs_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_background_jobs_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6157,7 +6169,7 @@ pub fn web_request_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, background_jobs_receiver, screen_receiver, teardown) = - create_plugin_thread_with_background_jobs_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_background_jobs_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6239,7 +6251,7 @@ pub fn unblock_input_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6325,7 +6337,7 @@ pub fn block_input_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6412,7 +6424,7 @@ pub fn pipe_output_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6506,7 +6518,7 @@ pub fn pipe_message_to_plugin_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6597,7 +6609,7 @@ pub fn switch_session_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6685,7 +6697,7 @@ pub fn switch_session_with_layout_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6773,7 +6785,7 @@ pub fn switch_session_with_layout_and_cwd_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6858,7 +6870,7 @@ pub fn disconnect_other_clients_plugins_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -6943,7 +6955,7 @@ pub fn reconfigure_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7030,7 +7042,7 @@ pub fn run_plugin_in_specific_cwd() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder.clone())); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder.clone()), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let plugin_initial_cwd = plugin_host_folder.join("custom_plugin_cwd"); @@ -7117,7 +7129,7 @@ pub fn hide_pane_with_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7192,7 +7204,7 @@ pub fn show_pane_with_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7267,7 +7279,7 @@ pub fn open_command_pane_background_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7353,7 +7365,7 @@ pub fn rerun_command_pane_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7428,7 +7440,7 @@ pub fn resize_pane_with_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7503,7 +7515,7 @@ pub fn edit_scrollback_for_pane_with_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7578,7 +7590,7 @@ pub fn write_to_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7653,7 +7665,7 @@ pub fn write_chars_to_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7728,7 +7740,7 @@ pub fn move_pane_with_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7803,7 +7815,7 @@ pub fn move_pane_with_pane_id_in_direction_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7878,7 +7890,7 @@ pub fn clear_screen_for_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -7953,7 +7965,7 @@ pub fn scroll_up_in_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8028,7 +8040,7 @@ pub fn scroll_down_in_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8103,7 +8115,7 @@ pub fn scroll_to_top_in_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8178,7 +8190,7 @@ pub fn scroll_to_bottom_in_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8253,7 +8265,7 @@ pub fn page_scroll_up_in_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8328,7 +8340,7 @@ pub fn page_scroll_down_in_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8403,7 +8415,7 @@ pub fn toggle_pane_id_fullscreen_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8478,7 +8490,7 @@ pub fn toggle_pane_embed_or_eject_for_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8553,7 +8565,7 @@ pub fn close_tab_with_index_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8628,7 +8640,7 @@ pub fn break_panes_to_new_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8703,7 +8715,7 @@ pub fn break_panes_to_tab_with_index_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8778,7 +8790,7 @@ pub fn reload_plugin_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8853,7 +8865,7 @@ pub fn load_new_plugin_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -8928,7 +8940,7 @@ pub fn rebind_keys_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, server_receiver, screen_receiver, teardown) = - create_plugin_thread_with_server_receiver(Some(plugin_host_folder)); + create_plugin_thread_with_server_receiver(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -9013,7 +9025,7 @@ pub fn list_clients_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -9088,7 +9100,7 @@ pub fn before_close_plugin_event() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -9163,7 +9175,7 @@ pub fn show_cursor_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -9242,7 +9254,7 @@ pub fn hide_cursor_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -9322,7 +9334,7 @@ pub fn copy_to_clipboard_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -9401,7 +9413,7 @@ pub fn run_action_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let plugin_should_float = Some(false); let plugin_title = Some("test_plugin".to_owned()); let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { @@ -9479,7 +9491,7 @@ pub fn send_sigint_to_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let received_pty_instructions = Arc::new(Mutex::new(vec![])); let client_id = 1; @@ -9568,7 +9580,7 @@ pub fn send_sigkill_to_pane_id_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None); + create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), None, None); let received_pty_instructions = Arc::new(Mutex::new(vec![])); let client_id = 1; @@ -9657,7 +9669,7 @@ pub fn copy_to_clipboard_without_permission() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let client_id = 1; @@ -9744,7 +9756,7 @@ pub fn run_action_without_permission() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder)); + create_plugin_thread(Some(plugin_host_folder), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let client_id = 1; @@ -9829,7 +9841,7 @@ pub fn generate_random_name_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -9918,7 +9930,7 @@ pub fn dump_layout_success_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10007,7 +10019,7 @@ pub fn dump_layout_not_found_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10096,7 +10108,7 @@ pub fn get_layout_dir_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10185,7 +10197,7 @@ pub fn get_focused_pane_info_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread_struct_variant!( @@ -10269,7 +10281,7 @@ pub fn dump_session_layout_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10352,7 +10364,7 @@ pub fn dump_session_layout_for_tab_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10435,7 +10447,7 @@ pub fn parse_layout_success_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10524,7 +10536,7 @@ pub fn parse_layout_error_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10613,7 +10625,7 @@ pub fn save_layout_success_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10702,7 +10714,7 @@ pub fn save_layout_already_exists_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10805,7 +10817,7 @@ pub fn save_layout_with_overwrite_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10894,7 +10906,7 @@ pub fn save_layout_invalid_kdl_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -10983,7 +10995,7 @@ pub fn rename_layout_success_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -11086,7 +11098,7 @@ pub fn rename_layout_not_found_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -11175,7 +11187,7 @@ pub fn delete_layout_success_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -11291,7 +11303,7 @@ pub fn delete_layout_not_found_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -11380,7 +11392,7 @@ pub fn save_layout_path_traversal_blocked_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -11471,7 +11483,11 @@ pub fn edit_layout_plugin_command() { let layout_folder_path = PathBuf::from(temp_layout_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, pty_receiver, screen_receiver, teardown) = - create_plugin_thread_with_pty_receiver(Some(plugin_host_folder), Some(layout_folder_path)); + create_plugin_thread_with_pty_receiver( + Some(plugin_host_folder), + Some(layout_folder_path), + None, + ); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let received_pty_instructions = Arc::new(Mutex::new(vec![])); @@ -11568,7 +11584,7 @@ pub fn override_layout_plugin_command() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let screen_thread = grant_permissions_and_log_actions_in_thread!( @@ -11652,7 +11668,7 @@ pub fn generate_random_name_permission_denied() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let client_id = 1; @@ -11748,7 +11764,7 @@ pub fn save_layout_permission_denied() { let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); let (plugin_thread_sender, screen_receiver, teardown) = - create_plugin_thread(Some(plugin_host_folder.clone())); + create_plugin_thread(Some(plugin_host_folder.clone()), None); let received_screen_instructions = Arc::new(Mutex::new(vec![])); let client_id = 1; @@ -11843,7 +11859,7 @@ pub fn plugin_receives_config_change_event() { let temp_folder = tempdir().unwrap(); let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); - let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None); + let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None, None); let mut initial_config = BTreeMap::new(); initial_config.insert("theme".to_owned(), "dark".to_owned()); @@ -11963,7 +11979,7 @@ pub fn plugin_does_not_receive_event_when_config_unchanged() { let temp_folder = tempdir().unwrap(); let plugin_host_folder = PathBuf::from(temp_folder.path()); let cache_path = plugin_host_folder.join("permissions_test.kdl"); - let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None); + let (plugin_thread_sender, screen_receiver, teardown) = create_plugin_thread(None, None); // Initial plugin configuration let mut initial_config = BTreeMap::new(); @@ -12067,3 +12083,102 @@ pub fn plugin_does_not_receive_event_when_config_unchanged() { "Plugin should NOT receive PluginConfigurationChanged when config unchanged" ); } + +#[test] +#[ignore] +pub fn get_session_environment_variables_plugin_command() { + let temp_folder = tempdir().unwrap(); + let plugin_host_folder = PathBuf::from(temp_folder.path()); + let cache_path = plugin_host_folder.join("permissions_test.kdl"); + + let mut test_env_vars = std::collections::BTreeMap::new(); + test_env_vars.insert("TEST_ENV_VAR_1".to_string(), "test_value_123".to_string()); + test_env_vars.insert( + "TEST_ENV_VAR_2".to_string(), + "another_test_value".to_string(), + ); + test_env_vars.insert("PATH".to_string(), "/usr/bin:/bin".to_string()); + + let (plugin_thread_sender, screen_receiver, teardown) = + create_plugin_thread(Some(plugin_host_folder.clone()), Some(test_env_vars)); + + let received_screen_instructions = Arc::new(Mutex::new(vec![])); + let screen_thread = grant_permissions_and_log_actions_in_thread!( + received_screen_instructions, + ScreenInstruction::PluginBytes, + screen_receiver, + 2, + &PermissionType::ReadSessionEnvironmentVariables, + cache_path, + plugin_thread_sender, + 1 + ); + + let plugin_should_float = Some(false); + let plugin_title = Some("test_plugin".to_owned()); + let run_plugin = RunPluginOrAlias::RunPlugin(RunPlugin { + _allow_exec_host_cmd: false, + location: RunPluginLocation::File(PathBuf::from(&*PLUGIN_FIXTURE)), + configuration: Default::default(), + ..Default::default() + }); + let tab_index = 1; + let client_id = 1; + let size = Size { + cols: 121, + rows: 20, + }; + + let _ = plugin_thread_sender.send(PluginInstruction::AddClient(client_id)); + let _ = plugin_thread_sender.send(PluginInstruction::Load( + plugin_should_float, + false, + plugin_title, + run_plugin, + Some(tab_index), + None, + client_id, + size, + None, + None, + false, + None, + None, + None, + )); + + std::thread::sleep(std::time::Duration::from_millis(500)); + + let _ = plugin_thread_sender.send(PluginInstruction::Update(vec![( + None, + Some(client_id), + Event::Key( + KeyWithModifier::new(BareKey::Char('j')) + .with_ctrl_modifier() + .with_shift_modifier(), + ), + )])); + + screen_thread.join().unwrap(); + teardown(); + + let plugin_bytes_event = received_screen_instructions + .lock() + .unwrap() + .iter() + .find_map(|i| { + if let ScreenInstruction::PluginBytes(plugin_render_assets) = i { + for plugin_render_asset in plugin_render_assets { + let plugin_bytes = plugin_render_asset.bytes.clone(); + let plugin_bytes = String::from_utf8_lossy(plugin_bytes.as_slice()).to_string(); + if plugin_bytes.contains("Got") + && plugin_bytes.contains("environment variables") + { + return Some(plugin_bytes); + } + } + } + None + }); + assert_snapshot!(format!("{:#?}", plugin_bytes_event)); +} diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__get_session_environment_variables_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__get_session_environment_variables_plugin_command.snap new file mode 100644 index 000000000..0c4c5c9c8 --- /dev/null +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__get_session_environment_variables_plugin_command.snap @@ -0,0 +1,7 @@ +--- +source: zellij-server/src/plugins/./unit/plugin_tests.rs +expression: "format!(\"{:#?}\", plugin_bytes_event)" +--- +Some( + "Got environment variables: {\n\r \"PATH\": \"/usr/bin:/bin\",\n\r \"TEST_ENV_VAR_1\": \"test_value_123\",\n\r \"TEST_ENV_VAR_2\": \"another_test_value\",\n\r}\n\r", +) diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__granted_permission_request_result.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__granted_permission_request_result.snap index 91ec8a9bc..b5999ae93 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__granted_permission_request_result.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__granted_permission_request_result.snap @@ -16,5 +16,6 @@ Some( Reconfigure, RunActionsAsUser, WriteToClipboard, + ReadSessionEnvironmentVariables, ], ) diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__request_plugin_permissions.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__request_plugin_permissions.snap index 1400f0813..895c0dab0 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__request_plugin_permissions.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__request_plugin_permissions.snap @@ -18,5 +18,6 @@ Some( Reconfigure, WriteToClipboard, RunActionsAsUser, + ReadSessionEnvironmentVariables, ], ) diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs index 4cca6e5d9..8a95d3dbb 100644 --- a/zellij-server/src/plugins/wasm_bridge.rs +++ b/zellij-server/src/plugins/wasm_bridge.rs @@ -90,6 +90,7 @@ pub struct LoadingContext { pub plugin_config: PluginConfig, pub tab_index: Option, pub path_to_default_shell: PathBuf, + pub session_env_vars: std::collections::BTreeMap, pub capabilities: PluginCapabilities, pub client_attributes: ClientAttributes, pub default_shell: Option, @@ -131,6 +132,7 @@ impl LoadingContext { client_id, plugin_id, 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(), @@ -172,6 +174,7 @@ pub struct WasmBridge { path_to_default_shell: PathBuf, watcher: Option>, zellij_cwd: PathBuf, + session_env_vars: std::collections::BTreeMap, capabilities: PluginCapabilities, client_attributes: ClientAttributes, default_shell: Option, @@ -197,6 +200,7 @@ impl WasmBridge { plugin_dir: PathBuf, path_to_default_shell: PathBuf, zellij_cwd: PathBuf, + session_env_vars: std::collections::BTreeMap, capabilities: PluginCapabilities, client_attributes: ClientAttributes, default_shell: Option, @@ -239,6 +243,7 @@ impl WasmBridge { loading_plugins: HashSet::new(), pending_plugin_reloads: HashSet::new(), zellij_cwd, + session_env_vars, capabilities, client_attributes, default_shell, diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index 650892f43..0f0fc3510 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -79,8 +79,8 @@ use zellij_utils::{ ProtobufFocusOrCreateTabResponse, ProtobufGenerateRandomNameResponse, ProtobufGetFocusedPaneInfoResponse, ProtobufGetLayoutDirResponse, ProtobufGetPaneCwdResponse, ProtobufGetPaneInfoResponse, ProtobufGetPanePidResponse, - ProtobufGetPaneRunningCommandResponse, ProtobufGetTabInfoResponse, - ProtobufNewTabResponse, ProtobufNewTabsResponse, + ProtobufGetPaneRunningCommandResponse, ProtobufGetSessionEnvironmentVariablesResponse, + ProtobufGetTabInfoResponse, ProtobufNewTabResponse, ProtobufNewTabsResponse, ProtobufOpenCommandPaneBackgroundResponse, ProtobufOpenCommandPaneFloatingNearPluginResponse, ProtobufOpenCommandPaneFloatingResponse, @@ -660,6 +660,9 @@ fn host_run_plugin_command(mut caller: Caller<'_, PluginEnv>) { suppress_replaced_pane, ), PluginCommand::RunAction(action, context) => run_action(&env, action, context), + PluginCommand::GetSessionEnvironmentVariables => { + get_session_environment_variables(env); + }, }, (PermissionStatus::Denied, permission) => { log::error!( @@ -887,6 +890,30 @@ fn get_layout_dir(env: &PluginEnv) { .non_fatal(); } +fn get_session_environment_variables(env: &PluginEnv) { + use zellij_utils::plugin_api::plugin_command::EnvVariable as ProtobufEnvVariable; + + let env_vars: Vec = env + .session_env_vars + .iter() + .map(|(name, value)| ProtobufEnvVariable { + name: name.clone(), + value: value.clone(), + }) + .collect(); + + let response = ProtobufGetSessionEnvironmentVariablesResponse { env_vars }; + + wasi_write_object(env, &response.encode_to_vec()) + .with_context(|| { + format!( + "failed to send session environment variables to plugin {}", + env.name() + ) + }) + .non_fatal(); +} + fn get_focused_pane_info(env: &PluginEnv) { use crossbeam::channel::RecvTimeoutError; use std::time::Duration; @@ -4618,6 +4645,9 @@ fn check_command_permission( }, PluginCommand::GetPaneScrollback { .. } => PermissionType::ReadPaneContents, PluginCommand::RunAction(..) => PermissionType::RunActionsAsUser, + PluginCommand::GetSessionEnvironmentVariables => { + PermissionType::ReadSessionEnvironmentVariables + }, _ => return (PermissionStatus::Granted, None), }; diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index 5b3d5d428..4ac4b8a4b 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -19,7 +19,8 @@ use zellij_utils::plugin_api::plugin_command::{ ProtobufEditLayoutResponse, ProtobufFocusOrCreateTabResponse, ProtobufGenerateRandomNameResponse, ProtobufGetFocusedPaneInfoResponse, ProtobufGetLayoutDirResponse, ProtobufGetPaneCwdResponse, ProtobufGetPaneInfoResponse, - ProtobufGetPanePidResponse, ProtobufGetPaneRunningCommandResponse, ProtobufGetTabInfoResponse, + ProtobufGetPanePidResponse, ProtobufGetPaneRunningCommandResponse, + ProtobufGetSessionEnvironmentVariablesResponse, ProtobufGetTabInfoResponse, ProtobufNewTabResponse, ProtobufNewTabsResponse, ProtobufOpenCommandPaneBackgroundResponse, ProtobufOpenCommandPaneFloatingNearPluginResponse, ProtobufOpenCommandPaneFloatingResponse, ProtobufOpenCommandPaneInPlaceOfPluginResponse, ProtobufOpenCommandPaneInPlaceResponse, @@ -176,6 +177,25 @@ pub fn get_layout_dir() -> String { response.layout_dir } +pub fn get_session_environment_variables() -> BTreeMap { + let plugin_command = PluginCommand::GetSessionEnvironmentVariables; + let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); + + object_to_stdout(&protobuf_plugin_command.encode_to_vec()); + unsafe { host_run_plugin_command() }; + + let response = ProtobufGetSessionEnvironmentVariablesResponse::decode( + bytes_from_stdin().unwrap().as_slice(), + ) + .unwrap(); + + response + .env_vars + .into_iter() + .map(|env_var| (env_var.name, env_var.value)) + .collect() +} + /// Returns the focused pane ID and tab index for the client associated with this plugin. pub fn get_focused_pane_info() -> Result<(usize, PaneId), String> { let plugin_command = PluginCommand::GetFocusedPaneInfo; diff --git a/zellij-utils/assets/prost/api.plugin_command.rs b/zellij-utils/assets/prost/api.plugin_command.rs index 90023ef13..1d1d0288a 100644 --- a/zellij-utils/assets/prost/api.plugin_command.rs +++ b/zellij-utils/assets/prost/api.plugin_command.rs @@ -3,7 +3,7 @@ pub struct PluginCommand { #[prost(enumeration="CommandName", tag="1")] pub name: i32, - #[prost(oneof="plugin_command::Payload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147")] + #[prost(oneof="plugin_command::Payload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148")] pub payload: ::core::option::Option, } /// Nested message and enum types in `PluginCommand`. @@ -277,6 +277,8 @@ pub mod plugin_command { RenameTabWithIdPayload(super::RenameTabWithIdPayload), #[prost(message, tag="147")] BreakPanesToTabWithIdPayload(super::BreakPanesToTabWithIdPayload), + #[prost(message, tag="148")] + GetSessionEnvironmentVariablesPayload(super::GetSessionEnvironmentVariablesPayload), } } #[allow(clippy::derive_partial_eq_without_eq)] @@ -1624,6 +1626,16 @@ pub struct OpenCommandPaneBackgroundResponse { #[prost(message, optional, tag="1")] pub pane_id: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSessionEnvironmentVariablesPayload { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSessionEnvironmentVariablesResponse { + #[prost(message, repeated, tag="1")] + pub env_vars: ::prost::alloc::vec::Vec, +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum CommandName { @@ -1803,6 +1815,7 @@ pub enum CommandName { CloseTabWithId = 194, RenameTabWithId = 195, BreakPanesToTabWithId = 196, + GetSessionEnvironmentVariables = 197, } impl CommandName { /// String value of the enum field names used in the ProtoBuf definition. @@ -1987,6 +2000,7 @@ impl CommandName { CommandName::CloseTabWithId => "CloseTabWithId", CommandName::RenameTabWithId => "RenameTabWithId", CommandName::BreakPanesToTabWithId => "BreakPanesToTabWithId", + CommandName::GetSessionEnvironmentVariables => "GetSessionEnvironmentVariables", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -2168,6 +2182,7 @@ impl CommandName { "CloseTabWithId" => Some(Self::CloseTabWithId), "RenameTabWithId" => Some(Self::RenameTabWithId), "BreakPanesToTabWithId" => Some(Self::BreakPanesToTabWithId), + "GetSessionEnvironmentVariables" => Some(Self::GetSessionEnvironmentVariables), _ => None, } } diff --git a/zellij-utils/assets/prost/api.plugin_permission.rs b/zellij-utils/assets/prost/api.plugin_permission.rs index e113273a9..5da4fcf81 100644 --- a/zellij-utils/assets/prost/api.plugin_permission.rs +++ b/zellij-utils/assets/prost/api.plugin_permission.rs @@ -17,6 +17,7 @@ pub enum PermissionType { ReadPaneContents = 13, RunActionsAsUser = 14, WriteToClipboard = 15, + ReadSessionEnvironmentVariables = 16, } impl PermissionType { /// String value of the enum field names used in the ProtoBuf definition. @@ -41,6 +42,7 @@ impl PermissionType { PermissionType::ReadPaneContents => "ReadPaneContents", PermissionType::RunActionsAsUser => "RunActionsAsUser", PermissionType::WriteToClipboard => "WriteToClipboard", + PermissionType::ReadSessionEnvironmentVariables => "ReadSessionEnvironmentVariables", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -62,6 +64,7 @@ impl PermissionType { "ReadPaneContents" => Some(Self::ReadPaneContents), "RunActionsAsUser" => Some(Self::RunActionsAsUser), "WriteToClipboard" => Some(Self::WriteToClipboard), + "ReadSessionEnvironmentVariables" => Some(Self::ReadSessionEnvironmentVariables), _ => None, } } diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index 1a035edc6..b770eee0c 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -1055,6 +1055,7 @@ pub enum Permission { ReadPaneContents, RunActionsAsUser, WriteToClipboard, + ReadSessionEnvironmentVariables, } impl PermissionType { @@ -1086,6 +1087,9 @@ impl PermissionType { }, PermissionType::RunActionsAsUser => "Execute actions as the user".to_owned(), PermissionType::WriteToClipboard => "Write to clipboard".to_owned(), + PermissionType::ReadSessionEnvironmentVariables => { + "Read environment variables present upon session creation".to_owned() + }, } } } @@ -3445,6 +3449,7 @@ pub enum PluginCommand { CurrentSessionLastSavedTime, GetPaneInfo(PaneId), GetTabInfo(usize), // tab_id + GetSessionEnvironmentVariables, } // Response types for plugin API methods that create tabs diff --git a/zellij-utils/src/plugin_api/plugin_command.proto b/zellij-utils/src/plugin_api/plugin_command.proto index a2a25f992..660992988 100644 --- a/zellij-utils/src/plugin_api/plugin_command.proto +++ b/zellij-utils/src/plugin_api/plugin_command.proto @@ -189,6 +189,7 @@ enum CommandName { CloseTabWithId = 194; RenameTabWithId = 195; BreakPanesToTabWithId = 196; + GetSessionEnvironmentVariables = 197; } message PluginCommand { @@ -327,6 +328,7 @@ message PluginCommand { CloseTabWithIdPayload close_tab_with_id_payload = 145; RenameTabWithIdPayload rename_tab_with_id_payload = 146; BreakPanesToTabWithIdPayload break_panes_to_tab_with_id_payload = 147; + GetSessionEnvironmentVariablesPayload get_session_environment_variables_payload = 148; } } @@ -1123,3 +1125,9 @@ message OpenCommandPaneInPlaceOfPluginResponse { message OpenCommandPaneBackgroundResponse { optional PaneId pane_id = 1; } + +message GetSessionEnvironmentVariablesPayload {} + +message GetSessionEnvironmentVariablesResponse { + repeated EnvVariable env_vars = 1; +} diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs index 6ade33763..94f5e1e13 100644 --- a/zellij-utils/src/plugin_api/plugin_command.rs +++ b/zellij-utils/src/plugin_api/plugin_command.rs @@ -41,8 +41,10 @@ pub use super::generated_api::api::{ GetPanePidResponse as ProtobufGetPanePidResponse, GetPaneRunningCommandPayload as ProtobufGetPaneRunningCommandPayload, GetPaneRunningCommandResponse as ProtobufGetPaneRunningCommandResponse, - GetPaneScrollbackPayload, GetTabInfoPayload, - GetTabInfoResponse as ProtobufGetTabInfoResponse, GoToTabWithIdPayload, + GetPaneScrollbackPayload, + GetSessionEnvironmentVariablesPayload as ProtobufGetSessionEnvironmentVariablesPayload, + GetSessionEnvironmentVariablesResponse as ProtobufGetSessionEnvironmentVariablesResponse, + GetTabInfoPayload, GetTabInfoResponse as ProtobufGetTabInfoResponse, GoToTabWithIdPayload, GroupAndUngroupPanesPayload, HidePaneWithIdPayload, HighlightAndUnhighlightPanesPayload, HttpVerb as ProtobufHttpVerb, IdAndNewName, KeyToRebind, KeyToUnbind, KillSessionsPayload, ListTokensResponse, LoadNewPluginPayload, MessageToPluginPayload, @@ -2259,6 +2261,14 @@ impl TryFrom for PluginCommand { }, _ => Err("Malformed payload for GetTabInfo"), }, + Some(CommandName::GetSessionEnvironmentVariables) => { + match protobuf_plugin_command.payload { + Some(Payload::GetSessionEnvironmentVariablesPayload(_)) => { + Ok(PluginCommand::GetSessionEnvironmentVariables) + }, + _ => Err("Mismatched payload for GetSessionEnvironmentVariables"), + } + }, None => Err("Unrecognized plugin command"), } } @@ -3680,6 +3690,13 @@ impl TryFrom for ProtobufPluginCommand { tab_id: tab_id as u64, })), }), + PluginCommand::GetSessionEnvironmentVariables => { + let payload = ProtobufGetSessionEnvironmentVariablesPayload {}; + Ok(ProtobufPluginCommand { + name: CommandName::GetSessionEnvironmentVariables as i32, + payload: Some(Payload::GetSessionEnvironmentVariablesPayload(payload)), + }) + }, } } } diff --git a/zellij-utils/src/plugin_api/plugin_permission.proto b/zellij-utils/src/plugin_api/plugin_permission.proto index 779f6b321..ff286ea01 100644 --- a/zellij-utils/src/plugin_api/plugin_permission.proto +++ b/zellij-utils/src/plugin_api/plugin_permission.proto @@ -19,4 +19,5 @@ enum PermissionType { ReadPaneContents = 13; RunActionsAsUser = 14; WriteToClipboard = 15; + ReadSessionEnvironmentVariables = 16; } diff --git a/zellij-utils/src/plugin_api/plugin_permission.rs b/zellij-utils/src/plugin_api/plugin_permission.rs index 37782a086..3bd853004 100644 --- a/zellij-utils/src/plugin_api/plugin_permission.rs +++ b/zellij-utils/src/plugin_api/plugin_permission.rs @@ -31,6 +31,9 @@ impl TryFrom for PermissionType { ProtobufPermissionType::ReadPaneContents => Ok(PermissionType::ReadPaneContents), ProtobufPermissionType::RunActionsAsUser => Ok(PermissionType::RunActionsAsUser), ProtobufPermissionType::WriteToClipboard => Ok(PermissionType::WriteToClipboard), + ProtobufPermissionType::ReadSessionEnvironmentVariables => { + Ok(PermissionType::ReadSessionEnvironmentVariables) + }, } } } @@ -63,6 +66,9 @@ impl TryFrom for ProtobufPermissionType { PermissionType::ReadPaneContents => Ok(ProtobufPermissionType::ReadPaneContents), PermissionType::RunActionsAsUser => Ok(ProtobufPermissionType::RunActionsAsUser), PermissionType::WriteToClipboard => Ok(ProtobufPermissionType::WriteToClipboard), + PermissionType::ReadSessionEnvironmentVariables => { + Ok(ProtobufPermissionType::ReadSessionEnvironmentVariables) + }, } } }