summaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/lib.rs8
-rw-r--r--zellij-server/src/plugins/mod.rs10
-rw-r--r--zellij-server/src/plugins/plugin_loader.rs72
-rw-r--r--zellij-server/src/plugins/plugin_map.rs11
-rw-r--r--zellij-server/src/plugins/unit/plugin_tests.rs3226
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__can_subscribe_to_hd_events.snap4
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__clear_screen_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__close_focus_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__close_focused_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__detach_plugin_command.snap12
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__edit_scrollback_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_next_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_or_create_tab_plugin_command.snap19
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__focus_previous_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_next_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_previous_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__go_to_tab_name_plugin_command.snap19
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__hide_self_plugin_command.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_focus_or_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_focus_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__move_pane_with_direction_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tab_plugin_command.snap19
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command-2.snap60
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__new_tabs_with_layout_plugin_command.snap60
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__next_swap_layout_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_floating_plugin_command.snap30
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_plugin_command.snap30
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap25
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap25
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap27
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap27
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_flie_plugin_command.snap25
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_floating_plugin_command.snap29
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_plugin_command.snap29
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__page_scroll_down_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__page_scroll_up_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__previous_swap_layout_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__quit_zellij_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__resize_focused_pane_plugin_command.snap15
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__resize_focused_pane_with_direction_plugin_command.snap17
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_down_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_to_bottom_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_to_top_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__scroll_up_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__start_or_reload_plugin.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_mode_plugin_command.snap79
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_to_tab_plugin_command.snap13
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_active_tab_sync_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_focus_fullscreen_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_pane_embed_or_eject_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_pane_frames_plugin_command.snap8
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__toggle_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__undo_rename_pane_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__undo_rename_tab_plugin_command.snap10
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__write_chars_plugin_command.snap17
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__write_plugin_command.snap15
-rw-r--r--zellij-server/src/plugins/wasm_bridge.rs42
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs650
-rw-r--r--zellij-server/src/route.rs302
-rw-r--r--zellij-server/src/screen.rs10
-rw-r--r--zellij-server/src/unit/screen_tests.rs352
63 files changed, 5043 insertions, 553 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs
index 4e4911429..9707e61e6 100644
--- a/zellij-server/src/lib.rs
+++ b/zellij-server/src/lib.rs
@@ -778,6 +778,9 @@ fn init_session(
let store = get_store();
let layout = layout.clone();
+ let client_attributes = client_attributes.clone();
+ let default_shell = default_shell.clone();
+ let capabilities = capabilities.clone();
move || {
plugin_thread_main(
plugin_bus,
@@ -787,6 +790,9 @@ fn init_session(
layout,
path_to_default_shell,
zellij_cwd,
+ capabilities,
+ client_attributes,
+ default_shell,
)
.fatal()
}
@@ -834,7 +840,7 @@ fn init_session(
to_plugin: Some(to_plugin),
to_pty_writer: Some(to_pty_writer),
to_background_jobs: Some(to_background_jobs),
- to_server: None,
+ to_server: Some(to_server),
should_silently_fail: false,
},
capabilities,
diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs
index 7b322b054..55e97f031 100644
--- a/zellij-server/src/plugins/mod.rs
+++ b/zellij-server/src/plugins/mod.rs
@@ -14,13 +14,14 @@ use crate::{pty::PtyInstruction, thread_bus::Bus, ClientId, ServerInstruction};
use wasm_bridge::WasmBridge;
use zellij_utils::{
- data::Event,
+ data::{Event, PluginCapabilities},
errors::{prelude::*, ContextType, PluginContext},
input::{
command::TerminalAction,
layout::{FloatingPaneLayout, Layout, Run, RunPlugin, RunPluginLocation, TiledPaneLayout},
plugins::PluginsConfig,
},
+ ipc::ClientAttributes,
pane_size::Size,
};
@@ -108,6 +109,9 @@ pub(crate) fn plugin_thread_main(
layout: Box<Layout>,
path_to_default_shell: PathBuf,
zellij_cwd: PathBuf,
+ capabilities: PluginCapabilities,
+ client_attributes: ClientAttributes,
+ default_shell: Option<TerminalAction>,
) -> Result<()> {
info!("Wasm main thread starts");
@@ -121,6 +125,10 @@ pub(crate) fn plugin_thread_main(
plugin_dir,
path_to_default_shell,
zellij_cwd,
+ capabilities,
+ client_attributes,
+ default_shell,
+ layout.clone(),
);
loop {
diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs
index 4d77bd9e9..324b540d5 100644
--- a/zellij-server/src/plugins/plugin_loader.rs
+++ b/zellij-server/src/plugins/plugin_loader.rs
@@ -22,8 +22,12 @@ use crate::{
use zellij_utils::{
consts::{VERSION, ZELLIJ_CACHE_DIR, ZELLIJ_SESSION_CACHE_DIR, ZELLIJ_TMP_DIR},
+ data::PluginCapabilities,
errors::prelude::*,
+ input::command::TerminalAction,
+ input::layout::Layout,
input::plugins::PluginConfig,
+ ipc::ClientAttributes,
pane_size::Size,
};
@@ -165,6 +169,10 @@ pub struct PluginLoader<'a> {
wasm_blob_on_hd: Option<(Vec<u8>, PathBuf)>,
path_to_default_shell: PathBuf,
zellij_cwd: PathBuf,
+ capabilities: PluginCapabilities,
+ client_attributes: ClientAttributes,
+ default_shell: Option<TerminalAction>,
+ default_layout: Box<Layout>,
}
impl<'a> PluginLoader<'a> {
@@ -179,6 +187,10 @@ impl<'a> PluginLoader<'a> {
loading_indication: &mut LoadingIndication,
path_to_default_shell: PathBuf,
zellij_cwd: PathBuf,
+ capabilities: PluginCapabilities,
+ client_attributes: ClientAttributes,
+ default_shell: Option<TerminalAction>,
+ default_layout: Box<Layout>,
) -> Result<()> {
let err_context = || format!("failed to reload plugin {plugin_id} from memory");
let mut connected_clients: Vec<ClientId> =
@@ -199,6 +211,10 @@ impl<'a> PluginLoader<'a> {
&plugin_dir,
path_to_default_shell,
zellij_cwd,
+ capabilities,
+ client_attributes,
+ default_shell,
+ default_layout,
)?;
plugin_loader
.load_module_from_memory()
@@ -234,6 +250,10 @@ impl<'a> PluginLoader<'a> {
loading_indication: &mut LoadingIndication,
path_to_default_shell: PathBuf,
zellij_cwd: PathBuf,
+ capabilities: PluginCapabilities,
+ client_attributes: ClientAttributes,
+ default_shell: Option<TerminalAction>,
+ default_layout: Box<Layout>,
) -> Result<()> {
let err_context = || format!("failed to start plugin {plugin_id} for client {client_id}");
let mut plugin_loader = PluginLoader::new(
@@ -249,6 +269,10 @@ impl<'a> PluginLoader<'a> {
size,
path_to_default_shell,
zellij_cwd,
+ capabilities,
+ client_attributes,
+ default_shell,
+ default_layout,
)?;
plugin_loader
.load_module_from_memory()
@@ -284,6 +308,10 @@ impl<'a> PluginLoader<'a> {
loading_indication: &mut LoadingIndication,
path_to_default_shell: PathBuf,
zellij_cwd: PathBuf,
+ capabilities: PluginCapabilities,
+ client_attributes: ClientAttributes,
+ default_shell: Option<TerminalAction>,
+ default_layout: Box<Layout>,
) -> Result<()> {
let mut new_plugins = HashSet::new();
for plugin_id in plugin_map.lock().unwrap().plugin_ids() {
@@ -301,6 +329,10 @@ impl<'a> PluginLoader<'a> {
&plugin_dir,
path_to_default_shell.clone(),
zellij_cwd.clone(),
+ capabilities.clone(),
+ client_attributes.clone(),
+ default_shell.clone(),
+ default_layout.clone(),
)?;
plugin_loader
.load_module_from_memory()
@@ -329,6 +361,10 @@ impl<'a> PluginLoader<'a> {
loading_indication: &mut LoadingIndication,
path_to_default_shell: PathBuf,
zellij_cwd: PathBuf,
+ capabilities: PluginCapabilities,
+ client_attributes: ClientAttributes,
+ default_shell: Option<TerminalAction>,
+ default_layout: Box<Layout>,
) -> Result<()> {
let err_context = || format!("failed to reload plugin id {plugin_id}");
@@ -350,6 +386,10 @@ impl<'a> PluginLoader<'a> {
&plugin_dir,
path_to_default_shell,
zellij_cwd,
+ capabilities,