diff options
| author | Aram Drevekenin <aram@poor.dev> | 2025-09-24 12:56:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-24 12:56:56 +0200 |
| commit | 533140831d825829afaf864d940c435056788d3e (patch) | |
| tree | 9fe6b7da3955663c8373776499f85addfd044d40 | |
| parent | refactor(client-server-contract): config + layout (#4383) (diff) | |
| download | sl0ppij-533140831d825829afaf864d940c435056788d3e.tar.gz sl0ppij-533140831d825829afaf864d940c435056788d3e.tar.xz sl0ppij-533140831d825829afaf864d940c435056788d3e.zip | |
fix(ipc): make sessions compatible between versions (#4439)
* translate ipc tuple enum variants to struct enum variants
* initial client/server contract
* tests and missing types
* migrate web server and remove rmp_serde
* change socket folder
* fix crash on unknown messages
* fix client logout on unknown message
* fix web client logout on unknown message
* rustfmt
* add comment and change log level
* address compilation warnings
* style(fmt): rustfmt
* fix plugin system test assertions
* add pr
71 files changed, 18138 insertions, 6979 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aa388aa..d7fc1a20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] * fix: meta key handling in web client (https://github.com/zellij-org/zellij/pull/4376) * refactor: move logical structures from client to server (https://github.com/zellij-org/zellij/pull/4383) +* fix: make sessions compatible across versions (https://github.com/zellij-org/zellij/pull/4439) ## [0.43.1] - 2025-08-08 * fix: pane rename backspace regression (https://github.com/zellij-org/zellij/pull/4346) @@ -3447,28 +3447,6 @@ dependencies = [ ] [[package]] -name = "rmp" -version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4" -dependencies = [ - "byteorder", - "num-traits", - "paste", -] - -[[package]] -name = "rmp-serde" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - -[[package]] name = "rusqlite" version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5799,7 +5777,6 @@ dependencies = [ "nix 0.23.1", "notify", "regex", - "rmp-serde", "serde", "serde_json", "serde_yaml", @@ -5917,7 +5894,6 @@ dependencies = [ "percent-encoding", "prost", "prost-build", - "rmp-serde", "rusqlite", "serde", "serde_json", @@ -94,7 +94,6 @@ uuid = { version = "1.4.1", default-features = false, features = ["serde", "v4", vte = { version = "0.11.0", default-features = false } names = { version = "0.14.0", default-features = false } include_dir = { version = "0.7.3", default-features = false } -rmp-serde = { version = "1.1.0", default-features = false } sha2 = { version = "0.10", default-features = false } zellij-utils = { path = "zellij-utils/", version = "0.44.0" } diff --git a/default-plugins/compact-bar/src/action_types.rs b/default-plugins/compact-bar/src/action_types.rs index ddc91ead..8a4de277 100644 --- a/default-plugins/compact-bar/src/action_types.rs +++ b/default-plugins/compact-bar/src/action_types.rs @@ -94,22 +94,35 @@ impl ActionType { pub fn from_action(action: &Action) -> Self { match action { - Action::MoveFocus(_) => ActionType::MoveFocus, - Action::MovePane(Some(_)) => ActionType::MovePaneWithDirection, - Action::MovePane(None) => ActionType::MovePaneWithoutDirection, - Action::Resize(Resize::Increase, Some(_)) => ActionType::ResizeIncrease, - Action::Resize(Resize::Decrease, Some(_)) => ActionType::ResizeDecrease, - Action::Resize(_, None) => ActionType::ResizeAny, - Action::Search(_) => ActionType::Search, - Action::NewPane(Some(_), _, _) => ActionType::NewPaneWithDirection, - Action::NewPane(None, _, _) => ActionType::NewPaneWithoutDirection, - Action::NewStackedPane(_, _) => ActionType::NewStackedPane, + Action::MoveFocus { .. } => ActionType::MoveFocus, + Action::MovePane { direction: Some(_) } => ActionType::MovePaneWithDirection, + Action::MovePane { direction: None } => ActionType::MovePaneWithoutDirection, + Action::Resize { + resize: Resize::Increase, + direction: Some(_), + } => ActionType::ResizeIncrease, + Action::Resize { + resize: Resize::Decrease, + direction: Some(_), + } => ActionType::ResizeDecrease, + Action::Resize { + resize: _, + direction: None, + } => ActionType::ResizeAny, + Action::Search { .. } => ActionType::Search, + Action::NewPane { + direction: Some(_), .. + } => ActionType::NewPaneWithDirection, + Action::NewPane { + direction: None, .. + } => ActionType::NewPaneWithoutDirection, + Action::NewStackedPane { .. } => ActionType::NewStackedPane, Action::BreakPaneLeft | Action::BreakPaneRight => ActionType::BreakPaneLeftOrRight, Action::GoToPreviousTab | Action::GoToNextTab => ActionType::GoToAdjacentTab, Action::ScrollUp | Action::ScrollDown => ActionType::Scroll, Action::PageScrollUp | Action::PageScrollDown => ActionType::PageScroll, Action::HalfPageScrollUp | Action::HalfPageScrollDown => ActionType::HalfPageScroll, - Action::SwitchToMode(input_mode) => ActionType::SwitchToMode(*input_mode), + Action::SwitchToMode { input_mode } => ActionType::SwitchToMode(*input_mode), Action::TogglePaneEmbedOrFloating => ActionType::TogglePaneEmbedOrFloating, Action::ToggleFocusFullscreen => ActionType::ToggleFocusFullscreen, Action::ToggleFloatingPanes => ActionType::ToggleFloatingPanes, @@ -125,7 +138,7 @@ impl ActionType { action if action.launches_plugin("configuration") => ActionType::Configuration, action if action.launches_plugin("plugin-manager") => ActionType::PluginManager, action if action.launches_plugin("zellij:about") => ActionType::About, - action if matches!(action, Action::NewTab(..)) => ActionType::NewTab, + action if matches!(action, Action::NewTab { .. }) => ActionType::NewTab, _ => ActionType::Other(format!("{:?}", action)), } } diff --git a/default-plugins/compact-bar/src/keybind_utils.rs b/default-plugins/compact-bar/src/keybind_utils.rs index 68014169..aeb862d1 100644 --- a/default-plugins/compact-bar/src/keybind_utils.rs +++ b/default-plugins/compact-bar/src/keybind_utils.rs @@ -50,8 +50,12 @@ impl KeybindProcessor { let should_add_brackets_to_keys = mode != InputMode::Normal; // Check if this is switching to normal mode - let is_switching_to_locked = - matches!(first_action, Action::SwitchToMode(InputMode::Locked)); + let is_switching_to_locked = matches!( + first_action, + Action::SwitchToMode { + input_mode: InputMode::Locked + } + ); let grouped_keys = Self::group_key_sets( &matching_keys, @@ -304,41 +308,161 @@ impl KeybindProcessor { match mode { InputMode::Locked => { let ordered_predicates = vec![|action: &Action| { - matches!(action, Action::SwitchToMode(InputMode::Normal)) + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Normal + } + ) }]; Self::find_predetermined_actions(mode_info, mode, ordered_predicates) }, InputMode::Normal => { let ordered_predicates = vec![ - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::Locked)), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::Pane)), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::Tab)), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::Resize)), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::Move)), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::Scroll)), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::Session)), + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Locked + } + ) + }, + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Pane + } + ) + }, + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Tab + } + ) + }, + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Resize + } + ) + }, + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Move + } + ) + }, + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Scroll + } + ) + }, + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::Session + } + ) + }, |action: &Action| matches!(action, Action::Quit), ]; Self::find_predetermined_actions(mode_info, mode, ordered_predicates) }, InputMode::Pane => { let ordered_predicates = vec![ - |action: &Action| matches!(action, Action::NewPane(None, None, false)), - |action: &Action| matches!(action, Action::MoveFocus(Direction::Left)), - |action: &Action| matches!(action, Action::MoveFocus(Direction::Down)), - |action: &Action| matches!(action, Action::MoveFocus(Direction::Up)), - |action: &Action| matches!(action, Action::MoveFocus(Direction::Right)), + |action: &Action| { + matches!( + action, + Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false + } + ) + }, + |action: &Action| { + matches!( + action, + Action::MoveFocus { + direction: Direction::Left + } + ) + }, + |action: &Action| { + matches!( + action, + Action::MoveFocus { + direction: Direction::Down + } + ) + }, + |action: &Action| { + matches!( + action, + Action::MoveFocus { + direction: Direction::Up + } + ) + }, + |action: &Action| { + matches!( + action, + Action::MoveFocus { + direction: Direction::Right + } + ) + }, |action: &Action| matches!(action, Action::CloseFocus), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::RenamePane)), + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::RenamePane + } + ) + }, |action: &Action| matches!(action, Action::ToggleFocusFullscreen), |action: &Action| matches!(action, Action::ToggleFloatingPanes), |action: &Action| matches!(action, Action::TogglePaneEmbedOrFloating), - |action: &Action| matches!(action, Action::NewStackedPane(None, None)), |action: &Action| { - matches!(action, Action::NewPane(Some(Direction::Right), None, false)) + matches!( + action, + Action::NewStackedPane { + command: None, + pane_name: None + } + ) }, |action: &Action| { - matches!(action, Action::NewPane(Some(Direction::Down), None, false)) + matches!( + action, + Action::NewPane { + direction: Some(Direction::Right), + pane_name: None, + start_suppressed: false + } + ) + }, + |action: &Action| { + matches!( + action, + Action::NewPane { + direction: Some(Direction::Down), + pane_name: None, + start_suppressed: false + } + ) }, ]; Self::find_predetermined_actions(mode_info, mode, ordered_predicates) @@ -350,12 +474,27 @@ impl KeybindProcessor { |action: &Action| { matches!( action, - Action::NewTab(None, _, None, None, None, true, None) + Action::NewTab { + tiled_layout: None, + floating_layouts: _, + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None + } ) }, |action: &Action| matches!(action, Action::CloseTab), - |action: &Action| matches!(action, Action::SwitchToMode(InputMode::RenameTab)), - |action: &Action| matches!(action, Action::TabNameInput(_)), + |action: &Action| { + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::RenameTab + } + ) + }, + |action: &Action| matches!(action, Action::TabNameInput { .. }), |action: &Action| matches!(action, Action::ToggleActiveSyncTab), |action: &Action| matches!(action, Action::BreakPane), |action: &Action| matches!(action, Action::BreakPaneLeft), @@ -366,54 +505,94 @@ impl KeybindProcessor { }, InputMode::Resize => { let ordered_predicates = vec![ - |action: &Action| matches!(action, Action::Resize(Resize::Increase, None)), - |action: &Action| matches!(action, Action::Resize(Resize::Decrease, None)), |action: &Action| { matches!( action, - Action::Resize(Resize::Increase, Some(Direction::Left)) + Action::Resize { + resize: Resize::Increase, + direction: None + } ) }, |action: &Action| { matches!( action, - Action::Resize(Resize::Increase, Some(Direction::Down)) + Action::Resize { + resize: Resize::Decrease, + direction: None + } ) }, |action: &Action| { matches!( action, - Action::Resize(Resize::Increase, Some(Direction::Up)) + Action::Resize { + resize: Resize::Increase, + direction: Some(Direction::Left) + } + ) + }, + |action: &Action| { + matches!( + action, + Action::Resize { + resize: Resize::Increase, + direction: Some(Direction::Down) + } + ) + }, + |action: &Action| { + matches!( + action, + Action::Resize { + resize: Resize::Increase, + direction: Some(Direction::Up) + } ) }, |action: &Action| { matches!( action, - Action::Resize(Resize::Increase, Some(Direction::Right)) + Action::Resize { + resize: Resize::Increase, + direction: Some(Direction::Right) + } ) }, |action: &Action| { matches!( action, - Action::Resize(Resize::Decrease, Some(Direction::Left)) + Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Left) + } ) }, |action: &Action| { matches!( action, - Action::Resize(Resize::Decrease, Some(Direction::Down)) + Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Down) + } ) }, |action: &Action| { matches!( action, - Action::Resize(Resize::Decrease, Some(Direction::Up)) + Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Up) + } ) }, |action: &Action| { matches!( action, - Action::Resize(Resize::Decrease, Some(Direction::Right)) + Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Right) + } ) }, ]; @@ -421,10 +600,38 @@ impl KeybindProcessor { }, InputMode::Move => { let ordered_predicates = vec![ - |action: &Action| matches!(action, Action::MovePane(Some(Direction::Left))), - |action: &Action| matches!(action, Action::MovePane(Some(Direction::Down))), - |action: &Action| matches!(action, Action::MovePane(Some(Direction::Up))), - |action: &Action| matches!(action, Action::MovePane(Some(Direction::Right))), + |action: &Action| { + matches!( + action, + Action::MovePane { + direction: Some(Direction::Left) + } + ) + }, + |action: &Action| { + matches!( + action, + Action::MovePane { + direction: Some(Direction::Down) + } + ) + }, + |action: &Action| { + matches!( + action, + Action::MovePane { + direction: Some(Direction::Up) + } + ) + }, + |action: &Action| { + matches!( + action, + Action::MovePane { + direction: Some(Direction::Right) + } + ) + }, ]; Self::find_predetermined_actions(mode_info, mode, ordered_predicates) }, @@ -437,7 +644,12 @@ impl KeybindProcessor { |action: &Action| matches!(action, Action::PageScrollDown), |action: &Action| matches!(action, Action::PageScrollUp), |action: &Action| { - matches!(action, Action::SwitchToMode(InputMode::EnterSearch)) + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::EnterSearch + } + ) }, |action: &Action| matches!(action, Action::EditScrollback), ]; @@ -446,9 +658,14 @@ impl KeybindProcessor { InputMode::Search => { let ordered_predicates = vec![ |action: &Action| { - matches!(action, Action::SwitchToMode(InputMode::EnterSearch)) + matches!( + action, + Action::SwitchToMode { + input_mode: InputMode::EnterSearch + } + ) }, - |action: &Action| matches!(action, Action::SearchInput(_)), + |action: &Action| matches!(action, Action::SearchInput { .. }), |action: &Action| matches!(action, Action::ScrollDown), |action: &Action| matches!(action, Action::ScrollUp), |action: &Action| matches!(action, Action::PageScrollDown), @@ -456,27 +673,43 @@ impl KeybindProcessor { |action: &Action| matches!(action, Action::HalfPageScrollDown), |action: &Action| matches!(action, Action::HalfPageScrollUp), |action: &Action| { - matches!(action, Action::Search(actions::SearchDirection::Down)) + matches!( + action, + Action::Search { + direction: actions::SearchDirection::Down + } + ) }, |action: &Action| { - matches!(action, Action::Search(actions::SearchDirection::Up)) + matches!( + action, + Action::Search { + direction: actions::SearchDirection::Up + } + ) }, |action: &Action| { matches!( action, - Action::SearchToggleOption(actions::SearchOption::CaseSensitivity) + Action::SearchToggleOption { + option: actions::SearchOption::CaseSensitivity + } ) }, |action: &Action| { matches!( action, - Action::SearchToggleOption(actions::SearchOption::Wrap) + Action::SearchToggleOption { + option: actions::SearchOption::Wrap + } ) }, |action: &Action| { matches!( action, - Action::SearchToggleOption(actions::SearchOption::WholeWord) + Action::SearchToggleOption { + option: actions::SearchOption::WholeWord + } ) }, ]; diff --git a/default-plugins/configuration/src/rebind_leaders_screen.rs b/default-plugins/configuration/src/rebind_leaders_screen.rs index 4e177228..3014eb93 100644 --- a/default-plugins/configuration/src/rebind_leaders_screen.rs +++ b/default-plugins/configuration/src/rebind_leaders_screen.rs @@ -87,7 +87,9 @@ impl RebindLeadersScreen { }) .and_then(|k| { k.into_iter().find_map(|(k, a)| { - if a == &[actions::Action::SwitchToMode(InputMode::Normal)] { + if a == &[actions::Action::SwitchToMode { + input_mode: InputMode::Normal, + }] { Some(k) } else { None @@ -110,7 +112,9 @@ impl RebindLeadersScreen { }) .and_then(|k| { k.into_iter().find_map(|(k, a)| { - if a == &[actions::Action::SwitchToMode(InputMode::Normal)] { + if a == &[actions::Action::SwitchToMode { + input_mode: InputMode::Normal, + }] { Some(k.key_modifiers.clone()) } else { None @@ -132,7 +136,11 @@ impl RebindLeadersScreen { }) .and_then(|k| { k.into_iter().find_map(|(k, a)| { - if a == &[actions::Action::NewPane(None, None, false)] { + if a == &[actions::Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }] { Some(k.key_modifiers.clone()) } else { None @@ -895,7 +903,9 @@ impl RebindLeadersScreen { if mode == &target_mode { for current_keybind in self.get_current_keybinds( *mode, - &[actions::Action::SwitchToMode(InputMode::Normal)], + &[actions::Action::SwitchToMode { + input_mode: InputMode::Normal, + }], ) { if current_keybind.bare_key != BareKey::Enter && current_keybind.bare_key != BareKey::Esc @@ -904,9 +914,12 @@ impl RebindLeadersScreen { } } } else { - for current_keybind in - self.get_current_keybinds(*mode, &[actions::Action::SwitchToMode(target_mode)]) - { + for current_keybind in self.get_current_keybinds( + *mode, + &[actions::Action::SwitchToMode { + input_mode: target_mode, + }], + ) { keys_to_unbind.push((*mode, current_keybind)); } } @@ -916,13 +929,17 @@ impl RebindLeadersScreen { keys_to_bind.push(( *mode, new_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Normal)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )); } else if mode != &InputMode::Locked { keys_to_bind.push(( *mode, new_key.clone(), - vec![actions::Action::SwitchToMode(target_mode)], + vec![actions::Action::SwitchToMode { + input_mode: target_mode, + }], )); } } @@ -935,7 +952,11 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::NewPane(None, None, false)], + &[actions::Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('n'), self.secondary_modifier.clone(), @@ -953,7 +974,9 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveTab(Direction::Left)], + &[actions::Action::MoveTab { + direction: Direction::Left, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('i'), self.secondary_modifier.clone(), @@ -962,7 +985,9 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveTab(Direction::Right)], + &[actions::Action::MoveTab { + direction: Direction::Right, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('o'), self.secondary_modifier.clone(), @@ -971,7 +996,9 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocusOrTab(Direction::Left)], + &[actions::Action::MoveFocusOrTab { + direction: Direction::Left, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('h'), self.secondary_modifier.clone(), @@ -980,13 +1007,17 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocusOrTab(Direction::Left)], + &[actions::Action::MoveFocusOrTab { + direction: Direction::Left, + }], KeyWithModifier::new_with_modifiers(BareKey::Left, self.secondary_modifier.clone()), ); self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocusOrTab(Direction::Right)], + &[actions::Action::MoveFocusOrTab { + direction: Direction::Right, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('l'), self.secondary_modifier.clone(), @@ -995,13 +1026,17 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocusOrTab(Direction::Right)], + &[actions::Action::MoveFocusOrTab { + direction: Direction::Right, + }], KeyWithModifier::new_with_modifiers(BareKey::Right, self.secondary_modifier.clone()), ); self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocus(Direction::Down)], + &[actions::Action::MoveFocus { + direction: Direction::Down, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('j'), self.secondary_modifier.clone(), @@ -1010,13 +1045,17 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocus(Direction::Down)], + &[actions::Action::MoveFocus { + direction: Direction::Down, + }], KeyWithModifier::new_with_modifiers(BareKey::Down, self.secondary_modifier.clone()), ); self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocus(Direction::Up)], + &[actions::Action::MoveFocus { + direction: Direction::Up, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('k'), self.secondary_modifier.clone(), @@ -1025,13 +1064,18 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::MoveFocus(Direction::Up)], + &[actions::Action::MoveFocus { + direction: Direction::Up, + }], KeyWithModifier::new_with_modifiers(BareKey::Up, self.secondary_modifier.clone()), ); self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::Resize(Resize::Increase, None)], + &[actions::Action::Resize { + resize: Resize::Increase, + direction: None, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('+'), self.secondary_modifier.clone(), @@ -1040,7 +1084,10 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::Resize(Resize::Increase, None)], + &[actions::Action::Resize { + resize: Resize::Increase, + direction: None, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('='), self.secondary_modifier.clone(), @@ -1049,7 +1096,10 @@ impl RebindLeadersScreen { self.bind_actions( keys_to_unbind, keys_to_bind, - &[actions::Action::Resize(Resize::Decrease, None)], + &[actions::Action::Resize { + resize: Resize::Decrease, + direction: None, + }], KeyWithModifier::new_with_modifiers( BareKey::Char('-'), self.secondary_modifier.clone(), @@ -1098,7 +1148,9 @@ impl RebindLeadersScreen { ) { if let Some(previous_unlock_key) = self.get_current_keybind( InputMode::Locked, - &[actions::Action::SwitchToMode(InputMode::Normal)], + &[actions::Action::SwitchToMode { + input_mode: InputMode::Normal, + }], ) { keys_to_unbind.push((InputMode::Locked, previous_unlock_key.clone())); keys_to_unbind.push((InputMode::Normal, previous_unlock_key.clone())); @@ -1113,47 +1165,65 @@ impl RebindLeadersScreen { keys_to_bind.push(( InputMode::Locked, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Normal)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )); keys_to_bind.push(( InputMode::Normal, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); keys_to_bind.push(( InputMode::Pane, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); keys_to_bind.push(( InputMode::Tab, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); keys_to_bind.push(( InputMode::Resize, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); keys_to_bind.push(( InputMode::Move, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); keys_to_bind.push(( InputMode::Search, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); keys_to_bind.push(( InputMode::Scroll, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); keys_to_bind.push(( InputMode::Session, unlock_key.clone(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )); } fn get_current_keybind( diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 8ca23557..01489860 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -490,42 +490,58 @@ impl ZellijPlugin for State { ( InputMode::Locked, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Normal)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Normal, + }], ), ( InputMode::Normal, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], ), ( InputMode::Pane, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], ), ( InputMode::Tab, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], ), ( InputMode::Resize, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], ), ( InputMode::Move, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], ), ( InputMode::Search, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], ), ( InputMode::Session, KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![actions::Action::SwitchToMode(InputMode::Locked)], + vec![actions::Action::SwitchToMode { + input_mode: InputMode::Locked, + }], ), ]; rebind_keys(keys_to_unbind, keys_to_rebind, write_to_disk); diff --git a/default-plugins/status-bar/src/first_line.rs b/default-plugins/status-bar/src/first_line.rs index a67ef10b..b5c688ad 100644 --- a/default-plugins/status-bar/src/first_line.rs +++ b/default-plugins/status-bar/src/first_line.rs @@ -480,7 +480,7 @@ pub fn mode_switch_keys(mode_info: &ModeInfo) -> Vec<KeyWithModifier> { ) { return None; } - if let actions::Action::SwitchToMode(mode) = vac { + if let actions::Action::SwitchToMode { input_mode: mode } = vac { return match mode { // Store the keys that switch to displayed modes InputMode::Normal @@ -622,38 +622,59 @@ pub fn first_line( KeyAction::Lock, to_char(action_key( binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( KeyMode::UnselectedAlternate, KeyAction::Pane, - to_char(action_key(binds, &[Action::SwitchToMode(InputMode::Pane)])), + to_char(action_key( + binds, + &[Action::SwitchToMode { + input_mode: InputMode::Pane, + }], + )), ), KeyShortcut::new( KeyMode::Unselected, KeyAction::Tab, - to_char(action_key(binds, &[Action::SwitchToMode(InputMode::Tab)])), + to_char(action_key( + binds, + &[Action::SwitchToMode { + input_mode: InputMode::Tab, + }], + )), ), KeyShortcut::new( KeyMode::UnselectedAlternate, KeyAction::Resize, to_char(action_key( binds, - &[Action::SwitchToMode(InputMode::Resize)], + &[Action::SwitchToMode { + input_mode: InputMode::Resize, + }], )), ), KeyShortcut::new( KeyMode::Unselected, KeyAction::Move, - to_char(action_key(binds, &[Action::SwitchToMode(InputMode::Move)])), + to_char(action_key( + binds, + &[Action::SwitchToMode { + input_mode: InputMode::Move, + }], + )), ), KeyShortcut::new( KeyMode::UnselectedAlternate, KeyAction::Search, to_char(action_key( binds, - &[Action::SwitchToMode(InputMode::Scroll)], + &[Action::SwitchToMode { + input_mode: InputMode::Scroll, + }], )), ), KeyShortcut::new( @@ -661,7 +682,9 @@ pub fn first_line( KeyAction::Session, to_char(action_key( binds, - &[Action::SwitchToMode(InputMode::Session)], + &[Action::SwitchToMode { + input_mode: InputMode::Session, + }], )), ), KeyShortcut::new( @@ -1055,9 +1078,9 @@ mod tests { mode: InputMode::Normal, keybinds : vec![ (InputMode::Normal, vec![ - (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Pane)]), - (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Resize)]), - (KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Move)]), + (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Pane}]), + (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Resize}]), + (KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Move}]), ]), ], ..ModeInfo::default() @@ -1079,9 +1102,9 @@ mod tests { mode: InputMode::Normal, keybinds : vec![ (InputMode::Normal, vec![ - (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Pane)]), - (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Resize)]), - (KeyWithModifier::new(BareKey::Char('c')), vec![Action::SwitchToMode(InputMode::Move)]), + (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Pane}]), + (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Resize}]), + (KeyWithModifier::new(BareKey::Char('c')), vec![Action::SwitchToMode{input_mode: InputMode::Move}]), ]), ], ..ModeInfo::default() @@ -1103,11 +1126,11 @@ mod tests { mode: InputMode::Normal, keybinds : vec![ (InputMode::Normal, vec![ - (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Locked)]), - (KeyWithModifier::new(BareKey::Backspace), vec![Action::SwitchToMode(InputMode::Pane)]), - (KeyWithModifier::new(BareKey::Enter), vec![Action::SwitchToMode(InputMode::Tab)]), - (KeyWithModifier::new(BareKey::Tab), vec![Action::SwitchToMode(InputMode::Resize)]), - (KeyWithModifier::new(BareKey::Left), vec![Action::SwitchToMode(InputMode::Move)]), + (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Locked}]), + (KeyWithModifier::new(BareKey::Backspace), vec![Action::SwitchToMode{input_mode: InputMode::Pane}]), + (KeyWithModifier::new(BareKey::Enter), vec![Action::SwitchToMode{input_mode: InputMode::Tab}]), + (KeyWithModifier::new(BareKey::Tab), vec![Action::SwitchToMode{input_mode: InputMode::Resize}]), + (KeyWithModifier::new(BareKey::Left), vec![Action::SwitchToMode{input_mode: InputMode::Move}]), ]), ], ..ModeInfo::default() @@ -1130,11 +1153,11 @@ mod tests { mode: InputMode::Normal, keybinds : vec![ (InputMode::Normal, vec![ - (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Locked)]), - (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Pane)]), - (KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Tab)]), - (KeyWithModifier::new(BareKey::Char('d')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Resize)]), - (KeyWithModifier::new(BareKey::Char('e')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Move)]), + (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Locked}]), + (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Pane}]), + (KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Tab}]), + (KeyWithModifier::new(BareKey::Char('d')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Resize}]), + (KeyWithModifier::new(BareKey::Char('e')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Move}]), ]), ], ..ModeInfo::default() @@ -1153,9 +1176,9 @@ mod tests { mode: InputMode::Normal, keybinds : vec![ (InputMode::Normal, vec![ - (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Pane)]), - (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Resize)]), - (KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), vec![Action::SwitchToMode(InputMode::Move)]), + (KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Pane}]), + (KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Resize}]), + (KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), vec![Action::SwitchToMode{input_mode: InputMode::Move}]), ]), ], ..ModeInfo::default() diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 0c1b9c88..aa86d4d1 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -27,8 +27,10 @@ use tip::utils::get_cached_tip_name; // for more of these, copy paste from: https://en.wikipedia.org/wiki/Box-drawing_character static ARROW_SEPARATOR: &str = "î‚°"; static MORE_MSG: &str = " ... "; -/// Shorthand for `Action::SwitchToMode(InputMode::Normal)`. -const TO_NORMAL: Action = Action::SwitchToMode(InputMode::Normal); +/// Shorthand for `Action::SwitchToMode{input_mode: InputMode::Normal}`. +const TO_NORMAL: Action = Action::SwitchToMode { + input_mode: InputMode::Normal, +}; #[derive(Default)] struct State { @@ -588,11 +590,21 @@ pub mod tests { ), ( KeyWithModifier::new(BareKey::Char('c')).with_alt_modifier(), - vec![Action::ScrollDown, Action::SwitchToMode(InputMode::Normal)], + vec![ + Action::ScrollDown, + Action::SwitchToMode { + input_mode: InputMode::Normal, + }, + ], ), ( KeyWithModifier::new(BareKey::Char('1')), - vec![TO_NORMAL, Action::SwitchToMode(InputMode::Locked)], + vec![ + TO_NORMAL, + Action::SwitchToMode { + input_mode: InputMode::Locked, + }, + ], ), ] } diff --git a/default-plugins/status-bar/src/one_line_ui.rs b/default-plugins/status-bar/src/one_line_ui.rs index 564bdc83..a3fdec77 100644 --- a/default-plugins/status-bar/src/one_line_ui.rs +++ b/default-plugins/status-bar/src/one_line_ui.rs @@ -49,7 +49,9 @@ pub fn one_line_ui( } fn to_base_mode(base_mode: InputMode) -> Action { - Action::SwitchToMode(base_mode) + Action::SwitchToMode { + input_mode: base_mode, + } } fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<KeyShortcut>> { @@ -69,7 +71,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( locked_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -81,7 +85,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -89,7 +95,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Pane, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Pane)], + &[Action::SwitchToMode { + input_mode: InputMode::Pane, + }], )), ), KeyShortcut::new( @@ -97,7 +105,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Tab, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Tab)], + &[Action::SwitchToMode { + input_mode: InputMode::Tab, + }], )), ), KeyShortcut::new( @@ -105,7 +115,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Resize, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Resize)], + &[Action::SwitchToMode { + input_mode: InputMode::Resize, + }], )), ), KeyShortcut::new( @@ -113,7 +125,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Move, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Move)], + &[Action::SwitchToMode { + input_mode: InputMode::Move, + }], )), ), KeyShortcut::new( @@ -121,7 +135,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Search, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Scroll)], + &[Action::SwitchToMode { + input_mode: InputMode::Scroll, + }], )), ), KeyShortcut::new( @@ -129,7 +145,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Session, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Session)], + &[Action::SwitchToMode { + input_mode: InputMode::Session, + }], )), ), KeyShortcut::new( @@ -147,7 +165,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( pane_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -155,7 +175,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Pane, to_char(action_key( pane_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), ), ], @@ -168,7 +190,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( tab_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -176,7 +200,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Tab, to_char(action_key( tab_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), ), ], @@ -189,7 +215,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( resize_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -197,7 +225,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Resize, to_char(action_key( resize_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), ), ], @@ -210,7 +240,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( move_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -218,7 +250,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Move, to_char(action_key( move_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), ), ], @@ -231,7 +265,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( scroll_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -239,7 +275,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Search, to_char(action_key( scroll_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), ), ], @@ -252,7 +290,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Unlock, to_char(action_key( session_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -260,7 +300,9 @@ fn base_mode_locked_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Session, to_char(action_key( session_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), ), ], @@ -285,7 +327,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Lock, to_char(action_key( locked_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -297,7 +341,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Lock, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Locked)], + &[Action::SwitchToMode { + input_mode: InputMode::Locked, + }], )), ), KeyShortcut::new( @@ -305,7 +351,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Pane, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Pane)], + &[Action::SwitchToMode { + input_mode: InputMode::Pane, + }], )), ), KeyShortcut::new( @@ -313,7 +361,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Tab, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Tab)], + &[Action::SwitchToMode { + input_mode: InputMode::Tab, + }], )), ), KeyShortcut::new( @@ -321,7 +371,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Resize, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Resize)], + &[Action::SwitchToMode { + input_mode: InputMode::Resize, + }], )), ), KeyShortcut::new( @@ -329,7 +381,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Move, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Move)], + &[Action::SwitchToMode { + input_mode: InputMode::Move, + }], )), ), KeyShortcut::new( @@ -337,7 +391,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Search, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Scroll)], + &[Action::SwitchToMode { + input_mode: InputMode::Scroll, + }], )), ), KeyShortcut::new( @@ -345,7 +401,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Session, to_char(action_key( normal_binds, - &[Action::SwitchToMode(InputMode::Session)], + &[Action::SwitchToMode { + input_mode: InputMode::Session, + }], )), ), KeyShortcut::new( @@ -362,7 +420,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Pane, to_char(action_key( pane_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -373,7 +433,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Tab, to_char(action_key( tab_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -384,7 +446,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Resize, to_char(action_key( resize_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -395,7 +459,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Move, to_char(action_key( move_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -406,7 +472,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Search, to_char(action_key( scroll_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -417,7 +485,9 @@ fn base_mode_normal_mode_indicators(help: &ModeInfo) -> HashMap<InputMode, Vec<K KeyAction::Session, to_char(action_key( session_binds, - &[Action::SwitchToMode(InputMode::Normal)], + &[Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )), )], ), @@ -699,7 +769,14 @@ fn secondary_keybinds(help: &ModeInfo, tab_info: Option<&TabInfo>, max_len: usiz let binds = &help.get_mode_keybinds(); let should_show_focus_and_resize_shortcuts = should_show_focus_and_resize_shortcuts(tab_info); // New Pane - let new_pane_action_key = action_key(binds, &[Action::NewPane(None, None, false)]); + let new_pane_action_key = action_key( + binds, + &[Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }], + ); let mut new_pane_key_to_display = new_pane_action_key .iter() .find(|k| k.is_key_with_alt_modifier(BareKey::Char('n'))) @@ -712,12 +789,24 @@ fn secondary_keybinds(help: &ModeInfo, tab_info: Option<&TabInfo>, max_len: usiz }; // Resize - let resize_increase_action_key = action_key(binds, &[Action::Resize(Resize::Increase, None)]); + let resize_increase_action_key = action_key( + binds, + &[Action::Resize { + resize: Resize::Increase, + direction: None, + }], + ); let resize_increase_key = resize_increase_action_key .iter() .find(|k| k.bare_key == BareKey::Char('+')) .or_else(|| resize_increase_action_key.iter().next()); - let resize_decrease_action_key = action_key(binds, &[Action::Resize(Resize::Decrease, None)]); + let resize_decrease_action_key = action_key( + binds, + &[Action::Resize { + resize: Resize::Decrease, + direction: None, + }], + ); let resize_decrease_key = resize_decrease_action_key .iter() .find(|k| k.bare_key == BareKey::Char('-')) @@ -734,7 +823,12 @@ fn secondary_keybinds(help: &ModeInfo, tab_info: Option<&TabInfo>, max_len: usiz let mut move_focus_shortcuts: Vec<KeyWithModifier> = vec![]; // Left - let move_focus_left_action_key = action_key(binds, &[Action::MoveFocusOrTab(Direction::Left)]); + let move_focus_left_action_key = action_key( + binds, + &[Action::MoveFocusOrTab { + direction: Direction::Left, + }], + ); let move_focus_left_key = move_focus_left_action_key .iter() .find(|k| k.bare_key == BareKey::Left) @@ -743,7 +837,12 @@ fn secondary_keybinds(help: &ModeInfo, tab_info: Option<&TabInfo>, max_len: usiz move_focus_shortcuts.push(move_focus_left_key.clone()); } // Down - let move_focus_left_action_key = action_key(binds, &[Action::MoveFocus(Direction::Down)]); + let move_focus_left_action_key = action_key( + binds, + &[Action::MoveFocus { + direction: Direction::Down, + }], + ); let move_focus_left_key = move_focus_left_action_key .iter() .find(|k| k.bare_key == BareKey::Down) @@ -752,7 +851,12 @@ fn secondary_keybinds(help: &ModeInfo, tab_info: Option<&TabInfo>, max_len: usiz move_focus_shortcuts.push(move_focus_left_key.clone()); } // Up - let move_focus_left_action_key = action_key(binds, &[Action::MoveFocus(Direction::Up)]); + let move_focus_left_action_key = action_key( + binds, + &[Action::MoveFocus { + direction: Direction::Up, + }], + ); let move_focus_left_key = move_focus_left_action_key .iter() .find(|k| k.bare_key == BareKey::Up) @@ -761,7 +865,12 @@ fn secondary_keybinds(help: &ModeInfo, tab_info: Option<&TabInfo>, max_len: usiz move_focus_shortcuts.push(move_focus_left_key.clone()); } // Right - let move_focus_left_action_key = action_key(binds, &[Action::MoveFocusOrTab(Direction::Right)]); + let move_focus_left_action_key = action_key( + binds, + &[Action::MoveFocusOrTab { + direction: Direction::Right, + }], + ); let move_focus_left_key = move_focus_left_action_key .iter() .find(|k| k.bare_key == BareKey::Right) @@ -1264,20 +1373,20 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier } if mi.mode == IM::Pane { vec![ - (s("New"), s("New"), single_action_key(&km, &[A::NewPane(None, None, false), TO_NORMAL])), + (s("New"), s("New"), single_action_key(&km, &[A::NewPane{direction: None, pane_name: None, start_suppressed: false}, TO_NORMAL])), (s("Change Focus"), s("Move"), - action_key_group(&km, &[&[A::MoveFocus(Dir::Left)], &[A::MoveFocus(Dir::Down)], - &[A::MoveFocus(Dir::Up)], &[A::MoveFocus(Dir::Right)]])), + action_key_group(&km, &[&[A::MoveFocus{direction: Dir::Left}], &[A::MoveFocus{direction: Dir::Down}], + &[A::MoveFocus{direction: Dir::Up}], &[A::MoveFocus{direction: Dir::Right}]])), (s("Close"), s("Close"), single_action_key(&km, &[A::CloseFocus, TO_NORMAL])), (s("Rename"), s("Rename"), - single_action_key(&km, &[A::SwitchToMode(IM::RenamePane), A::PaneNameInput(vec![0])])), + single_action_key(&km, &[A::SwitchToMode{input_mode: IM::RenamePane}, A::PaneNameInput{input: vec![0]}])), (s("Toggle Fullscreen"), s("Fullscreen"), single_action_key(&km, &[A::ToggleFocusFullscreen, TO_NORMAL])), (s("Toggle Floating"), s("Floating"), single_action_key(&km, &[A::ToggleFloatingPanes, TO_NORMAL])), (s("Toggle Embed"), s("Embed"), single_action_key(&km, &[A::TogglePaneEmbedOrFloating, TO_NORMAL])), - (s("Split Right"), s("Right"), single_action_key(&km, &[A::NewPane(Some(Direction::Right), None, false), TO_NORMAL])), - (s("Split Down"), s("Down"), single_action_key(&km, &[A::NewPane(Some(Direction::Down), None, false), TO_NORMAL])), - (s("Stack"), s("Stack"), single_action_key(&km, &[A::NewStackedPane(None, None), TO_NORMAL])), + (s("Split Right"), s("Right"), single_action_key(&km, &[A::NewPane{direction: Some(Direction::Right), pane_name: None, start_suppressed: false}, TO_NORMAL])), + (s("Split Down"), s("Down"), single_action_key(&km, &[A::NewPane{direction: Some(Direction::Down), pane_name: None, start_suppressed: false}, TO_NORMAL])), + (s("Stack"), s("Stack"), single_action_key(&km, &[A::NewStackedPane{command: None, pane_name: None}, TO_NORMAL])), (s("Select pane"), s("Select"), to_basemode_key), ]} else if mi.mode == IM::Tab { // With the default bindings, "Move focus" for tabs is tricky: It binds all the arrow keys @@ -1297,11 +1406,11 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier }; vec![ - (s("New"), s("New"), single_action_key(&km, &[A::NewTab(None, vec![], None, None, None, true, None), TO_NORMAL])), + (s("New"), s("New"), single_action_key(&km, &[A::NewTab{tiled_layout: None, floating_layouts: vec![], swap_tiled_layouts: None, swap_floating_layouts: None, tab_name: None, should_change_focus_to_new_tab: true, cwd: None}, TO_NORMAL])), (s("Change focus"), s("Move"), focus_keys), (s("Close"), s("Close"), single_action_key(&km, &[A::CloseTab, TO_NORMAL])), (s("Rename"), s("Rename"), - single_action_key(&km, &[A::SwitchToMode(IM::RenameTab), A::TabNameInput(vec![0])])), + single_action_key(&km, &[A::SwitchToMode{input_mode: IM::RenameTab}, A::TabNameInput{input: vec![0]}])), (s("Sync"), s("Sync"), single_action_key(&km, &[A::ToggleActiveSyncTab, TO_NORMAL])), (s("Break pane to new tab"), s("Break out"), single_action_key(&km, &[A::BreakPane, TO_NORMAL])), (s("Break pane left/right"), s("Break"), action_key_group(&km, &[ @@ -1313,30 +1422,30 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier ]} else if mi.mode == IM::Resize { vec![ (s("Increase/Decrease size"), s("Increase/Decrease"), action_key_group(&km, &[ - &[A::Resize(Resize::Increase, None)], - &[A::Resize(Resize::Decrease, None)] + &[A::Resize{resize: Resize::Increase, direction: None}], + &[A::Resize{resize: Resize::Decrease, direction: None}] ])), (s("Increase to"), s("Increase"), action_key_group(&km, &[ - &[A::Resize(Resize::Increase, Some(Dir::Left))], - &[A::Resize(Resize::Increase, Some(Dir::Down))], - &[A::Resize(Resize::Increase, Some(Dir::Up))], - &[A::Resize(Resize::Increase, Some(Dir::Right))] + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Left)}], + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Down)}], + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Up)}], + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Right)}] ])), (s("Decrease from"), s("Decrease"), action_key_group(&km, &[ - &[A::Resize(Resize::Decrease, Some(Dir::Left))], - &[A::Resize(Resize::Decrease, Some(Dir::Down))], - &[A::Resize(Resize::Decrease, Some(Dir::Up))], - &[A::Resize(Resize::Decrease, Some(Dir::Right))] + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Left)}], + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Down)}], + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Up)}], + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Right)}] ])), (s("Select pane"), s("Select"), to_basemode_key), ]} else if mi.mode == IM::Move { vec![ (s("Switch Location"), s("Move"), action_key_group(&km, &[ - &[Action::MovePane(Some(Dir::Left))], &[Action::MovePane(Some(Dir::Down))], - &[Action::MovePane(Some(Dir::Up))], &[Action::MovePane(Some(Dir::Right))]])), + &[Action::MovePane{direction: Some(Dir::Left)}], &[Action::MovePane{direction: Some(Dir::Down)}], + &[Action::MovePane{direction: Some(Dir::Up)}], &[Action::MovePane{direction: Some(Dir::Right)}]])), (s("When done"), s("Back"), to_basemode_key), ]} else if mi.mode == IM::Scroll { vec![ (s("Enter search term"), s("Search"), - action_key(&km, &[A::SwitchToMode(IM::EnterSearch), A::SearchInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::EnterSearch}, A::SearchInput{input: vec![0]}])), (s("Scroll"), s("Scroll"), action_key_group(&km, &[&[Action::ScrollDown], &[Action::ScrollUp]])), (s("Scroll page"), s("Scroll"), @@ -1347,26 +1456,26 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier single_action_key(&km, &[Action::EditScrollback, TO_NORMAL])), (s("Select pane"), s("Select"), to_basemode_key), ]} else if mi.mode == IM::EnterSearch { vec![ - (s("When done"), s("Done"), action_key(&km, &[A::SwitchToMode(IM::Search)])), + (s("When done"), s("Done"), action_key(&km, &[A::SwitchToMode{input_mode: IM::Search}])), (s("Cancel"), s("Cancel"), - action_key(&km, &[A::SearchInput(vec![27]), A::SwitchToMode(IM::Scroll)])), + action_key(&km, &[A::SearchInput{input: vec![27]}, A::SwitchToMode{input_mode: IM::Scroll}])), ]} else if mi.mode == IM::Search { vec![ (s("Enter Search term"), s("Search"), - action_key(&km, &[A::SwitchToMode(IM::EnterSearch), A::SearchInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::EnterSearch}, A::SearchInput{input: vec![0]}])), (s("Scroll"), s("Scroll"), action_key_group(&km, &[&[Action::ScrollDown], &[Action::ScrollUp]])), (s("Scroll page"), s("Scroll"), action_key_group(&km, &[&[Action::PageScrollDown], &[Action::PageScrollUp]])), (s("Scroll half page"), s("Scroll"), action_key_group(&km, &[&[Action::HalfPageScrollDown], &[Action::HalfPageScrollUp]])), - (s("Search down"), s("Down"), action_key(&km, &[A::Search(SDir::Down)])), - (s("Search up"), s("Up"), action_key(&km, &[A::Search(SDir::Up)])), + (s("Search down"), s("Down"), action_key(&km, &[A::Search{direction: SDir::Down}])), + (s("Search up"), s("Up"), action_key(&km, &[A::Search{direction: SDir::Up}])), (s("Case sensitive"), s("Case"), - action_key(&km, &[A::SearchToggleOption(SOpt::CaseSensitivity)])), + action_key(&km, &[A::SearchToggleOption{option: SOpt::CaseSensitivity}])), (s("Wrap"), s("Wrap"), - action_key(&km, &[A::SearchToggleOption(SOpt::Wrap)])), + action_key(&km, &[A::SearchToggleOption{option: SOpt::Wrap}])), (s("Whole words"), s("Whole"), - action_key(&km, &[A::SearchToggleOption(SOpt::WholeWord)])), + action_key(&km, &[A::SearchToggleOption{option: SOpt::WholeWord}])), ]} else if mi.mode == IM::Session { vec![ (s("Detach"), s("Detach"), action_key(&km, &[Action::Detach])), (s("Session Manager"), s("Manager"), session_manager_key(&km)), @@ -1377,14 +1486,14 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier (s("Select pane"), s("Select"), to_basemode_key), ]} else if mi.mode == IM::Tmux { vec![ (s("Move focus"), s("Move"), action_key_group(&km, &[ - &[A::MoveFocus(Dir::Left)], &[A::MoveFocus(Dir::Down)], - &[A::MoveFocus(Dir::Up)], &[A::MoveFocus(Dir::Right)]])), - (s("Split down"), s("Down"), action_key(&km, &[A::NewPane(Some(Dir::Down), None, false), TO_NORMAL])), - (s("Split right"), s("Right"), action_key(&km, &[A::NewPane(Some(Dir::Right), None, false), TO_NORMAL])), + &[A::MoveFocus{direction: Dir::Left}], &[A::MoveFocus{direction: Dir::Down}], + &[A::MoveFocus{direction: Dir::Up}], &[A::MoveFocus{direction: Dir::Right}]])), + (s("Split down"), s("Down"), action_key(&km, &[A::NewPane{direction: Some(Dir::Down), pane_name: None, start_suppressed: false}, TO_NORMAL])), + (s("Split right"), s("Right"), action_key(&km, &[A::NewPane{direction: Some(Dir::Right), pane_name: None, start_suppressed: false}, TO_NORMAL])), (s("Fullscreen"), s("Fullscreen"), action_key(&km, &[A::ToggleFocusFullscreen, TO_NORMAL])), - (s("New tab"), s("New"), action_key(&km, &[A::NewTab(None, vec![], None, None, None, true, None), TO_NORMAL])), + (s("New tab"), s("New"), action_key(&km, &[A::NewTab{tiled_layout: None, floating_layouts: vec![], swap_tiled_layouts: None, swap_floating_layouts: None, tab_name: None, should_change_focus_to_new_tab: true, cwd: None}, TO_NORMAL])), (s("Rename tab"), s("Rename"), - action_key(&km, &[A::SwitchToMode(IM::RenameTab), A::TabNameInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::RenameTab}, A::TabNameInput{input: vec![0]}])), (s("Previous Tab"), s("Previous"), action_key(&km, &[A::GoToPreviousTab, TO_NORMAL])), (s("Next Tab"), s("Next"), action_key(&km, &[A::GoToNextTab, TO_NORMAL])), (s("Select pane"), s("Select"), to_basemode_key), diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index b5ba8292..6f3fb02c 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -143,13 +143,13 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier } if mi.mode == IM::Pane { vec![ - (s("New"), s("New"), action_key(&km, &[A::NewPane(None, None, false), TO_NORMAL])), + (s("New"), s("New"), action_key(&km, &[A::NewPane{direction: None, pane_name: None, start_suppressed: false}, TO_NORMAL])), (s("Change Focus"), s("Move"), - action_key_group(&km, &[&[A::MoveFocus(Dir::Left)], &[A::MoveFocus(Dir::Down)], - &[A::MoveFocus(Dir::Up)], &[A::MoveFocus(Dir::Right)]])), + action_key_group(&km, &[&[A::MoveFocus{direction: Dir::Left}], &[A::MoveFocus{direction: Dir::Down}], + &[A::MoveFocus{direction: Dir::Up}], &[A::MoveFocus{direction: Dir::Right}]])), (s("Close"), s("Close"), action_key(&km, &[A::CloseFocus, TO_NORMAL])), (s("Rename"), s("Rename"), - action_key(&km, &[A::SwitchToMode(IM::RenamePane), A::PaneNameInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::RenamePane}, A::PaneNameInput{input: vec![0]}])), (s("Toggle Fullscreen"), s("Fullscreen"), action_key(&km, &[A::ToggleFocusFullscreen, TO_NORMAL])), (s("Toggle Floating"), s("Floating"), action_key(&km, &[A::ToggleFloatingPanes, TO_NORMAL])), @@ -173,11 +173,11 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier }; vec![ - (s("New"), s("New"), action_key(&km, &[A::NewTab(None, vec![], None, None, None, true, None), TO_NORMAL])), + (s("New"), s("New"), action_key(&km, &[A::NewTab{tiled_layout: None, floating_layouts: vec![], swap_tiled_layouts: None, swap_floating_layouts: None, tab_name: None, should_change_focus_to_new_tab: true, cwd: None}, TO_NORMAL])), (s("Change focus"), s("Move"), focus_keys), (s("Close"), s("Close"), action_key(&km, &[A::CloseTab, TO_NORMAL])), (s("Rename"), s("Rename"), - action_key(&km, &[A::SwitchToMode(IM::RenameTab), A::TabNameInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::RenameTab}, A::TabNameInput{input: vec![0]}])), (s("Sync"), s("Sync"), action_key(&km, &[A::ToggleActiveSyncTab, TO_NORMAL])), (s("Break pane to new tab"), s("Break out"), action_key(&km, &[A::BreakPane, TO_NORMAL])), (s("Break pane left/right"), s("Break"), action_key_group(&km, &[ @@ -189,29 +189,29 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier ]} else if mi.mode == IM::Resize { vec![ (s("Increase/Decrease size"), s("Increase/Decrease"), action_key_group(&km, &[ - &[A::Resize(Resize::Increase, None)], - &[A::Resize(Resize::Decrease, None)] + &[A::Resize{resize: Resize::Increase, direction: None}], + &[A::Resize{resize: Resize::Decrease, direction: None}] ])), (s("Increase to"), s("Increase"), action_key_group(&km, &[ - &[A::Resize(Resize::Increase, Some(Dir::Left))], - &[A::Resize(Resize::Increase, Some(Dir::Down))], - &[A::Resize(Resize::Increase, Some(Dir::Up))], - &[A::Resize(Resize::Increase, Some(Dir::Right))] + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Left)}], + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Down)}], + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Up)}], + &[A::Resize{resize: Resize::Increase, direction: Some(Dir::Right)}] ])), (s("Decrease from"), s("Decrease"), action_key_group(&km, &[ - &[A::Resize(Resize::Decrease, Some(Dir::Left))], - &[A::Resize(Resize::Decrease, Some(Dir::Down))], - &[A::Resize(Resize::Decrease, Some(Dir::Up))], - &[A::Resize(Resize::Decrease, Some(Dir::Right))] + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Left)}], + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Down)}], + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Up)}], + &[A::Resize{resize: Resize::Decrease, direction: Some(Dir::Right)}] ])), (s("Select pane"), s("Select"), to_normal_key), ]} else if mi.mode == IM::Move { vec![ (s("Switch Location"), s("Move"), action_key_group(&km, &[ - &[Action::MovePane(Some(Dir::Left))], &[Action::MovePane(Some(Dir::Down))], - &[Action::MovePane(Some(Dir::Up))], &[Action::MovePane(Some(Dir::Right))]])), + &[Action::MovePane{direction: Some(Dir::Left)}], &[Action::MovePane{direction: Some(Dir::Down)}], + &[Action::MovePane{direction: Some(Dir::Up)}], &[Action::MovePane{direction: Some(Dir::Right)}]])), ]} else if mi.mode == IM::Scroll { vec![ (s("Enter search term"), s("Search"), - action_key(&km, &[A::SwitchToMode(IM::EnterSearch), A::SearchInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::EnterSearch}, A::SearchInput{input: vec![0]}])), (s("Scroll"), s("Scroll"), action_key_group(&km, &[&[Action::ScrollDown], &[Action::ScrollUp]])), (s("Scroll page"), s("Scroll"), @@ -222,48 +222,48 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier action_key(&km, &[Action::EditScrollback, TO_NORMAL])), (s("Select pane"), s("Select"), to_normal_key), ]} else if mi.mode == IM::EnterSearch { vec![ - (s("When done"), s("Done"), action_key(&km, &[A::SwitchToMode(IM::Search)])), + (s("When done"), s("Done"), action_key(&km, &[A::SwitchToMode{input_mode: IM::Search}])), (s("Cancel"), s("Cancel"), - action_key(&km, &[A::SearchInput(vec![27]), A::SwitchToMode(IM::Scroll)])), + action_key(&km, &[A::SearchInput{input: vec![27]}, A::SwitchToMode{input_mode: IM::Scroll}])), ]} else if mi.mode == IM::Search { vec![ (s("Enter Search term"), s("Search"), - action_key(&km, &[A::SwitchToMode(IM::EnterSearch), A::SearchInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::EnterSearch}, A::SearchInput{input: vec![0]}])), (s("Scroll"), s("Scroll"), action_key_group(&km, &[&[Action::ScrollDown], &[Action::ScrollUp]])), (s("Scroll page"), s("Scroll"), action_key_group(&km, &[&[Action::PageScrollDown], &[Action::PageScrollUp]])), (s("Scroll half page"), s("Scroll"), action_key_group(&km, &[&[Action::HalfPageScrollDown], &[Action::HalfPageScrollUp]])), - (s("Search down"), s("Down"), action_key(&km, &[A::Search(SDir::Down)])), - (s("Search up"), s("Up"), action_key(&km, &[A::Search(SDir::Up)])), + (s("Search down"), s("Down"), action_key(&km, &[A::Search{direction: SDir::Down}])), + (s("Search up"), s("Up"), action_key(&km, &[A::Search{direction: SDir::Up}])), (s("Case sensitive"), s("Case"), - action_key(&km, &[A::SearchToggleOption(SOpt::CaseSensitivity)])), + action_key(&km, &[A::SearchToggleOption{option: SOpt::CaseSensitivity}])), (s("Wrap"), s("Wrap"), - action_key(&km, &[A::SearchToggleOption(SOpt::Wrap)])), + action_key(&km, &[A::SearchToggleOption{option: SOpt::Wrap}])), (s("Whole words"), s("Whole"), - action_key(&km, &[A::SearchToggleOption(SOpt::WholeWord)])), + action_key(&km, &[A::SearchToggleOption{option: SOpt::WholeWord}])), ]} else if mi.mode == IM::Session { vec![ (s("Detach"), s("Detach"), action_key(&km, &[Action::Detach])), - (s("Session Manager"), s("Manager"), action_key(&km, &[A::LaunchOrFocusPlugin(Default::default(), true, true, false, false), TO_NORMAL])), // not entirely accurate + (s("Session Manager"), s("Manager"), action_key(&km, &[A::LaunchOrFocusPlugin{plugin: Default::default(), should_float: true, move_to_focused_tab: true, should_open_in_place: false, skip_cache: false}, TO_NORMAL])), // not entirely accurate (s("Select pane"), s("Select"), to_normal_key), ]} else if mi.mode == IM::Tmux { vec![ (s("Move focus"), s("Move"), action_key_group(&km, &[ - &[A::MoveFocus(Dir::Left)], &[A::MoveFocus(Dir::Down)], - &[A::MoveFocus(Dir::Up)], &[A::MoveFocus(Dir::Right)]])), - (s("Split down"), s("Down"), action_key(&km, &[A::NewPane(Some(Dir::Down), None, false), TO_NORMAL])), - (s("Split right"), s("Right"), action_key(&km, &[A::NewPane(Some(Dir::Right), None, false), TO_NORMAL])), + &[A::MoveFocus{direction: Dir::Left}], &[A::MoveFocus{direction: Dir::Down}], + &[A::MoveFocus{direction: Dir::Up}], &[A::MoveFocus{direction: Dir::Right}]])), + (s("Split down"), s("Down"), action_key(&km, &[A::NewPane{direction: Some(Dir::Down), pane_name: None, start_suppressed: false}, TO_NORMAL])), + (s("Split right"), s("Right"), action_key(&km, &[A::NewPane{direction: Some(Dir::Right), pane_name: None, start_suppressed: false}, TO_NORMAL])), (s("Fullscreen"), s("Fullscreen"), action_key(&km, &[A::ToggleFocusFullscreen, TO_NORMAL])), - (s("New tab"), s("New"), action_key(&km, &[A::NewTab(None, vec![], None, None, None, true, None), TO_NORMAL])), + (s("New tab"), s("New"), action_key(&km, &[A::NewTab{tiled_layout: None, floating_layouts: vec![], swap_tiled_layouts: None, swap_floating_layouts: None, tab_name: None, should_change_focus_to_new_tab: true, cwd: None}, TO_NORMAL])), (s("Rename tab"), s("Rename"), - action_key(&km, &[A::SwitchToMode(IM::RenameTab), A::TabNameInput(vec![0])])), + action_key(&km, &[A::SwitchToMode{input_mode: IM::RenameTab}, A::TabNameInput{input: vec![0]}])), (s("Previous Tab"), s("Previous"), action_key(&km, &[A::GoToPreviousTab, TO_NORMAL])), (s("Next Tab"), s("Next"), action_key(&km, &[A::GoToNextTab, TO_NORMAL])), (s("Select pane"), s("Select"), to_normal_key), ]} else if matches!(mi.mode, IM::RenamePane | IM::RenameTab) { vec![ (s("When done"), s("Done"), to_normal_key), (s("Select pane"), s("Select"), action_key_group(&km, &[ - &[A::MoveFocus(Dir::Left)], &[A::MoveFocus(Dir::Down)], - &[A::MoveFocus(Dir::Up)], &[A::MoveFocus(Dir::Right)]])), + &[A::MoveFocus{direction: Dir::Left}], &[A::MoveFocus{direction: Dir::Down}], + &[A::MoveFocus{direction: Dir::Up}], &[A::MoveFocus{direction: Dir::Right}]])), ]} else { vec![] } } @@ -413,9 +413,14 @@ pub fn floating_panes_are_visible(mode_info: &ModeInfo) -> LinePart { let press = "Press "; let pane_mode = format!( "{}", - action_key(km, &[Action::SwitchToMode(InputMode::Pane)]) - .first() - .unwrap_or(&KeyWithModifier::new(BareKey::Char('?'))) + action_key( + km, + &[Action::SwitchToMode { + input_mode: InputMode::Pane + }] + ) + .first() + .unwrap_or(&KeyWithModifier::new(BareKey::Char('?'))) ); let plus = ", "; let p_left_separator = "<"; @@ -665,23 +670,38 @@ mod tests { vec![ ( KeyWithModifier::new(BareKey::Left), - vec![Action::MoveFocus(Direction::Left)], + vec![Action::MoveFocus { + direction: Direction::Left, + }], ), ( KeyWithModifier::new(BareKey::Down), - vec![Action::MoveFocus(Direction::Down)], + vec![Action::MoveFocus { + direction: Direction::Down, + }], ), ( KeyWithModifier::new(BareKey::Up), - vec![Action::MoveFocus(Direction::Up)], + vec![Action::MoveFocus { + direction: Direction::Up, + }], ), ( KeyWithModifier::new(BareKey::Right), - vec![Action::MoveFocus(Direction::Right)], + vec![Action::MoveFocus { + direction: Direction::Right, + }], ), ( KeyWithModifier::new(BareKey::Char('n')), - vec![Action::NewPane(None, None, false), TO_NORMAL], + vec![ + Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + TO_NORMAL, + ], ), ( KeyWithModifier::new(BareKey::Char('x')), @@ -715,23 +735,38 @@ mod tests { vec![ ( KeyWithModifier::new(BareKey::Left), - vec![Action::MoveFocus(Direction::Left)], + vec![Action::MoveFocus { + direction: Direction::Left, + }], ), ( KeyWithModifier::new(BareKey::Down), - vec![Action::MoveFocus(Direction::Down)], + vec![Action::MoveFocus { + direction: Direction::Down, + }], ), ( KeyWithModifier::new(BareKey::Up), - vec![Action::MoveFocus(Direction::Up)], + vec![Action::MoveFocus { + direction: Direction::Up, + }], ), ( KeyWithModifier::new(BareKey::Right), - vec![Action::MoveFocus(Direction::Right)], + vec![Action::MoveFocus { + direction: Direction::Right, + }], ), ( KeyWithModifier::new(BareKey::Char('n')), - vec![Action::NewPane(None, None, false), TO_NORMAL], + vec![ + Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + TO_NORMAL, + ], ), ( KeyWithModifier::new(BareKey::Char('x')), @@ -761,23 +796,38 @@ mod tests { vec![ ( KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), - vec![Action::MoveFocus(Direction::Left)], + vec![Action::MoveFocus { + direction: Direction::Left, + }], ), ( KeyWithModifier::new(BareKey::Enter).with_ctrl_modifier(), - vec![Action::MoveFocus(Direction::Down)], + vec![Action::MoveFocus { + direction: Direction::Down, + }], ), ( KeyWithModifier::new(BareKey::Char('1')).with_ctrl_modifier(), - vec![Action::MoveFocus(Direction::Up)], + vec![Action::MoveFocus { + direction: Direction::Up, + }], ), ( KeyWithModifier::new(BareKey::Char(' ')).with_ctrl_modifier(), - vec![Action::MoveFocus(Direction::Right)], + vec![Action::MoveFocus { + direction: Direction::Right, + }], ), ( KeyWithModifier::new(BareKey::Backspace), - vec![Action::NewPane(None, None, false), TO_NORMAL], + vec![ + Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + TO_NORMAL, + ], ), ( KeyWithModifier::new(BareKey::Esc), diff --git a/default-plugins/status-bar/src/tip/data/compact_layout.rs b/default-plugins/status-bar/src/tip/data/compact_layout.rs index 6da1a155..e8ee5e16 100644 --- a/default-plugins/status-bar/src/tip/data/compact_layout.rs +++ b/default-plugins/status-bar/src/tip/data/compact_layout.rs @@ -78,13 +78,17 @@ pub fn compact_layout_short(help: &ModeInfo) -> LinePart { fn add_keybinds(help: &ModeInfo) -> Vec<ANSIString> { let to_pane = action_key( &help.get_mode_keybinds(), - &[Action::SwitchToMode(InputMode::Pane)], + &[Action::SwitchToMode { + input_mode: InputMode::Pane, + }], ); let pane_frames = action_key( &help.get_keybinds_for_mode(InputMode::Pane), &[ Action::TogglePaneFrames, - Action::SwitchToMode(InputMode::Normal), + Action::SwitchToMode { + input_mode: InputMode::Normal, + }, ], ); diff --git a/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs b/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs index 033dd61d..cbc38f28 100644 --- a/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs +++ b/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs @@ -68,13 +68,17 @@ pub fn edit_scrollbuffer_short(help: &ModeInfo) -> LinePart { fn add_keybinds(help: &ModeInfo) -> Vec<ANSIString> { let to_pane = action_key( &help.get_mode_keybinds(), - &[Action::SwitchToMode(InputMode::Scroll)], + &[Action::SwitchToMode { + input_mode: InputMode::Scroll, + }], ); let edit_buffer = action_key( &help.get_keybinds_for_mode(InputMode::Scroll), &[ Action::EditScrollback, - Action::SwitchToMode(InputMode::Normal), + Action::SwitchToMode { + input_mode: InputMode::Normal, + }, ], ); diff --git a/default-plugins/status-bar/src/tip/data/floating_panes_mouse.rs b/default-plugins/status-bar/src/tip/data/floating_panes_mouse.rs index 4bf4a143..8e20a49c 100644 --- a/default-plugins/status-bar/src/tip/data/floating_panes_mouse.rs +++ b/default-plugins/status-bar/src/tip/data/floating_panes_mouse.rs @@ -47,13 +47,17 @@ pub fn floating_panes_mouse_short(help: &ModeInfo) -> LinePart { fn add_keybinds(help: &ModeInfo) -> Vec<ANSIString> { let to_pane = action_key( &help.get_mode_keybinds(), - &[Action::SwitchToMode(InputMode::Pane)], + &[Action::SwitchToMode { + input_mode: InputMode::Pane, + }], ); let floating_toggle = action_key( &help.get_keybinds_for_mode(InputMode::Pane), &[ Action::ToggleFloatingPanes, - Action::SwitchToMode(InputMode::Normal), + Action::SwitchToMode { + input_mode: InputMode::Normal, + }, ], ); diff --git a/default-plugins/status-bar/src/tip/data/move_focus_hjkl_tab_switch.rs b/default-plugins/status-bar/src/tip/data/move_focus_hjkl_tab_switch.rs index c39ea302..5afcc6ec 100644 --- a/default-plugins/status-bar/src/tip/data/move_focus_hjkl_tab_switch.rs +++ b/default-plugins/status-bar/src/tip/data/move_focus_hjkl_tab_switch.rs @@ -50,8 +50,12 @@ fn add_keybinds(help: &ModeInfo) -> Vec<ANSIString> { let move_focus_keys = action_key_group( &pane_keymap, &[ - &[Action::MoveFocusOrTab(Direction::Left)], - &[Action::MoveFocusOrTab(Direction::Right)], + &[Action::MoveFocusOrTab { + direction: Direction::Left, + }], + &[Action::MoveFocusOrTab { + direction: Direction::Right, + }], ], ); diff --git a/default-plugins/status-bar/src/tip/data/quicknav.rs b/default-plugins/status-bar/src/tip/data/quicknav.rs index ef83bbd7..a33afc18 100644 --- a/default-plugins/status-bar/src/tip/data/quicknav.rs +++ b/default-plugins/status-bar/src/tip/data/quicknav.rs @@ -62,7 +62,14 @@ struct Keygroups<'a> { fn add_keybinds(help: &ModeInfo) -> Keygroups { let normal_keymap = help.get_mode_keybinds(); - let new_pane_keys = action_key(&normal_keymap, &[Action::NewPane(None, None, false)]); + let new_pane_keys = action_key( + &normal_keymap, + &[Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }], + ); let new_pane = if new_pane_keys.is_empty() { vec![Style::new().bold().paint("UNBOUND")] } else { @@ -72,8 +79,14 @@ fn add_keybinds(help: &ModeInfo) -> Keygroups { let mut resize_keys = action_key_group( &normal_keymap, &[ - &[Action::Resize(Resize::Increase, None)], - &[Action::Resize(Resize::Decrease, None)], + &[Action::Resize { + resize: Resize::Increase, + direction: None, + }], + &[Action::Resize { + resize: Resize::Decrease, + direction: None, + }], ], ); if resize_keys.contains(&KeyWithModifier::new(BareKey::Char('=')).with_alt_modifier()) @@ -90,12 +103,24 @@ fn add_keybinds(help: &ModeInfo) -> Keygroups { let move_focus_keys = action_key_group( &normal_keymap, &[ - &[Action::MoveFocus(Direction::Left)], - &[Action::MoveFocusOrTab(Direction::Left)], - &[Action::MoveFocus(Direction::Down)], - &[Action::MoveFocus(Direction::Up)], - &[Action::MoveFocus(Direction::Right)], - &[Action::MoveFocusOrTab(Direction::Right)], + &[Action::MoveFocus { + direction: Direction::Left, + }], + &[Action::MoveFocusOrTab { + direction: Direction::Left, + }], + &[Action::MoveFocus { + direction: Direction::Down, + }], + &[Action::MoveFocus { + direction: Direction::Up, + }], + &[Action::MoveFocus { + direction: Direction::Right, + }], + &[Action::MoveFocusOrTab { + direction: Direction::Right, + }], ], ); // Let's see if we have some pretty groups in common here diff --git a/default-plugins/status-bar/src/tip/data/sync_tab.rs b/default-plugins/status-bar/src/tip/data/sync_tab.rs index 486e2aa2..b319ee0b 100644 --- a/default-plugins/status-bar/src/tip/data/sync_tab.rs +++ b/default-plugins/status-bar/src/tip/data/sync_tab.rs @@ -46,13 +46,17 @@ pub fn sync_tab_short(help: &ModeInfo) -> LinePart { fn add_keybinds(help: &ModeInfo) -> Vec<ANSIString> { let to_tab = action_key( &help.get_mode_keybinds(), - &[Action::SwitchToMode(InputMode::Tab)], + &[Action::SwitchToMode { + input_mode: InputMode::Tab, + }], ); let sync_tabs = action_key( &help.get_keybinds_for_mode(InputMode::Tab), &[ Action::ToggleActiveSyncTab, - Action::SwitchToMode(InputMode::Normal), + Action::SwitchToMode { + input_mode: InputMode::Normal, + }, ], ); diff --git a/xtask/src/build.rs b/xtask/src/build.rs index e150672c..c5c54fca 100644 --- a/xtask/src/build.rs +++ b/xtask/src/build.rs @@ -84,6 +84,95 @@ pub fn build(sh: &Shell, flags: flags::Build) -> anyhow::Result<()> { } } + // Build client-server IPC protobuf definitions + { + let zellij_utils_basedir = crate::project_root().join("zellij-utils"); + let _pd = sh.push_dir(zellij_utils_basedir); + + let prost_ipc_dir = sh.current_dir().join("assets").join("prost_ipc"); + let client_server_contract_dir = + sh.current_dir().join("src").join("client_server_contract"); + std::fs::create_dir_all(&prost_ipc_dir).unwrap(); + + let mut prost = prost_build::Config::new(); + let last_generated = prost_ipc_dir + .join("generated_client_server_api.rs") + .metadata() + .and_then(|m| m.modified()); + let mut needs_regeneration = false; + prost.out_dir(prost_ipc_dir); + prost.include_file("generated_client_server_api.rs"); + let mut proto_files = vec![]; + for entry in std::fs::read_dir(&client_server_contract_dir).unwrap() { + let entry_path = entry.unwrap().path(); + if entry_path.is_file() { + if !entry_path + .extension() + .map(|e| e == "proto") + .unwrap_or(false) + { + continue; + } + proto_files.push(entry_path.display().to_string()); + let modified = entry_path.metadata().and_then(|m| m.modified()); + needs_regeneration |= match (&last_generated, modified) { + (Ok(last_generated), Ok(modified)) => modified >= *last_generated, + // Couldn't read some metadata, assume needs update + _ => true, + } + } + } + if needs_regeneration { + prost + .compile_protos(&proto_files, &[client_server_contract_dir]) + .unwrap(); + } + } + + // Build web server protobuf definitions + { + let zellij_utils_basedir = crate::project_root().join("zellij-utils"); + let _pd = sh.push_dir(zellij_utils_basedir); + + let prost_web_server_dir = sh.current_dir().join("assets").join("prost_web_server"); + let web_server_contract_dir = sh.current_dir().join("src").join("web_server_contract"); + std::fs::create_dir_all(&prost_web_server_dir).unwrap(); + + let mut prost = prost_build::Config::new(); + let last_generated = prost_web_server_dir + .join("generated_web_server_api.rs") + .metadata() + .and_then(|m| m.modified()); + let mut needs_regeneration = false; + prost.out_dir(prost_web_server_dir); + prost.include_file("generated_web_server_api.rs"); + let mut proto_files = vec![]; + for entry in std::fs::read_dir(&web_server_contract_dir).unwrap() { + let entry_path = entry.unwrap().path(); + if entry_path.is_file() { + if !entry_path + .extension() + .map(|e| e == "proto") + .unwrap_or(false) + { + continue; + } + proto_files.push(entry_path.display().to_string()); + let modified = entry_path.metadata().and_then(|m| m.modified()); + needs_regeneration |= match (&last_generated, modified) { + (Ok(last_generated), Ok(modified)) => modified >= *last_generated, + // Couldn't read some metadata, assume needs update + _ => true, + } + } + } + if needs_regeneration { + prost + .compile_protos(&proto_files, &[web_server_contract_dir]) + .unwrap(); + } + } + let _pd = sh.push_dir(Path::new(crate_name)); // Tell the user where we are now println!(); diff --git a/zellij-client/Cargo.toml b/zellij-client/Cargo.toml index 970799e6..4fd01f1b 100644 --- a/zellij-client/Cargo.toml +++ b/zellij-client/Cargo.toml @@ -28,7 +28,6 @@ log = { workspace = true } mio = { version = "0.7.11", default-features = false, features = ['os-ext'] } nix = { workspace = true } notify = { workspace = true } -rmp-serde = { workspace = true } regex = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/zellij-client/src/cli_client.rs b/zellij-client/src/cli_client.rs index 825b0a5a..29774994 100644 --- a/zellij-client/src/cli_client.rs +++ b/zellij-client/src/cli_client.rs @@ -104,8 +104,8 @@ fn pipe_client( .insert("_zellij_id".to_owned(), Uuid::new_v4().to_string()); } let create_msg = |payload: Option<String>| -> ClientToServerMsg { - ClientToServerMsg::Action( - Action::CliPipe { + ClientToServerMsg::Action { + action: Action::CliPipe { pipe_id: pipe_id.clone(), name: name.clone(), payload, @@ -119,9 +119,9 @@ fn pipe_client( cwd: cwd.clone(), pane_title: pane_title.clone(), }, - pane_id, - None, - ) + terminal_id: pane_id, + client_id: None, + } }; let is_piped = !os_input.stdin_is_terminal(); loop { @@ -151,7 +151,7 @@ fn pipe_client( loop { // wait for a response and act accordingly match os_input.recv_from_server() { - Some((ServerToClientMsg::UnblockCliPipeInput(pipe_name), _)) => { + Some((ServerToClientMsg::UnblockCliPipeInput { pipe_name }, _)) => { // unblock this pipe, meaning we need to stop waiting for a response and read // once more from STDIN if pipe_name == pipe_id { @@ -164,7 +164,7 @@ fn pipe_client( } } }, - Some((ServerToClientMsg::CliPipeOutput(pipe_name, output), _)) => { + Some((ServerToClientMsg::CliPipeOutput { pipe_name, output }, _)) => { // send data to STDOUT, this *does not* mean we need to unblock the input let err_context = "Failed to write to stdout"; if pipe_name == pipe_id { @@ -176,15 +176,15 @@ fn pipe_client( stdout.flush().context(err_context).non_fatal(); } }, - Some((ServerToClientMsg::Log(log_lines), _)) => { + Some((ServerToClientMsg::Log { lines: log_lines }, _)) => { log_lines.iter().for_each(|line| println!("{line}")); process::exit(0); }, - Some((ServerToClientMsg::LogError(log_lines), _)) => { + Some((ServerToClientMsg::LogError { lines: log_lines }, _)) => { log_lines.iter().for_each(|line| eprintln!("{line}")); process::exit(2); }, - Some((ServerToClientMsg::Exit(exit_reason), _)) => match exit_reason { + Some((ServerToClientMsg::Exit { exit_reason }, _)) => match exit_reason { ExitReason::Error(e) => { eprintln!("{}", e); process::exit(2); @@ -204,22 +204,26 @@ fn individual_messages_client( action: Action, pane_id: Option<u32>, ) { - let msg = ClientToServerMsg::Action(action, pane_id, None); + let msg = ClientToServerMsg::Action { + action, + terminal_id: pane_id, + client_id: None, + }; os_input.send_to_server(msg); loop { match os_input.recv_from_server() { Some((ServerToClientMsg::UnblockInputThread, _)) => { break; }, - Some((ServerToClientMsg::Log(log_lines), _)) => { + Some((ServerToClientMsg::Log { lines: log_lines }, _)) => { log_lines.iter().for_each(|line| println!("{line}")); break; }, - Some((ServerToClientMsg::LogError(log_lines), _)) => { + Some((ServerToClientMsg::LogError { lines: log_lines }, _)) => { log_lines.iter().for_each(|line| eprintln!("{line}")); process::exit(2); }, - Some((ServerToClientMsg::Exit(exit_reason), _)) => match exit_reason { + Some((ServerToClientMsg::Exit { exit_reason }, _)) => match exit_reason { ExitReason::Error(e) => { eprintln!("{}", e); process::exit(2); diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index 91ed1ac5..d2cee2e0 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -176,33 +176,51 @@ impl InputHandler { InputEvent::Paste(pasted_text) => { if self.mode == InputMode::Normal || self.mode == InputMode::Locked { self.dispatch_action( - Action::Write(None, bracketed_paste_start.clone(), false), + Action::Write { + key_with_modifier: None, + bytes: bracketed_paste_start.clone(), + is_kitty_keyboard_protocol: false, + }, None, ); self.dispatch_action( - Action::Write(None, pasted_text.as_bytes().to_vec(), false), + Action::Write { + key_with_modifier: None, + bytes: pasted_text.as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }, None, ); self.dispatch_action( - Action::Write(None, bracketed_paste_end.clone(), false), + Action::Write { + key_with_modifier: None, + bytes: bracketed_paste_end.clone(), + is_kitty_keyboard_protocol: false, + }, None, ); } if self.mode == InputMode::EnterSearch { self.dispatch_action( - Action::SearchInput(pasted_text.as_bytes().to_vec()), + Action::SearchInput { + input: pasted_text.as_bytes().to_vec(), + }, None, ); } if self.mode == InputMode::RenameTab { self.dispatch_action( - Action::TabNameInput(pasted_text.as_bytes().to_vec()), + Action::TabNameInput { + input: pasted_text.as_bytes().to_vec(), + }, None, ); } if self.mode == InputMode::RenamePane { self.dispatch_action( - Action::PaneNameInput(pasted_text.as_bytes().to_vec()), + Action::PaneNameInput { + input: pasted_text.as_bytes().to_vec(), + }, None, ); } @@ -249,33 +267,39 @@ impl InputHandler { ) { // we interpret the keys into actions on the server side so that we can change the // keybinds at runtime - self.os_input.send_to_server(ClientToServerMsg::Key( - key.clone(), + self.os_input.send_to_server(ClientToServerMsg::Key { + key: key.clone(), raw_bytes, is_kitty_keyboard_protocol, - )); + }); } fn handle_stdin_ansi_instruction(&mut self, ansi_stdin_instructions: AnsiStdinInstruction) { match ansi_stdin_instructions { AnsiStdinInstruction::PixelDimensions(pixel_dimensions) => { self.os_input - .send_to_server(ClientToServerMsg::TerminalPixelDimensions(pixel_dimensions)); + .send_to_server(ClientToServerMsg::TerminalPixelDimensions { + pixel_dimensions, + }); }, AnsiStdinInstruction::BackgroundColor(background_color_instruction) => { self.os_input - .send_to_server(ClientToServerMsg::BackgroundColor( - background_color_instruction, - )); + .send_to_server(ClientToServerMsg::BackgroundColor { + color: background_color_instruction, + }); }, AnsiStdinInstruction::ForegroundColor(foreground_color_instruction) => { self.os_input - .send_to_server(ClientToServerMsg::ForegroundColor( - foreground_color_instruction, - )); + .send_to_server(ClientToServerMsg::ForegroundColor { + color: foreground_color_instruction, + }); }, AnsiStdinInstruction::ColorRegisters(color_registers) => { + let color_registers: Vec<_> = color_registers + .into_iter() + .map(|(index, color)| zellij_utils::ipc::ColorRegister { index, color }) + .collect(); self.os_input - .send_to_server(ClientToServerMsg::ColorRegisters(color_registers)); + .send_to_server(ClientToServerMsg::ColorRegisters { color_registers }); }, AnsiStdinInstruction::SynchronizedOutput(enabled) => { self.send_client_instructions @@ -287,7 +311,12 @@ impl InputHandler { fn handle_mouse_event(&mut self, mouse_event: &MouseEvent) { // This dispatch handles all of the output(s) to terminal // pane(s). - self.dispatch_action(Action::MouseEvent(*mouse_event), None); + self.dispatch_action( + Action::MouseEvent { + event: *mouse_event, + }, + None, + ); } /// Dispatches an [`Action`]. /// @@ -306,38 +335,47 @@ impl InputHandler { match action { Action::NoOp => {}, Action::Quit => { - self.os_input - .send_to_server(ClientToServerMsg::Action(action, None, client_id)); + self.os_input.send_to_server(ClientToServerMsg::Action { + action, + terminal_id: None, + client_id, + }); self.exit(ExitReason::Normal); should_break = true; }, Action::Detach => { - self.os_input - .send_to_server(ClientToServerMsg::Action(action, None, client_id)); + self.os_input.send_to_server(ClientToServerMsg::Action { + action, + terminal_id: None, + client_id, + }); self.exit(ExitReason::NormalDetached); should_break = true; }, Action::CloseFocus - | Action::SwitchToMode(..) + | Action::SwitchToMode { .. } | Action::ClearScreen - | Action::NewPane(..) - | Action::Run(_) - | Action::NewTiledPane(..) - | Action::NewFloatingPane(..) + | Action::NewPane { .. } + | Action::Run { .. } + | Action::NewTiledPane { .. } + | Action::NewFloatingPane { .. } | Action::ToggleFloatingPanes | Action::TogglePaneEmbedOrFloating - | Action::NewTab(..) + | Action::NewTab { .. } | Action::GoToNextTab | Action::GoToPreviousTab | Action::CloseTab - | Action::GoToTab(_) - | Action::MoveTab(_) - | Action::GoToTabName(_, _) + | Action::GoToTab { .. } + | Action::MoveTab { .. } + | Action::GoToTabName { .. } | Action::ToggleTab - | Action::MoveFocusOrTab(_) => { + | Action::MoveFocusOrTab { .. } => { self.command_is_executing.blocking_input_thread(); - self.os_input - .send_to_server(ClientToServerMsg::Action(action, None, client_id)); + self.os_input.send_to_server(ClientToServerMsg::Action { + action, + terminal_id: None, + client_id, + }); self.command_is_executing .wait_until_input_thread_is_unblocked(); }, @@ -350,9 +388,11 @@ impl InputHandler { self.mouse_mode_active = true; } }, - _ => self - .os_input - .send_to_server(ClientToServerMsg::Action(action, None, client_id)), + _ => self.os_input.send_to_server(ClientToServerMsg::Action { + action, + terminal_id: None, + client_id, + }), } should_break diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index f06663d0..1942c705 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -65,24 +65,22 @@ pub(crate) enum ClientInstruction { impl From<ServerToClientMsg> for ClientInstruction { fn from(instruction: ServerToClientMsg) -> Self { match instruction { - ServerToClientMsg::Exit(e) => ClientInstruction::Exit(e), - ServerToClientMsg::Render(buffer) => ClientInstruction::Render(buffer), + ServerToClientMsg::Exit { exit_reason } => ClientInstruction::Exit(exit_reason), + ServerToClientMsg::Render { content } => ClientInstruction::Render(content), ServerToClientMsg::UnblockInputThread => ClientInstruction::UnblockInputThread, ServerToClientMsg::Connected => ClientInstruction::Connected, - ServerToClientMsg::Log(log_lines) => ClientInstruction::Log(log_lines), - ServerToClientMsg::LogError(log_lines) => ClientInstruction::LogError(log_lines), - ServerToClientMsg::SwitchSession(connect_to_session) => { + ServerToClientMsg::Log { lines } => ClientInstruction::Log(lines), + ServerToClientMsg::LogError { lines } => ClientInstruction::LogError(lines), + ServerToClientMsg::SwitchSession { connect_to_session } => { ClientInstruction::SwitchSession(connect_to_session) }, - ServerToClientMsg::UnblockCliPipeInput(_pipe_name) => { + ServerToClientMsg::UnblockCliPipeInput { .. } => { ClientInstruction::UnblockCliPipeInput(()) }, - ServerToClientMsg::CliPipeOutput(_pipe_name, _output) => { - ClientInstruction::CliPipeOutput((), ()) - }, + ServerToClientMsg::CliPipeOutput { .. } => ClientInstruction::CliPipeOutput((), ()), ServerToClientMsg::QueryTerminalSize => ClientInstruction::QueryTerminalSize, ServerToClientMsg::StartWebServer => ClientInstruction::StartWebServer, - ServerToClientMsg::RenamedSession(name) => ClientInstruction::RenamedSession(name), + ServerToClientMsg::RenamedSession { name } => ClientInstruction::RenamedSession(name), ServerToClientMsg::ConfigFileUpdated => ClientInstruction::ConfigFileUpdated, } } @@ -319,12 +317,14 @@ pub fn start_client( cwd: None, }; ( - ClientToServerMsg::AttachClient( + ClientToServerMsg::AttachClient { cli_assets, tab_position_to_focus, - pane_id_to_focus, + pane_to_focus: pane_id_to_focus.map(|(pane_id, is_plugin)| { + zellij_utils::ipc::PaneReference { pane_id, is_plugin } + }), is_web_client, - ), + }, ipc_pipe, ) }, @@ -358,7 +358,10 @@ pub fn start_client( let is_web_client = false; ( - ClientToServerMsg::FirstClientConnected(cli_assets, is_web_client), + ClientToServerMsg::FirstClientConnected { + cli_assets, + is_web_client, + }, ipc_pipe, ) }, @@ -405,7 +408,10 @@ pub fn start_client( let is_web_client = false; ( - ClientToServerMsg::FirstClientConnected(cli_assets, is_web_client), + ClientToServerMsg::FirstClientConnected { + cli_assets, + is_web_client, + }, ipc_pipe, ) }, @@ -491,19 +497,19 @@ pub fn start_client( Box::new({ let os_api = os_input.clone(); move || { - os_api.send_to_server(ClientToServerMsg::TerminalResize( - os_api.get_terminal_size_using_fd(0), - )); + os_api.send_to_server(ClientToServerMsg::TerminalResize { + new_size: os_api.get_terminal_size_using_fd(0), + }); } }), Box::new({ let os_api = os_input.clone(); move || { - os_api.send_to_server(ClientToServerMsg::Action( - on_force_close.into(), - None, - None, - )); + os_api.send_to_server(ClientToServerMsg::Action { + action: on_force_close.into(), + terminal_id: None, + client_id: None, + }); } }), ); @@ -516,11 +522,13 @@ pub fn start_client( .spawn({ let os_input = os_input.clone(); let mut should_break = false; + let mut consecutive_unknown_messages_received = 0; move || loop { match os_input.recv_from_server() { Some((instruction, err_ctx)) => { + consecutive_unknown_messages_received = 0; err_ctx.update_thread_ctx(); - if let ServerToClientMsg::Exit(_) = instruction { + if let ServerToClientMsg::Exit { .. } = instruction { should_break = true; } send_client_instructions.send(instruction.into()).unwrap(); @@ -529,16 +537,19 @@ pub fn start_client( } }, None => { + consecutive_unknown_messages_received += 1; send_client_instructions .send(ClientInstruction::UnblockInputThread) .unwrap(); - log::error!("Received empty message from server"); - send_client_instructions - .send(ClientInstruction::Error( - "Received empty message from server".to_string(), - )) - .unwrap(); - break; + log::error!("Received unknown message from server"); + if consecutive_unknown_messages_received >= 1000 { + send_client_instructions + .send(ClientInstruction::Error( + "Received empty unknown from server".to_string(), + )) + .unwrap(); + break; + } }, } } @@ -664,9 +675,9 @@ pub fn start_client( synchronised_output = enabled; }, ClientInstruction::QueryTerminalSize => { - os_input.send_to_server(ClientToServerMsg::TerminalResize( - os_input.get_terminal_size_using_fd(0), - )); + os_input.send_to_server(ClientToServerMsg::TerminalResize { + new_size: os_input.get_terminal_size_using_fd(0), + }); }, ClientInstruction::StartWebServer => { let web_server_base_url = web_server_base_url( @@ -677,14 +688,14 @@ pub fn start_client( ); match spawn_web_server(&cli_args) { Ok(_) => { - let _ = os_input.send_to_server(ClientToServerMsg::WebServerStarted( - web_server_base_url, - )); + let _ = os_input.send_to_server(ClientToServerMsg::WebServerStarted { + base_url: web_server_base_url, + }); }, Err(e) => { log::error!("Failed to start web_server: {}", e); - let _ = - os_input.send_to_server(ClientToServerMsg::FailedToStartWebServer(e)); + let _ = os_input + .send_to_server(ClientToServerMsg::FailedToStartWebServer { error: e }); }, } }, @@ -779,7 +790,10 @@ pub fn start_server_detached( let is_web_client = false; ( - ClientToServerMsg::FirstClientConnected(cli_assets, is_web_client), + ClientToServerMsg::FirstClientConnected { + cli_assets, + is_web_client, + }, ipc_pipe, ) }, @@ -826,7 +840,10 @@ pub fn start_server_detached( let is_web_client = false; ( - ClientToServerMsg::FirstClientConnected(cli_assets, is_web_client), + ClientToServerMsg::FirstClientConnected { + cli_assets, + is_web_client, + }, ipc_pipe, ) }, diff --git a/zellij-client/src/os_input_output.rs b/zellij-client/src/os_input_output.rs index 941892da..f88b755f 100644 --- a/zellij-client/src/os_input_output.rs +++ b/zellij-client/src/os_input_output.rs @@ -224,7 +224,7 @@ impl ClientOsApi for ClientOsInputOutput { fn send_to_server(&self, msg: ClientToServerMsg) { match self.send_instructions_to_server.lock().unwrap().as_mut() { Some(sender) => { - let _ = sender.send(msg); + let _ = sender.send_client_msg(msg); }, None => { log::warn!("Server not ready, dropping message."); @@ -237,7 +237,7 @@ impl ClientOsApi for ClientOsInputOutput { .unwrap() .as_mut() .unwrap() - .recv() + .recv_server_msg() } fn handle_signals(&self, sigwinch_cb: Box<dyn Fn()>, quit_cb: Box<dyn Fn()>) { let mut sigwinch_cb_timestamp = time::Instant::now(); diff --git a/zellij-client/src/web_client/ipc_listener.rs b/zellij-client/src/web_client/ipc_listener.rs index 766124ad..ebc8e150 100644 --- a/zellij-client/src/web_client/ipc_listener.rs +++ b/zellij-client/src/web_client/ipc_listener.rs @@ -2,7 +2,9 @@ use axum_server::Handle; use tokio::io::AsyncReadExt; use tokio::net::{UnixListener, UnixStream}; use zellij_utils::consts::WEBSERVER_SOCKET_PATH; +use zellij_utils::prost::Message; use zellij_utils::web_server_commands::InstructionForWebServer; +use zellij_utils::web_server_contract::web_server_contract::InstructionForWebServer as ProtoInstructionForWebServer; pub async fn create_webserver_receiver( id: &str, @@ -22,10 +24,22 @@ pub async fn create_webserver_receiver( pub async fn receive_webserver_instruction( receiver: &mut UnixStream, ) -> std::io::Result<InstructionForWebServer> { - let mut buffer = Vec::new(); - receiver.read_to_end(&mut buffer).await?; - let cursor = std::io::Cursor::new(buffer); - rmp_serde::decode::from_read(cursor) + // Read length prefix (4 bytes) + let mut len_bytes = [0u8; 4]; + receiver.read_exact(&mut len_bytes).await?; + let len = u32::from_le_bytes(len_bytes) as usize; + + // Read protobuf message + let mut buffer = vec![0u8; len]; + receiver.read_exact(&mut buffer).await?; + + // Decode protobuf message + let proto_instruction = ProtoInstructionForWebServer::decode(&buffer[..]) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?; + + // Convert to Rust type + proto_instruction + .try_into() .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)) } diff --git a/zellij-client/src/web_client/message_handlers.rs b/zellij-client/src/web_client/message_handlers.rs index 223e54ec..495ca003 100644 --- a/zellij-client/src/web_client/message_handlers.rs +++ b/zellij-client/src/web_client/message_handlers.rs @@ -79,11 +79,11 @@ pub fn parse_stdin( if !explicitly_disable_kitty_keyboard_protocol { match KittyKeyboardParser::new().parse(&buf) { Some(key_with_modifier) => { - os_input.send_to_server(ClientToServerMsg::Key( - key_with_modifier.clone(), - buf.to_vec(), - true, - )); + os_input.send_to_server(ClientToServerMsg::Key { + key: key_with_modifier.clone(), + raw_bytes: buf.to_vec(), + is_kitty_keyboard_protocol: true, + }); return; }, None => {}, @@ -105,29 +105,49 @@ pub fn parse_stdin( match input_event { InputEvent::Key(key_event) => { let key = cast_termwiz_key(key_event.clone(), &buf, None); - os_input.send_to_server(ClientToServerMsg::Key(key.clone(), buf.to_vec(), false)); + os_input.send_to_server(ClientToServerMsg::Key { + key: key.clone(), + raw_bytes: buf.to_vec(), + is_kitty_keyboard_protocol: false, + }); }, InputEvent::Mouse(mouse_event) => { let mouse_event = from_termwiz(mouse_old_event, mouse_event); - let action = Action::MouseEvent(mouse_event); - os_input.send_to_server(ClientToServerMsg::Action(action, None, None)); + let action = Action::MouseEvent { event: mouse_event }; + os_input.send_to_server(ClientToServerMsg::Action { + action, + terminal_id: None, + client_id: None, + }); }, InputEvent::Paste(pasted_text) => { - os_input.send_to_server(ClientToServerMsg::Action( - Action::Write(None, BRACKETED_PASTE_START.to_vec(), false), - None, - None, - )); - os_input.send_to_server(ClientToServerMsg::Action( - Action::Write(None, pasted_text.as_bytes().to_vec(), false), - None, - None, - )); - os_input.send_to_server(ClientToServerMsg::Action( - Action::Write(None, BRACKETED_PASTE_END.to_vec(), false), - None, - None, - )); + os_input.send_to_server(ClientToServerMsg::Action { + action: Action::Write { + key_with_modifier: None, + bytes: BRACKETED_PASTE_START.to_vec(), + is_kitty_keyboard_protocol: false, + }, + terminal_id: None, + client_id: None, + }); + os_input.send_to_server(ClientToServerMsg::Action { + action: Action::Write { + key_with_modifier: None, + bytes: pasted_text.as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }, + terminal_id: None, + client_id: None, + }); + os_input.send_to_server(ClientToServerMsg::Action { + action: Action::Write { + key_with_modifier: None, + bytes: BRACKETED_PASTE_END.to_vec(), + is_kitty_keyboard_protocol: false, + }, + terminal_id: None, + client_id: None, + }); }, _ => { log::error!("Unsupported event: {:#?}", input_event); diff --git a/zellij-client/src/web_client/server_listener.rs b/zellij-client/src/web_client/server_listener.rs index 1a19c327..1bbf4d56 100644 --- a/zellij-client/src/web_client/server_listener.rs +++ b/zellij-client/src/web_client/server_listener.rs @@ -99,15 +99,26 @@ pub fn zellij_server_listener( }, ); + let mut unknown_message_count = 0; loop { - match os_input.recv_from_server() { - Some((ServerToClientMsg::UnblockInputThread, _)) => {}, - Some((ServerToClientMsg::Exit(exit_reason), _)) => { + let msg = os_input.recv_from_server(); + if msg.is_some() { + unknown_message_count = 0; + } else { + unknown_message_count += 1; + } + match msg.map(|m| m.0) { + Some(ServerToClientMsg::UnblockInputThread) => {}, + Some(ServerToClientMsg::Connected) => {}, + Some(ServerToClientMsg::CliPipeOutput { .. } ) => {}, + Some(ServerToClientMsg::UnblockCliPipeInput { .. } ) => {}, + Some(ServerToClientMsg::StartWebServer { .. } ) => {}, + Some(ServerToClientMsg::Exit{exit_reason}) => { handle_exit_reason(&mut client_connection_bus, exit_reason); os_input.send_to_server(ClientToServerMsg::ClientExited); break; }, - Some((ServerToClientMsg::Render(bytes), _)) => { + Some(ServerToClientMsg::Render{content: bytes}) => { if !sent_init_messages { for message in terminal_init_messages() { client_connection_bus.send_stdout(message.to_owned()) @@ -116,33 +127,33 @@ pub fn zellij_server_listener( } client_connection_bus.send_stdout(bytes); }, - Some((ServerToClientMsg::SwitchSession(connect_to_session), _)) => { + Some(ServerToClientMsg::SwitchSession{connect_to_session}) => { reconnect_to_session = Some(connect_to_session); continue 'reconnect_loop; }, - Some((ServerToClientMsg::QueryTerminalSize, _)) => { + Some(ServerToClientMsg::QueryTerminalSize) => { client_connection_bus.send_control( WebServerToWebClientControlMessage::QueryTerminalSize, ); }, - Some((ServerToClientMsg::Log(lines), _)) => { + Some(ServerToClientMsg::Log{lines}) => { client_connection_bus.send_control( WebServerToWebClientControlMessage::Log { lines }, ); }, - Some((ServerToClientMsg::LogError(lines), _)) => { + Some(ServerToClientMsg::LogError{lines}) => { client_connection_bus.send_control( WebServerToWebClientControlMessage::LogError { lines }, ); }, - Some((ServerToClientMsg::RenamedSession(new_session_name), _)) => { + Some(ServerToClientMsg::RenamedSession{name: new_session_name}) => { client_connection_bus.send_control( WebServerToWebClientControlMessage::SwitchedSession { new_session_name, }, ); }, - Some((ServerToClientMsg::ConfigFileUpdated, _)) => { + Some(ServerToClientMsg::ConfigFileUpdated) => { if let Some(config_file_path) = &config_file_path { if let Ok(new_config) = Config::from_path(&config_file_path, Some(config.clone())) { @@ -189,10 +200,13 @@ pub fn zellij_server_listener( } } }, - _ => { - // server disconnected, stop trying to listen otherwise we retry - // indefinitely and get 100% CPU - break; + None => { + if unknown_message_count >= 1000 { + log::error!("Error: Received more than 1000 consecutive unknown server messages, disconnecting."); + // this probably means we're in an infinite loop, let's + // disconnect so as not to cause 100% CPU + break; + } }, } } diff --git a/zellij-client/src/web_client/session_management.rs b/zellij-client/src/web_client/session_management.rs index d0dc9c13..81fea0d5 100644 --- a/zellij-client/src/web_client/session_management.rs +++ b/zellij-client/src/web_client/session_management.rs @@ -130,7 +130,10 @@ fn spawn_new_session( let is_web_client = true; ( - ClientToServerMsg::FirstClientConnected(cli_assets, is_web_client), + ClientToServerMsg::FirstClientConnected { + cli_assets, + is_web_client, + }, zellij_ipc_pipe, ) } @@ -166,6 +169,11 @@ fn ipc_pipe_and_first_message_for_existing_session( }; let is_web_client = true; - let first_message = ClientToServerMsg::AttachClient(cli_assets, None, None, is_web_client); + let first_message = ClientToServerMsg::AttachClient { + cli_assets, + tab_position_to_focus: None, + pane_to_focus: None, + is_web_client, + }; (first_message, zellij_ipc_pipe) } diff --git a/zellij-client/src/web_client/unit/web_client_tests.rs b/zellij-client/src/web_client/unit/web_client_tests.rs index e0fa0516..ff87bc58 100644 --- a/zellij-client/src/web_client/unit/web_client_tests.rs +++ b/zellij-client/src/web_client/unit/web_client_tests.rs @@ -432,10 +432,15 @@ mod web_client_tests { let messages = mock_api.get_sent_messages(); for msg in messages { match msg { - ClientToServerMsg::TerminalResize(_) => { + ClientToServerMsg::TerminalResize { new_size: _ } => { found_resize = true; }, - ClientToServerMsg::Key(_, _, _) | ClientToServerMsg::Action(_, _, _) => { + ClientToServerMsg::Key { .. } + | ClientToServerMsg::Action { + action: _, + terminal_id: _, + client_id: _, + } => { found_terminal_input = true; }, _ => {}, @@ -869,7 +874,7 @@ mod web_client_tests { for (_, mock_api) in mock_apis.iter() { let messages = mock_api.get_sent_messages(); for msg in messages { - if matches!(msg, ClientToServerMsg::TerminalResize(_)) { + if matches!(msg, ClientToServerMsg::TerminalResize { .. }) { total_resize_messages = total_resize_messages.saturating_add(1); } } @@ -1312,7 +1317,12 @@ impl SessionManager for MockSessionManager { force_run_layout_commands: false, cwd: None, }; - let first_message = ClientToServerMsg::AttachClient(cli_assets, None, None, true); + let first_message = ClientToServerMsg::AttachClient { + cli_assets, + tab_position_to_focus: None, + pane_to_focus: None, + is_web_client: true, + }; (first_message, mock_ipc_path) } diff --git a/zellij-client/src/web_client/websocket_handlers.rs b/zellij-client/src/web_client/websocket_handlers.rs index e5c476a0..0335f2a3 100644 --- a/zellij-client/src/web_client/websocket_handlers.rs +++ b/zellij-client/src/web_client/websocket_handlers.rs @@ -62,7 +62,7 @@ async fn handle_ws_control(socket: WebSocket, state: AppState) { }; let client_msg = match deserialized_msg.payload { WebClientToWebServerControlMessagePayload::TerminalResize(size) => { - ClientToServerMsg::TerminalResize(size) + ClientToServerMsg::TerminalResize { new_size: size } }, }; diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 87536b43..fe83c474 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -915,7 +915,9 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( client_id, os_input, - ServerToClientMsg::UnblockCliPipeInput(pipe_name.clone()), + ServerToClientMsg::UnblockCliPipeInput { + pipe_name: pipe_name.clone() + }, session_state ); }, @@ -926,7 +928,9 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( client_id, os_input, - ServerToClientMsg::UnblockCliPipeInput(pipe_name.clone()), + ServerToClientMsg::UnblockCliPipeInput { + pipe_name: pipe_name.clone() + }, session_state ); } @@ -940,7 +944,10 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( client_id, os_input, - ServerToClientMsg::CliPipeOutput(pipe_name.clone(), output.clone()), + ServerToClientMsg::CliPipeOutput { + pipe_name: pipe_name.clone(), + output: output.clone() + }, session_state ); }, @@ -951,7 +958,10 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( client_id, os_input, - ServerToClientMsg::CliPipeOutput(pipe_name.clone(), output.clone()), + ServerToClientMsg::CliPipeOutput { + pipe_name: pipe_name.clone(), + output: output.clone() + }, session_state ); } @@ -959,8 +969,12 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { } }, ServerInstruction::ClientExit(client_id) => { - let _ = - os_input.send_to_client(client_id, ServerToClientMsg::Exit(ExitReason::Normal)); + let _ = os_input.send_to_client( + client_id, + ServerToClientMsg::Exit { + exit_reason: ExitReason::Normal, + }, + ); remove_client!(client_id, os_input, session_state); if let Some(min_size) = session_state.read().unwrap().min_client_terminal_size() { session_data @@ -1036,7 +1050,9 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { ServerInstruction::SendWebClientsForbidden(client_id) => { let _ = os_input.send_to_client( client_id, - ServerToClientMsg::Exit(ExitReason::WebClientsForbidden), + ServerToClientMsg::Exit { + exit_reason: ExitReason::WebClientsForbidden, + }, ); remove_client!(client_id, os_input, session_state); if let Some(min_size) = session_state.read().unwrap().min_client_terminal_size() { @@ -1053,8 +1069,12 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { ServerInstruction::KillSession => { let client_ids = session_state.read().unwrap().client_ids(); for client_id in client_ids { - let _ = os_input - .send_to_client(client_id, ServerToClientMsg::Exit(ExitReason::Normal)); + let _ = os_input.send_to_client( + client_id, + ServerToClientMsg::Exit { + exit_reason: ExitReason::Normal, + }, + ); remove_client!(client_id, os_input, session_state); } break; @@ -1069,15 +1089,23 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { .filter(|c| c != &client_id) .collect(); for client_id in client_ids { - let _ = os_input - .send_to_client(client_id, ServerToClientMsg::Exit(ExitReason::Normal)); + let _ = os_input.send_to_client( + client_id, + ServerToClientMsg::Exit { + exit_reason: ExitReason::Normal, + }, + ); remove_client!(client_id, os_input, session_state); } }, ServerInstruction::DetachSession(client_ids) => { for client_id in client_ids { - let _ = os_input - .send_to_client(client_id, ServerToClientMsg::Exit(ExitReason::Normal)); + let _ = os_input.send_to_client( + client_id, + ServerToClientMsg::Exit { + exit_reason: ExitReason::Normal, + }, + ); remove_client!(client_id, os_input, session_state); if let Some(min_size) = session_state.read().unwrap().min_client_terminal_size() { @@ -1120,14 +1148,20 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( *client_id, os_input, - ServerToClientMsg::Render(client_render_instruction.clone()), + ServerToClientMsg::Render { + content: client_render_instruction.clone() + }, session_state ); } } else { for client_id in client_ids { - let _ = os_input - .send_to_client(client_id, ServerToClientMsg::Exit(ExitReason::Normal)); + let _ = os_input.send_to_client( + client_id, + ServerToClientMsg::Exit { + exit_reason: ExitReason::Normal, + }, + ); remove_client!(client_id, os_input, session_state); } break; @@ -1138,7 +1172,9 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { for client_id in client_ids { let _ = os_input.send_to_client( client_id, - ServerToClientMsg::Exit(ExitReason::Error(backtrace.clone())), + ServerToClientMsg::Exit { + exit_reason: ExitReason::Error(backtrace.clone()), + }, ); remove_client!(client_id, os_input, session_state); } @@ -1152,7 +1188,9 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( client_id, os_input, - ServerToClientMsg::Log(lines_to_log), + ServerToClientMsg::Log { + lines: lines_to_log + }, session_state ); }, @@ -1160,7 +1198,9 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( client_id, os_input, - ServerToClientMsg::LogError(lines_to_log), + ServerToClientMsg::LogError { + lines: lines_to_log + }, session_state ); }, @@ -1212,7 +1252,7 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { send_to_client!( client_id, os_input, - ServerToClientMsg::SwitchSession(connect_to_session), + ServerToClientMsg::SwitchSession { connect_to_session }, session_state ); remove_client!(client_id, os_input, session_state); @@ -1371,7 +1411,9 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { for client_id in web_client_ids { let _ = os_input.send_to_client( client_id, - ServerToClientMsg::Exit(ExitReason::WebClientsForbidden), + ServerToClientMsg::Exit { + exit_reason: ExitReason::WebClientsForbidden, + }, ); remove_client!(client_id, os_input, session_state); } diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs index a85fab6f..adcca974 100644 --- a/zellij-server/src/os_input_output.rs +++ b/zellij-server/src/os_input_output.rs @@ -387,9 +387,14 @@ impl ClientSender { std::thread::spawn(move || { let err_context = || format!("failed to send message to client {client_id}"); for msg in client_buffer_receiver.iter() { - sender.send(msg).with_context(err_context).non_fatal(); + sender + .send_server_msg(msg) + .with_context(err_context) + .non_fatal(); } - let _ = sender.send(ServerToClientMsg::Exit(ExitReason::Disconnect)); + let _ = sender.send_server_msg(ServerToClientMsg::Exit { + exit_reason: ExitReason::Disconnect, + }); }); ClientSender { client_id, diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__rebind_keys_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__rebind_keys_plugin_command.snap index 91457bb2..028950f1 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__rebind_keys_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__rebind_keys_plugin_command.snap @@ -1,6 +1,5 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 8552 expression: "format!(\"{:#?}\", rebind_event)" --- Some( @@ -18,9 +17,9 @@ Some( }, }, [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], ), ( @@ -34,9 +33,9 @@ Some( }, }, [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], ), ( @@ -50,9 +49,9 @@ Some( }, }, [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], ), ( @@ -66,9 +65,9 @@ Some( }, }, [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], ), ( @@ -82,9 +81,9 @@ Some( }, }, [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], ), ( @@ -98,9 +97,9 @@ Some( }, }, [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], ), ( @@ -114,9 +113,9 @@ Some( }, }, [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], ), ( @@ -130,9 +129,9 @@ Some( }, }, [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], ), ], diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index 2a01ba1f..ee76fa05 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -663,16 +663,16 @@ fn open_file(env: &PluginEnv, file_to_open: FileToOpen, context: BTreeMap<String .cwd .map(|cwd| env.plugin_cwd.join(cwd)) .or_else(|| Some(env.plugin_cwd.clone())); - let action = Action::EditFile( - OpenFilePayload::new(path, file_to_open.line_number, cwd).with_originating_plugin( + let action = Action::EditFile { + payload: OpenFilePayload::new(path, file_to_open.line_number, cwd).with_originating_plugin( OriginatingPlugin::new(env.plugin_id, env.client_id, context), ), - None, + direction: None, floating, in_place, start_suppressed, - None, - ); + coordinates: None, + }; apply_action!(action, error_msg, env); } @@ -691,16 +691,16 @@ fn open_file_floating( .cwd .map(|cwd| env.plugin_cwd.join(cwd)) .or_else(|| Some(env.plugin_cwd.clone())); - let action = Action::EditFile( - OpenFilePayload::new(path, file_to_open.line_number, cwd).with_originating_plugin( + let action = Action::EditFile { + payload: OpenFilePayload::new(path, file_to_open.line_number, cwd).with_originating_plugin( OriginatingPlugin::new(env.plugin_id, env.client_id, context), ), - None, + direction: None, floating, in_place, start_suppressed, - floating_pane_coordinates, - ); + coordinates: floating_pane_coordinates, + }; apply_action!(action, error_msg, env); } @@ -719,16 +719,16 @@ fn open_file_in_place( .map(|cwd| env.plugin_cwd.join(cwd)) .or_else(|| Some(env.plugin_cwd.clone())); - let action = Action::EditFile( - OpenFilePayload::new(path, file_to_open.line_number, cwd).with_originating_plugin( + let action = Action::EditFile { + payload: OpenFilePayload::new(path, file_to_open.line_number, cwd).with_originating_plugin( OriginatingPlugin::new(env.plugin_id, env.client_id, context), ), - None, + direction: None, floating, in_place, start_suppressed, - None, - ); + coordinates: None, + }; apply_action!(action, error_msg, env); } @@ -828,7 +828,11 @@ fn open_terminal(env: &PluginEnv, cwd: PathBuf) { TerminalAction::RunCommand(run_command) => Some(run_command.into()), _ => None, }; - let action = Action::NewTiledPane(None, run_command_action, None); + let action = Action::NewTiledPane { + direction: None, + command: run_command_action, + pane_name: None, + }; apply_action!(action, error_msg, env); } @@ -871,7 +875,11 @@ fn open_terminal_floating( TerminalAction::RunCommand(run_command) => Some(run_command.into()), _ => None, }; - let action = Action::NewFloatingPane(run_command_action, None, floating_pane_coordinates); + let action = Action::NewFloatingPane { + command: run_command_action, + pane_name: None, + coordinates: floating_pane_coordinates, + }; apply_action!(action, error_msg, env); } @@ -914,7 +922,10 @@ fn open_terminal_in_place(env: &PluginEnv, cwd: PathBuf) { TerminalAction::RunCommand(run_command) => Some(run_command.into()), _ => None, }; - let action = Action::NewInPlacePane(run_command_action, None); + let action = Action::NewInPlacePane { + command: run_command_action, + pane_name: None, + }; apply_action!(action, error_msg, env); } @@ -1010,7 +1021,11 @@ fn open_command_pane( )), use_terminal_title, }; - let action = Action::NewTiledPane(direction, Some(run_command_action), name); + let action = Action::NewTiledPane { + direction, + command: Some(run_command_action), + pane_name: name, + }; apply_action!(action, error_msg, env); } @@ -1080,7 +1095,11 @@ fn open_command_pane_floating( )), use_terminal_title, }; - let action = Action::NewFloatingPane(Some(run_command_action), name, floating_pane_coordinates); + let action = Action::NewFloatingPane { + command: Some(run_command_action), + pane_name: name, + coordinates: floating_pane_coordinates, + }; apply_action!(action, error_msg, env); } @@ -1150,7 +1169,10 @@ fn open_command_pane_in_place( )), use_terminal_title, }; - let action = Action::NewInPlacePane(Some(run_command_action), name); + let action = Action::NewInPlacePane { + command: Some(run_command_action), + pane_name: name, + }; apply_action!(action, error_msg, env); } @@ -1363,7 +1385,10 @@ fn hide_pane_with_id(env: &PluginEnv, pane_id: PaneId) -> Result<()> { } fn show_self(env: &PluginEnv, should_float_if_hidden: bool) { - let action = Action::FocusPluginPaneWithId(env.plugin_id, should_float_if_hidden); + let action = Action::FocusPluginPaneWithId { + pane_id: env.plugin_id, + should_float_if_hidden, + }; let error_msg = || format!("Failed to show self for plugin"); apply_action!(action, error_msg, env); } @@ -1425,7 +1450,7 @@ fn rebind_keys( } fn switch_to_mode(env: &PluginEnv, input_mode: InputMode) { - let action = Action::SwitchToMode(input_mode); + let action = Action::SwitchToMode { input_mode }; let error_msg = || format!("failed to switch to mode in plugin {}", env.name()); apply_action!(action, error_msg, env); } @@ -1458,15 +1483,15 @@ fn apply_layout(env: &PluginEnv, layout: Layout) { if tabs.is_empty() { let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone()); let swap_floating_layouts = Some(layout.swap_floating_layouts.clone()); - let action = Action::NewTab( - layout.template.as_ref().map(|t| t.0.clone()), - layout.template.map(|t| t.1).unwrap_or_default(), + let action = Action::NewTab { + tiled_layout: layout.template.as_ref().map(|t| t.0.clone()), + floating_layouts: layout.template.map(|t| t.1).unwrap_or_default(), swap_tiled_layouts, swap_floating_layouts, - None, - true, + tab_name: None, + should_change_focus_to_new_tab: true, cwd, - ); + }; tabs_to_open.push(action); } else { let focused_tab_index = layout.focused_tab_index().unwrap_or(0); @@ -1476,15 +1501,15 @@ fn apply_layout(env: &PluginEnv, layout: Layout) { let should_focus_tab = tab_index == focused_tab_index; let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone()); let swap_floating_layouts = Some(layout.swap_floating_layouts.clone()); - let action = Action::NewTab( - Some(tiled_pane_layout), - floating_pane_layout, + let action = Action::NewTab { + tiled_layout: Some(tiled_pane_layout), + floating_layouts: floating_pane_layout, swap_tiled_layouts, swap_floating_layouts, tab_name, - should_focus_tab, - cwd.clone(), - ); + should_change_focus_to_new_tab: should_focus_tab, + cwd: cwd.clone(), + }; tabs_to_open.push(action); } } @@ -1496,7 +1521,15 @@ fn apply_layout(env: &PluginEnv, layout: Layout) { fn new_tab(env: &PluginEnv, name: Option<String>, cwd: Option<String>) { let cwd = cwd.map(|c| PathBuf::from(c)); - let action = Action::NewTab(None, vec![], None, None, name, true, cwd); + let action = Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: name, + should_change_focus_to_new_tab: true, + cwd, + }; let error_msg = || format!("Failed to open new tab"); apply_action!(action, error_msg, env); } @@ -1515,13 +1548,19 @@ fn go_to_previous_tab(env: &PluginEnv) { fn resize(env: &PluginEnv, resize: Resize) { let error_msg = || format!("failed to resize in plugin {}", env.name()); - let action = Action::Resize(resize, None); + let action = Action::Resize { + resize, + direction: None, + }; apply_action!(action, error_msg, env); } fn resize_with_direction(env: &PluginEnv, resize: ResizeStrategy) { let error_msg = || format!("failed to resize in plugin {}", env.name()); - let action = Action::Resize(resize.resize, resize.direction); + let action = Action::Resize { + resize: resize.resize, + direction: resize.direction, + }; apply_action!(action, error_msg, env); } @@ -1539,13 +1578,13 @@ fn focus_previous_pane(env: &PluginEnv) { fn move_focus(env: &PluginEnv, direction: Direction) { let error_msg = || format!("failed to move focus in plugin {}", env.name()); - let action = Action::MoveFocus(direction); + let action = Action::MoveFocus { direction }; apply_action!(action, error_msg, env); } fn move_focus_or_tab(env: &PluginEnv, direction: Direction) { let error_msg = || format!("failed to move focus in plugin {}", env.name()); - let action = Action::MoveFocusOrTab(direction); + let action = Action::MoveFocusOrTab { direction }; apply_action!(action, error_msg, env); } @@ -1652,13 +1691,19 @@ fn edit_scrollback(env: &PluginEnv) { fn write(env: &PluginEnv, bytes: Vec<u8>) { let error_msg = || format!("failed to write in plugin {}", env.name()); - let action = Action::Write(None, bytes, false); + let action = Action::Write { + key_with_modifier: None, + bytes, + is_kitty_keyboard_protocol: false, + }; apply_action!(action, error_msg, env); } fn write_chars(env: &PluginEnv, chars_to_write: String) { let error_msg = || format!("failed to write in plugin {}", env.name()); - let action = Action::WriteChars(chars_to_write); + let action = Action::WriteChars { + chars: chars_to_write, + }; apply_action!(action, error_msg, env); } @@ -1670,13 +1715,15 @@ fn toggle_tab(env: &PluginEnv) { fn move_pane(env: &PluginEnv) { let error_msg = || format!("failed to move pane in plugin {}", env.name()); - let action = Action::MovePane(None); + let action = Action::MovePane { direction: None }; apply_action!(action, error_msg, env); } fn move_pane_with_direction(env: &PluginEnv, direction: Direction) { let error_msg = || format!("failed to move pane in plugin {}", env.name()); - let action = Action::MovePane(Some(direction)); + let action = Action::MovePane { + direction: Some(direction), + }; apply_action!(action, error_msg, env); } @@ -1795,20 +1842,28 @@ fn next_swap_layout(env: &PluginEnv) { fn go_to_tab_name(env: &PluginEnv, tab_name: String) { let error_msg = || format!("failed to change tab in plugin {}", env.name()); let create = false; - let action = Action::GoToTabName(tab_name, create); + let action = Action::GoToTabName { + name: tab_name, + create, + }; apply_action!(action, error_msg, env); } fn focus_or_create_tab(env: &PluginEnv, tab_name: String) { let error_msg = || format!("failed to change or create tab in plugin {}", env.name()); let create = true; - let action = Action::GoToTabName(tab_name, create); + let action = Action::GoToTabName { + name: tab_name, + create, + }; apply_action!(action, error_msg, env); } fn go_to_tab(env: &PluginEnv, tab_index: u32) { let error_msg = || format!("failed to change tab focus in plugin {}", env.name()); - let action = Action::GoToTab(tab_index + 1); + let action = Action::GoToTab { + index: tab_index + 1, + }; apply_action!(action, error_msg, env); } @@ -1817,14 +1872,18 @@ fn start_or_reload_plugin(env: &PluginEnv, url: &str) -> Result<()> { let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); let run_plugin_or_alias = RunPluginOrAlias::from_url(url, &None, None, Some(cwd)) .map_err(|e| anyhow!("Failed to parse plugin location: {}", e))?; - let action = Action::StartOrReloadPlugin(run_plugin_or_alias); + let action = Action::StartOrReloadPlugin { + plugin: run_plugin_or_alias, + }; apply_action!(action, error_msg, env); Ok(()) } fn close_terminal_pane(env: &PluginEnv, terminal_pane_id: u32) { let error_msg = || format!("failed to change tab focus in plugin {}", env.name()); - let action = Action::CloseTerminalPane(terminal_pane_id); + let action = Action::CloseTerminalPane { + pane_id: terminal_pane_id, + }; apply_action!(action, error_msg, env); env.senders .send_to_pty(PtyInstruction::ClosePane(PaneId::Terminal( @@ -1835,7 +1894,9 @@ fn close_terminal_pane(env: &PluginEnv, terminal_pane_id: u32) { fn close_plugin_pane(env: &PluginEnv, plugin_pane_id: u32) { let error_msg = || format!("failed to change tab focus in plugin {}", env.name()); - let action = Action::ClosePluginPane(plugin_pane_id); + let action = Action::ClosePluginPane { + pane_id: plugin_pane_id, + }; apply_action!(action, error_msg, env); env.senders .send_to_plugin(PluginInstruction::Unload(plugin_pane_id)) @@ -1843,33 +1904,47 @@ fn close_plugin_pane(env: &PluginEnv, plugin_pane_id: u32) { } fn focus_terminal_pane(env: &PluginEnv, terminal_pane_id: u32, should_float_if_hidden: bool) { - let action = Action::FocusTerminalPaneWithId(terminal_pane_id, should_float_if_hidden); + let action = Action::FocusTerminalPaneWithId { + pane_id: terminal_pane_id, + should_float_if_hidden, + }; let error_msg = || format!("Failed to focus terminal pane"); apply_action!(action, error_msg, env); } fn focus_plugin_pane(env: &PluginEnv, plugin_pane_id: u32, should_float_if_hidden: bool) { - let action = Action::FocusPluginPaneWithId(plugin_pane_id, should_float_if_hidden); + let action = Action::FocusPluginPaneWithId { + pane_id: plugin_pane_id, + should_float_if_hidden, + }; let error_msg = || format!("Failed to focus plugin pane"); apply_action!(action, error_msg, env); } fn rename_terminal_pane(env: &PluginEnv, terminal_pane_id: u32, new_name: &str) { let error_msg = || format!("Failed to rename terminal pane"); - let rename_pane_action = - Action::RenameTerminalPane(terminal_pane_id, new_name.as_bytes().to_vec()); + let rename_pane_action = Action::RenameTerminalPane { + pane_id: terminal_pane_id, + name: new_name.as_bytes().to_vec(), + }; apply_action!(rename_pane_action, error_msg, env); } fn rename_plugin_pane(env: &PluginEnv, plugin_pane_id: u32, new_name: &str) { let error_msg = || format!("Failed to rename plugin pane"); - let rename_pane_action = Action::RenamePluginPane(plugin_pane_id, new_name.as_bytes().to_vec()); + let rename_pane_action = Action::RenamePluginPane { + pane_id: plugin_pane_id, + name: new_name.as_bytes().to_vec(), + }; apply_action!(rename_pane_action, error_msg, env); } fn rename_tab(env: &PluginEnv, tab_index: u32, new_name: &str) { let error_msg = || format!("Failed to rename tab"); - let rename_tab_action = Action::RenameTab(tab_index, new_name.as_bytes().to_vec()); + let rename_tab_action = Action::RenameTab { + tab_index, + name: new_name.as_bytes().to_vec(), + }; apply_action!(rename_tab_action, error_msg, env); } @@ -1878,7 +1953,9 @@ fn rename_session(env: &PluginEnv, new_session_name: String) { if new_session_name.contains('/') { log::error!("Session names cannot contain \'/\'"); } else { - let action = Action::RenameSession(new_session_name); + let action = Action::RenameSession { + name: new_session_name, + }; apply_action!(action, error_msg, env); } } @@ -1895,7 +1972,8 @@ fn kill_sessions(session_names: Vec<String>) { let path = &*ZELLIJ_SOCK_DIR.join(&session_name); match LocalSocketStream::connect(path) { Ok(stream) => { - let _ = IpcSenderWithContext::new(stream).send(ClientToServerMsg::KillSession); + let _ = IpcSenderWithContext::<ClientToServerMsg>::new(stream) + .send_client_msg(ClientToServerMsg::KillSession); }, Err(e) => { log::error!("Failed to kill session {}: {:?}", session_name, e); diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index 65f4d1dd..db721e1f 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -65,7 +65,11 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::ToggleTab(client_id)) .with_context(err_context)?; }, - Action::Write(key_with_modifier, raw_bytes, is_kitty_keyboard_protocol) => { + Action::Write { + key_with_modifier, + bytes: raw_bytes, + is_kitty_keyboard_protocol, + } => { senders .send_to_screen(ScreenInstruction::ClearScroll(client_id)) .with_context(err_context)?; @@ -78,26 +82,26 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::WriteChars(val) => { + Action::WriteChars { chars } => { senders .send_to_screen(ScreenInstruction::ClearScroll(client_id)) .with_context(err_context)?; - let val = val.into_bytes(); + let chars = chars.into_bytes(); senders .send_to_screen(ScreenInstruction::WriteCharacter( - None, val, false, client_id, + None, chars, false, client_id, )) .with_context(err_context)?; }, - Action::SwitchToMode(mode) => { + Action::SwitchToMode { input_mode } => { let attrs = &client_attributes; senders - .send_to_server(ServerInstruction::ChangeMode(client_id, mode)) + .send_to_server(ServerInstruction::ChangeMode(client_id, input_mode)) .with_context(err_context)?; senders .send_to_screen(ScreenInstruction::ChangeMode( get_mode_info( - mode, + input_mode, attrs, capabilities, &client_keybinds, @@ -110,7 +114,7 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::Render) .with_context(err_context)?; }, - Action::Resize(resize, direction) => { + Action::Resize { resize, direction } => { let screen_instr = ScreenInstruction::Resize(client_id, ResizeStrategy::new(resize, direction)); senders @@ -132,7 +136,7 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::FocusPreviousPane(client_id)) .with_context(err_context)?; }, - Action::MoveFocus(direction) => { + Action::MoveFocus { direction } => { let screen_instr = match direction { Direction::Left => ScreenInstruction::MoveFocusLeft(client_id), Direction::Right => ScreenInstruction::MoveFocusRight(client_id), @@ -143,7 +147,7 @@ pub(crate) fn route_action( .send_to_screen(screen_instr) .with_context(err_context)?; }, - Action::MoveFocusOrTab(direction) => { + Action::MoveFocusOrTab { direction } => { let screen_instr = match direction { Direction::Left => ScreenInstruction::MoveFocusLeftOrPreviousTab(client_id), Direction::Right => ScreenInstruction::MoveFocusRightOrNextTab(client_id), @@ -154,7 +158,7 @@ pub(crate) fn route_action( .send_to_screen(screen_instr) .with_context(err_context)?; }, - Action::MovePane(direction) => { + Action::MovePane { direction } => { let screen_instr = match direction { Some(Direction::Left) => ScreenInstruction::MovePaneLeft(client_id), Some(Direction::Right) => ScreenInstruction::MovePaneRight(client_id), @@ -176,9 +180,16 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::ClearScreen(client_id)) .with_context(err_context)?; }, - Action::DumpScreen(val, full) => { + Action::DumpScreen { + file_path, + include_scrollback, + } => { senders - .send_to_screen(ScreenInstruction::DumpScreen(val, client_id, full)) + .send_to_screen(ScreenInstruction::DumpScreen( + file_path, + client_id, + include_scrollback, + )) .with_context(err_context)?; }, Action::DumpLayout => { @@ -200,9 +211,9 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::ScrollUp(client_id)) .with_context(err_context)?; }, - Action::ScrollUpAt(point) => { + Action::ScrollUpAt { position } => { senders - .send_to_screen(ScreenInstruction::ScrollUpAt(point, client_id)) + .send_to_screen(ScreenInstruction::ScrollUpAt(position, client_id)) .with_context(err_context)?; }, Action::ScrollDown => { @@ -210,9 +221,9 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::ScrollDown(client_id)) .with_context(err_context)?; }, - Action::ScrollDownAt(point) => { + Action::ScrollDownAt { position } => { senders - .send_to_screen(ScreenInstruction::ScrollDownAt(point, client_id)) + .send_to_screen(ScreenInstruction::ScrollDownAt(position, client_id)) .with_context(err_context)?; }, Action::ScrollToBottom => { @@ -255,7 +266,11 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::TogglePaneFrames) .with_context(err_context)?; }, - Action::NewPane(direction, name, start_suppressed) => { + Action::NewPane { + direction, + pane_name, + start_suppressed, + } => { let shell = default_shell.clone(); let new_pane_placement = match direction { Some(direction) => NewPanePlacement::Tiled(Some(direction)), @@ -263,20 +278,20 @@ pub(crate) fn route_action( }; let _ = senders.send_to_pty(PtyInstruction::SpawnTerminal( shell, - name, + pane_name, new_pane_placement, start_suppressed, ClientTabIndexOrPaneId::ClientId(client_id), )); }, - Action::EditFile( - open_file_payload, - split_direction, - should_float, - should_open_in_place, + Action::EditFile { + payload: open_file_payload, + direction: split_direction, + floating: should_float, + in_place: should_open_in_place, start_suppressed, - floating_pane_coordinates, - ) => { + coordinates: floating_pane_coordinates, + } => { let title = format!("Editing: {}", open_file_payload.path.display()); let open_file = TerminalAction::OpenFile(open_file_payload); let pty_instr = if should_open_in_place { @@ -309,7 +324,7 @@ pub(crate) fn route_action( }; senders.send_to_pty(pty_instr).with_context(err_context)?; }, - Action::SwitchModeForAllClients(input_mode) => { + Action::SwitchModeForAllClients { input_mode } => { let attrs = &client_attributes; senders .send_to_plugin(PluginInstruction::Update(vec![( @@ -339,7 +354,11 @@ pub(crate) fn route_action( ))) .with_context(err_context)?; }, - Action::NewFloatingPane(run_command, name, floating_pane_coordinates) => { + Action::NewFloatingPane { + command: run_command, + pane_name: name, + coordinates: floating_pane_coordinates, + } => { let run_cmd = run_command .map(|cmd| TerminalAction::RunCommand(cmd.into())) .or_else(|| default_shell.clone()); @@ -353,7 +372,10 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::NewInPlacePane(run_command, name) => { + Action::NewInPlacePane { + command: run_command, + pane_name: name, + } => { let run_cmd = run_command .map(|cmd| TerminalAction::RunCommand(cmd.into())) .or_else(|| default_shell.clone()); @@ -380,7 +402,10 @@ pub(crate) fn route_action( }, } }, - Action::NewStackedPane(run_command, name) => { + Action::NewStackedPane { + command: run_command, + pane_name: name, + } => { let run_cmd = run_command .map(|cmd| TerminalAction::RunCommand(cmd.into())) .or_else(|| default_shell.clone()); @@ -409,7 +434,11 @@ pub(crate) fn route_action( }, } }, - Action::NewTiledPane(direction, run_command, name) => { + Action::NewTiledPane { + direction, + command: run_command, + pane_name: name, + } => { let run_cmd = run_command .map(|cmd| TerminalAction::RunCommand(cmd.into())) .or_else(|| default_shell.clone()); @@ -434,9 +463,9 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::PaneNameInput(c) => { + Action::PaneNameInput { input } => { senders - .send_to_screen(ScreenInstruction::UpdatePaneName(c, client_id)) + .send_to_screen(ScreenInstruction::UpdatePaneName(input, client_id)) .with_context(err_context)?; }, Action::UndoRenamePane => { @@ -444,7 +473,7 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::UndoRenamePane(client_id)) .with_context(err_context)?; }, - Action::Run(command) => { + Action::Run { command } => { let run_cmd = Some(TerminalAction::RunCommand(command.clone().into())); let _ = senders.send_to_pty(PtyInstruction::SpawnTerminal( run_cmd, @@ -459,15 +488,15 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::CloseFocusedPane(client_id)) .with_context(err_context)?; }, - Action::NewTab( - tab_layout, - floating_panes_layout, + Action::NewTab { + tiled_layout: tab_layout, + floating_layouts: floating_panes_layout, swap_tiled_layouts, swap_floating_layouts, tab_name, should_change_focus_to_new_tab, cwd, - ) => { + } => { let shell = default_shell.clone(); let swap_tiled_layouts = swap_tiled_layouts.unwrap_or_else(|| default_layout.swap_tiled_layouts.clone()); @@ -507,12 +536,12 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::CloseTab(client_id)) .with_context(err_context)?; }, - Action::GoToTab(i) => { + Action::GoToTab { index } => { senders - .send_to_screen(ScreenInstruction::GoToTab(i, Some(client_id))) + .send_to_screen(ScreenInstruction::GoToTab(index, Some(client_id))) .with_context(err_context)?; }, - Action::GoToTabName(name, create) => { + Action::GoToTabName { name, create } => { let shell = default_shell.clone(); let swap_tiled_layouts = default_layout.swap_tiled_layouts.clone(); let swap_floating_layouts = default_layout.swap_floating_layouts.clone(); @@ -526,9 +555,9 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::TabNameInput(c) => { + Action::TabNameInput { input } => { senders - .send_to_screen(ScreenInstruction::UpdateTabName(c, client_id)) + .send_to_screen(ScreenInstruction::UpdateTabName(input, client_id)) .with_context(err_context)?; }, Action::UndoRenameTab => { @@ -536,7 +565,7 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::UndoRenameTab(client_id)) .with_context(err_context)?; }, - Action::MoveTab(direction) => { + Action::MoveTab { direction } => { let screen_instr = match direction { Direction::Left => ScreenInstruction::MoveTabLeft(client_id), Direction::Right => ScreenInstruction::MoveTabRight(client_id), @@ -558,7 +587,7 @@ pub(crate) fn route_action( .with_context(err_context)?; should_break = true; }, - Action::MouseEvent(event) => { + Action::MouseEvent { event } => { senders .send_to_screen(ScreenInstruction::MouseEvent(event, client_id)) .with_context(err_context)?; @@ -579,7 +608,7 @@ pub(crate) fn route_action( .with_context(err_context)?; }, #[allow(clippy::single_match)] - Action::SkipConfirm(action) => match *action { + Action::SkipConfirm { action } => match *action { Action::Quit => { senders .send_to_server(ServerInstruction::ClientExit(client_id)) @@ -589,13 +618,13 @@ pub(crate) fn route_action( _ => {}, }, Action::NoOp => {}, - Action::SearchInput(c) => { + Action::SearchInput { input } => { senders - .send_to_screen(ScreenInstruction::UpdateSearch(c, client_id)) + .send_to_screen(ScreenInstruction::UpdateSearch(input, client_id)) .with_context(err_context)?; }, - Action::Search(d) => { - let instruction = match d { + Action::Search { direction } => { + let instruction = match direction { SearchDirection::Down => ScreenInstruction::SearchDown(client_id), SearchDirection::Up => ScreenInstruction::SearchUp(client_id), }; @@ -603,8 +632,8 @@ pub(crate) fn route_action( .send_to_screen(instruction) .with_context(err_context)?; }, - Action::SearchToggleOption(o) => { - let instruction = match o { + Action::SearchToggleOption { option } => { + let instruction = match option { SearchOption::CaseSensitivity => { ScreenInstruction::SearchToggleCaseSensitivity(client_id) }, @@ -631,20 +660,25 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::QueryTabNames(client_id)) .with_context(err_context)?; }, - Action::NewTiledPluginPane(run_plugin, name, skip_cache, cwd) => { + Action::NewTiledPluginPane { + plugin: run_plugin, + pane_name: name, + skip_cache, + cwd, + } => { senders .send_to_screen(ScreenInstruction::NewTiledPluginPane( run_plugin, name, skip_cache, cwd, client_id, )) .with_context(err_context)?; }, - Action::NewFloatingPluginPane( - run_plugin, - name, + Action::NewFloatingPluginPane { + plugin: run_plugin, + pane_name: name, skip_cache, cwd, - floating_pane_coordinates, - ) => { + coordinates: floating_pane_coordinates, + } => { senders .send_to_screen(ScreenInstruction::NewFloatingPluginPane( run_plugin, @@ -656,7 +690,11 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::NewInPlacePluginPane(run_plugin, name, skip_cache) => { + Action::NewInPlacePluginPane { + plugin: run_plugin, + pane_name: name, + skip_cache, + } => { if let Some(pane_id) = pane_id { senders .send_to_screen(ScreenInstruction::NewInPlacePluginPane( @@ -667,18 +705,18 @@ pub(crate) fn route_action( log::error!("Must have pane_id in order to open in place pane"); } }, - Action::StartOrReloadPlugin(run_plugin) => { + Action::StartOrReloadPlugin { plugin: run_plugin } => { senders .send_to_screen(ScreenInstruction::StartOrReloadPluginPane(run_plugin, None)) .with_context(err_context)?; }, - Action::LaunchOrFocusPlugin( - run_plugin, + Action::LaunchOrFocusPlugin { + plugin: run_plugin, should_float, move_to_focused_tab, should_open_in_place, skip_cache, - ) => { + } => { senders .send_to_screen(ScreenInstruction::LaunchOrFocusPlugin( run_plugin, @@ -691,7 +729,13 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::LaunchPlugin(run_plugin, should_float, should_open_in_place, skip_cache, cwd) => { + Action::LaunchPlugin { + plugin: run_plugin, + should_float, + should_open_in_place, + skip_cache, + cwd, + } => { senders .send_to_screen(ScreenInstruction::LaunchPlugin( run_plugin, @@ -704,7 +748,9 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::CloseTerminalPane(terminal_pane_id) => { + Action::CloseTerminalPane { + pane_id: terminal_pane_id, + } => { senders .send_to_screen(ScreenInstruction::ClosePane( PaneId::Terminal(terminal_pane_id), @@ -713,7 +759,9 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::ClosePluginPane(plugin_pane_id) => { + Action::ClosePluginPane { + pane_id: plugin_pane_id, + } => { senders .send_to_screen(ScreenInstruction::ClosePane( PaneId::Plugin(plugin_pane_id), @@ -722,7 +770,10 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::FocusTerminalPaneWithId(pane_id, should_float_if_hidden) => { + Action::FocusTerminalPaneWithId { + pane_id, + should_float_if_hidden, + } => { senders .send_to_screen(ScreenInstruction::FocusPaneWithId( PaneId::Terminal(pane_id), @@ -731,7 +782,10 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::FocusPluginPaneWithId(pane_id, should_float_if_hidden) => { + Action::FocusPluginPaneWithId { + pane_id, + should_float_if_hidden, + } => { senders .send_to_screen(ScreenInstruction::FocusPaneWithId( PaneId::Plugin(pane_id), @@ -740,7 +794,10 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::RenameTerminalPane(pane_id, name_bytes) => { + Action::RenameTerminalPane { + pane_id, + name: name_bytes, + } => { senders .send_to_screen(ScreenInstruction::RenamePane( PaneId::Terminal(pane_id), @@ -748,7 +805,10 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::RenamePluginPane(pane_id, name_bytes) => { + Action::RenamePluginPane { + pane_id, + name: name_bytes, + } => { senders .send_to_screen(ScreenInstruction::RenamePane( PaneId::Plugin(pane_id), @@ -756,7 +816,10 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::RenameTab(tab_position, name_bytes) => { + Action::RenameTab { + tab_index: tab_position, + name: name_bytes, + } => { senders .send_to_screen(ScreenInstruction::RenameTab( tab_position as usize, @@ -783,7 +846,7 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::BreakPaneLeft(client_id)) .with_context(err_context)?; }, - Action::RenameSession(name) => { + Action::RenameSession { name } => { senders .send_to_screen(ScreenInstruction::RenameSession(name, client_id)) .with_context(err_context)?; @@ -900,7 +963,9 @@ pub(crate) fn route_action( .send_to_screen(ScreenInstruction::TogglePanePinned(client_id)) .with_context(err_context)?; }, - Action::StackPanes(pane_ids_to_stack) => { + Action::StackPanes { + pane_ids: pane_ids_to_stack, + } => { senders .send_to_screen(ScreenInstruction::StackPanes( pane_ids_to_stack.iter().map(|p| PaneId::from(*p)).collect(), @@ -908,7 +973,10 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::ChangeFloatingPaneCoordinates(pane_id, coordinates) => { + Action::ChangeFloatingPaneCoordinates { + pane_id, + coordinates, + } => { senders .send_to_screen(ScreenInstruction::ChangeFloatingPanesCoordinates(vec![( pane_id.into(), @@ -957,9 +1025,11 @@ pub(crate) fn route_thread_main( let mut retry_queue = VecDeque::new(); let err_context = || format!("failed to handle instruction for client {client_id}"); let mut seen_cli_pipes = HashSet::new(); + let mut consecutive_unknown_messages_received = 0; 'route_loop: loop { - match receiver.recv() { + match receiver.recv_client_msg() { Some((instruction, err_ctx)) => { + consecutive_unknown_messages_received = 0; err_ctx.update_thread_ctx(); let mut handle_instruction = |instruction: ClientToServerMsg, mut retry_queue: Option< @@ -970,7 +1040,11 @@ pub(crate) fn route_thread_main( let rlocked_sessions = session_data.read().to_anyhow().with_context(err_context)?; match instruction { - ClientToServerMsg::Key(key, raw_bytes, is_kitty_keyboard_protocol) => { + ClientToServerMsg::Key { + key, + raw_bytes, + is_kitty_keyboard_protocol, + } => { if let Some(rlocked_sessions) = rlocked_sessions.as_ref() { match rlocked_sessions.get_client_keybinds_and_mode(&client_id) { Some((keybinds, input_mode, default_input_mode)) => { @@ -1012,7 +1086,11 @@ pub(crate) fn route_thread_main( } } }, - ClientToServerMsg::Action(action, maybe_pane_id, maybe_client_id) => { + ClientToServerMsg::Action { + action, + terminal_id: maybe_pane_id, + client_id: maybe_client_id, + } => { let client_id = maybe_client_id.unwrap_or(client_id); if let Some(rlocked_sessions) = rlocked_sessions.as_ref() { if route_action( @@ -1041,7 +1119,7 @@ pub(crate) fn route_thread_main( } } }, - ClientToServerMsg::TerminalResize(new_size) => { + ClientToServerMsg::TerminalResize { new_size } => { session_state .write() .to_anyhow() @@ -1064,7 +1142,7 @@ pub(crate) fn route_thread_main( }) .with_context(err_context)?; }, - ClientToServerMsg::TerminalPixelDimensions(pixel_dimensions) => { + ClientToServerMsg::TerminalPixelDimensions { pixel_dimensions } => { send_to_screen_or_retry_queue!( rlocked_sessions, ScreenInstruction::TerminalPixelDimensions(pixel_dimensions), @@ -1073,7 +1151,9 @@ pub(crate) fn route_thread_main( ) .with_context(err_context)?; }, - ClientToServerMsg::BackgroundColor(ref background_color_instruction) => { + ClientToServerMsg::BackgroundColor { + color: ref background_color_instruction, + } => { send_to_screen_or_retry_queue!( rlocked_sessions, ScreenInstruction::TerminalBackgroundColor( @@ -1084,7 +1164,9 @@ pub(crate) fn route_thread_main( ) .with_context(err_context)?; }, - ClientToServerMsg::ForegroundColor(ref foreground_color_instruction) => { + ClientToServerMsg::ForegroundColor { + color: ref foreground_color_instruction, + } => { send_to_screen_or_retry_queue!( rlocked_sessions, ScreenInstruction::TerminalForegroundColor( @@ -1095,16 +1177,26 @@ pub(crate) fn route_thread_main( ) .with_context(err_context)?; }, - ClientToServerMsg::ColorRegisters(ref color_registers) => { + ClientToServerMsg::ColorRegisters { + ref color_registers, + } => { send_to_screen_or_retry_queue!( rlocked_sessions, - ScreenInstruction::TerminalColorRegisters(color_registers.clone()), + ScreenInstruction::TerminalColorRegisters( + color_registers + .iter() + .map(|c| (c.index, c.color.clone())) + .collect() + ), instruction, retry_queue ) .with_context(err_context)?; }, - ClientToServerMsg::FirstClientConnected(cli_assets, is_web_client) => { + ClientToServerMsg::FirstClientConnected { + cli_assets, + is_web_client, + } => { let new_client_instruction = ServerInstruction::FirstClientConnected( cli_assets, is_web_client, @@ -1114,12 +1206,12 @@ pub(crate) fn route_thread_main( .send(new_client_instruction) .with_context(err_context)?; }, - ClientToServerMsg::AttachClient( + ClientToServerMsg::AttachClient { cli_assets, tab_position_to_focus, - pane_id_to_focus, + pane_to_focus: pane_id_to_focus, is_web_client, - ) => { + } => { let allow_web_connections = rlocked_sessions .as_ref() .map(|rlocked_sessions| { @@ -1131,7 +1223,7 @@ pub(crate) fn route_thread_main( let attach_client_instruction = ServerInstruction::AttachClient( cli_assets, tab_position_to_focus, - pane_id_to_focus, + pane_id_to_focus.map(|p| (p.pane_id, p.is_plugin)), is_web_client, client_id, ); @@ -1163,14 +1255,14 @@ pub(crate) fn route_thread_main( let _ = to_server.send(ServerInstruction::ConnStatus(client_id)); should_break = true; }, - ClientToServerMsg::DetachSession(client_id) => { - let _ = to_server.send(ServerInstruction::DetachSession(client_id)); + ClientToServerMsg::DetachSession { client_ids } => { + let _ = to_server.send(ServerInstruction::DetachSession(client_ids)); should_break = true; }, - ClientToServerMsg::WebServerStarted(base_url) => { + ClientToServerMsg::WebServerStarted { base_url } => { let _ = to_server.send(ServerInstruction::WebServerStarted(base_url)); }, - ClientToServerMsg::FailedToStartWebServer(error) => { + ClientToServerMsg::FailedToStartWebServer { error } => { let _ = to_server.send(ServerInstruction::FailedToStartWebServer(error)); }, @@ -1195,15 +1287,19 @@ pub(crate) fn route_thread_main( } }, None => { - log::error!("Received empty message from client, logging client out."); - let _ = os_input.send_to_client( - client_id, - ServerToClientMsg::Exit(ExitReason::Error( - "Received empty message".to_string(), - )), - ); - let _ = to_server.send(ServerInstruction::RemoveClient(client_id)); - break 'route_loop; + consecutive_unknown_messages_received += 1; + log::error!("Received unknown message from client."); + if consecutive_unknown_messages_received >= 1000 { + log::error!("Client sent over 1000 consecutive unknown messages, this is probably an infinite loop, logging client out"); + let _ = os_input.send_to_client( + client_id, + ServerToClientMsg::Exit { + exit_reason: ExitReason::Error("Received empty message".to_string()), + }, + ); + let _ = to_server.send(ServerInstruction::RemoveClient(client_id)); + break 'route_loop; + } }, } } diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 18a47d87..e90e2cbd 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -5141,7 +5141,9 @@ pub(crate) fn screen_thread_main( if let Some(os_input) = &mut screen.bus.os_input { let _ = os_input.send_to_client( client_id, - ServerToClientMsg::LogError(vec![error_text.to_owned()]), + ServerToClientMsg::LogError { + lines: vec![error_text.to_owned()], + }, ); } } else if screen.resurrectable_sessions.contains_key(&name) { @@ -5151,7 +5153,9 @@ pub(crate) fn screen_thread_main( if let Some(os_input) = &mut screen.bus.os_input { let _ = os_input.send_to_client( client_id, - ServerToClientMsg::LogError(vec![error_text.to_owned()]), + ServerToClientMsg::LogError { + lines: vec![error_text.to_owned()], + }, ); } } else { @@ -5201,7 +5205,7 @@ pub(crate) fn screen_thread_main( if let Some(os_input) = &mut screen.bus.os_input { let _ = os_input.send_to_client( client_id, - ServerToClientMsg::RenamedSession(name.clone()), + ServerToClientMsg::RenamedSession { name: name.clone() }, ); } } diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml index 34c8a1fb..69888d60 100644 --- a/zellij-utils/Cargo.toml +++ b/zellij-utils/Cargo.toml @@ -27,7 +27,6 @@ miette = { workspace = true } nix = { workspace = true } percent-encoding = { version = "2.1.0", default-features = false, features = ["std"] } prost = { workspace = true } -rmp-serde = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } shellexpand = { version = "3.0.0", default-features = false, features = ["base-0", "tilde"] } diff --git a/zellij-utils/assets/prost_ipc/client_server_contract.rs b/zellij-utils/assets/prost_ipc/client_server_contract.rs new file mode 100644 index 00000000..e0116915 --- /dev/null +++ b/zellij-utils/assets/prost_ipc/client_server_contract.rs @@ -0,0 +1,2428 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Size { + #[prost(uint32, tag="1")] + pub cols: u32, + #[prost(uint32, tag="2")] + pub rows: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PixelDimensions { + #[prost(message, optional, tag="1")] + pub text_area_size: ::core::option::Option<SizeInPixels>, + #[prost(message, optional, tag="2")] + pub character_cell_size: ::core::option::Option<SizeInPixels>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SizeInPixels { + #[prost(uint32, tag="1")] + pub width: u32, + #[prost(uint32, tag="2")] + pub height: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PaneReference { + #[prost(uint32, tag="1")] + pub pane_id: u32, + #[prost(bool, tag="2")] + pub is_plugin: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ColorRegister { + #[prost(uint32, tag="1")] + pub index: u32, + #[prost(string, tag="2")] + pub color: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KeyWithModifier { + #[prost(enumeration="BareKey", tag="1")] + pub bare_key: i32, + #[prost(enumeration="KeyModifier", repeated, tag="2")] + pub key_modifiers: ::prost::alloc::vec::Vec<i32>, + /// Only set when bare_key is CHAR + #[prost(string, optional, tag="3")] + pub character: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CharKey { + #[prost(string, tag="1")] + pub character: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FunctionKey { + #[prost(uint32, tag="1")] + pub function_number: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Style { + #[prost(message, optional, tag="1")] + pub colors: ::core::option::Option<Styling>, + #[prost(bool, tag="2")] + pub rounded_corners: bool, + #[prost(bool, tag="3")] + pub hide_session_name: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Styling { + #[prost(message, optional, tag="1")] + pub base: ::core::option::Option<PaletteColor>, + #[prost(message, optional, tag="2")] + pub background: ::core::option::Option<PaletteColor>, + #[prost(message, optional, tag="3")] + pub emphasis_0: ::core::option::Option<PaletteColor>, + #[prost(message, optional, tag="4")] + pub emphasis_1: ::core::option::Option<PaletteColor>, + #[prost(message, optional, tag="5")] + pub emphasis_2: ::core::option::Option<PaletteColor>, + #[prost(message, optional, tag="6")] + pub emphasis_3: ::core::option::Option<PaletteColor>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PaletteColor { + #[prost(oneof="palette_color::ColorType", tags="1, 2, 3")] + pub color_type: ::core::option::Option<palette_color::ColorType>, +} +/// Nested message and enum types in `PaletteColor`. +pub mod palette_color { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum ColorType { + #[prost(message, tag="1")] + Rgb(super::RgbColor), + #[prost(uint32, tag="2")] + EightBit(u32), + #[prost(enumeration="super::AnsiCode", tag="3")] + Ansi(i32), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RgbColor { + #[prost(uint32, tag="1")] + pub r: u32, + #[prost(uint32, tag="2")] + pub g: u32, + #[prost(uint32, tag="3")] + pub b: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Action { + #[prost(oneof="action::ActionType", tags="1, 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, 51, 52, 53, 54, 55, 56, 57, 58, 59, 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")] + pub action_type: ::core::option::Option<action::ActionType>, +} +/// Nested message and enum types in `Action`. +pub mod action { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum ActionType { + #[prost(message, tag="1")] + Quit(super::QuitAction), + #[prost(message, tag="2")] + Write(super::WriteAction), + #[prost(message, tag="3")] + WriteChars(super::WriteCharsAction), + #[prost(message, tag="4")] + SwitchToMode(super::SwitchToModeAction), + #[prost(message, tag="5")] + SwitchModeForAllClients(super::SwitchModeForAllClientsAction), + #[prost(message, tag="6")] + Resize(super::ResizeAction), + #[prost(message, tag="7")] + FocusNextPane(super::FocusNextPaneAction), + #[prost(message, tag="8")] + FocusPreviousPane(super::FocusPreviousPaneAction), + #[prost(message, tag="9")] + SwitchFocus(super::SwitchFocusAction), + #[prost(message, tag="10")] + MoveFocus(super::MoveFocusAction), + #[prost(message, tag="11")] + MoveFocusOrTab(super::MoveFocusOrTabAction), + #[prost(message, tag="12")] + MovePane(super::MovePaneAction), + #[prost(message, tag="13")] + MovePaneBackwards(super::MovePaneBackwardsAction), + #[prost(message, tag="14")] + ClearScreen(super::ClearScreenAction), + #[prost(message, tag="15")] + DumpScreen(super::DumpScreenAction), + #[prost(message, tag="16")] + DumpLayout(super::DumpLayoutAction), + #[prost(message, tag="17")] + EditScrollback(super::EditScrollbackAction), + #[prost(message, tag="18")] + ScrollUp(super::ScrollUpAction), + #[prost(message, tag="19")] + ScrollUpAt(super::ScrollUpAtAction), + #[prost(message, tag="20")] + ScrollDown(super::ScrollDownAction), + #[prost(message, tag="21")] + ScrollDownAt(super::ScrollDownAtAction), + #[prost(message, tag="22")] + ScrollToBottom(super::ScrollToBottomAction), + #[prost(message, tag="23")] + ScrollToTop(super::ScrollToTopAction), + #[prost(message, tag="24")] + PageScrollUp(super::PageScrollUpAction), + #[prost(message, tag="25")] + PageScrollDown(super::PageScrollDownAction), + #[prost(message, tag="26")] + HalfPageScrollUp(super::HalfPageScrollUpAction), + #[prost(message, tag="27")] + HalfPageScrollDown(super::HalfPageScrollDownAction), + #[prost(message, tag="28")] + ToggleFocusFullscreen(super::ToggleFocusFullscreenAction), + #[prost(message, tag="29")] + TogglePaneFrames(super::TogglePaneFramesAction), + #[prost(message, tag="30")] + ToggleActiveSyncTab(super::ToggleActiveSyncTabAction), + #[prost(message, tag="31")] + NewPane(super::NewPaneAction), + #[prost(message, tag="32")] + EditFile(super::EditFileAction), + #[prost(message, tag="33")] + NewFloatingPane(super::NewFloatingPaneAction), + #[prost(message, tag="34")] + NewTiledPane(super::NewTiledPaneAction), + #[prost(message, tag="35")] + NewInPlacePane(super::NewInPlacePaneAction), + #[prost(message, tag="36")] + NewStackedPane(super::NewStackedPaneAction), + #[prost(message, tag="37")] + TogglePaneEmbedOrFloating(super::TogglePaneEmbedOrFloatingAction), + #[prost(message, tag="38")] + ToggleFloatingPanes(super::ToggleFloatingPanesAction), + #[prost(message, tag="39")] + CloseFocus(super::CloseFocusAction), + #[prost(message, tag="40")] + PaneNameInput(super::PaneNameInputAction), + #[prost(message, tag="41")] + UndoRenamePane(super::UndoRenamePaneAction), + #[prost(message, tag="42")] + NewTab(super::NewTabAction), + #[prost(message, tag="43")] + NoOp(super::NoOpAction), + #[prost(message, tag="44")] + GoToNextTab(super::GoToNextTabAction), + #[prost(message, tag="45")] + GoToPreviousTab(super::GoToPreviousTabAction), + #[prost(message, tag="46")] + CloseTab(super::CloseTabAction), + #[prost(message, tag="47")] + GoToTab(super::GoToTabAction), + #[prost(message, tag="48")] + GoToTabName(super::GoToTabNameAction), + #[prost(message, tag="49")] + ToggleTab(super::ToggleTabAction), + #[prost(message, tag="50")] + TabNameInput(super::TabNameInputAction), + #[prost(message, tag="51")] + UndoRenameTab(super::UndoRenameTabAction), + #[prost(message, tag="52")] + MoveTab(super::MoveTabAction), + #[prost(message, tag="53")] + Run(super::RunAction), + #[prost(message, tag="54")] + Detach(super::DetachAction), + #[prost(message, tag="55")] + LaunchOrFocusPlugin(super::LaunchOrFocusPluginAction), + #[prost(message, tag="56")] + LaunchPlugin(super::LaunchPluginAction), + #[prost(message, tag="57")] + MouseEvent(super::MouseEventAction), + #[prost(message, tag="58")] + Copy(super::CopyAction), + #[prost(message, tag="59")] + Confirm(super::ConfirmAction), + #[prost(message, tag="60")] + Deny(super::DenyAction), + #[prost(message, tag="61")] + SkipConfirm(::prost::alloc::boxed::Box<super::SkipConfirmAction>), + #[prost(message, tag="62")] + SearchInput(super::SearchInputAction), + #[prost(message, tag="63")] + Search(super::SearchAction), + #[prost(message, tag="64")] + SearchToggleOption(super::SearchToggleOptionAction), + #[prost(message, tag="65")] + ToggleMouseMode(super::ToggleMouseModeAction), + #[prost(message, tag="66")] + PreviousSwapLayout(super::PreviousSwapLayoutAction), + #[prost(message, tag="67")] + NextSwapLayout(super::NextSwapLayoutAction), + #[prost(message, tag="68")] + QueryTabNames(super::QueryTabNamesAction), + #[prost(message, tag="69")] + NewTiledPluginPane(super::NewTiledPluginPaneAction), + #[prost(message, tag="70")] + NewFloatingPluginPane(super::NewFloatingPluginPaneAction), + #[prost(message, tag="71")] + NewInPlacePluginPane(super::NewInPlacePluginPaneAction), + #[prost(message, tag="72")] + StartOrReloadPlugin(super::StartOrReloadPluginAction), + #[prost(message, tag="73")] + CloseTerminalPane(super::CloseTerminalPaneAction), + #[prost(message, tag="74")] + ClosePluginPane(super::ClosePluginPaneAction), + #[prost(message, tag="75")] + FocusTerminalPaneWithId(super::FocusTerminalPaneWithIdAction), + #[prost(message, tag="76")] + FocusPluginPaneWithId(super::FocusPluginPaneWithIdAction), + #[prost(message, tag="77")] + RenameTerminalPane(super::RenameTerminalPaneAction), + #[prost(message, tag="78")] + RenamePluginPane(super::RenamePluginPaneAction), + #[prost(message, tag="79")] + RenameTab(super::RenameTabAction), + #[prost(message, tag="80")] + BreakPane(super::BreakPaneAction), + #[prost(message, tag="81")] + BreakPaneRight(super::BreakPaneRightAction), + #[prost(message, tag="82")] + BreakPaneLeft(super::BreakPaneLeftAction), + #[prost(message, tag="83")] + RenameSession(super::RenameSessionAction), + #[prost(message, tag="84")] + CliPipe(super::CliPipeAction), + #[prost(message, tag="85")] + KeybindPipe(super::KeybindPipeAction), + #[prost(message, tag="86")] + ListClients(super::ListClientsAction), + #[prost(message, tag="87")] + TogglePanePinned(super::TogglePanePinnedAction), + #[prost(message, tag="88")] + StackPanes(super::StackPanesAction), + #[prost(message, tag="89")] + ChangeFloatingPaneCoordinates(super::ChangeFloatingPaneCoordinatesAction), + #[prost(message, tag="90")] + TogglePaneInGroup(super::TogglePaneInGroupAction), + #[prost(message, tag="91")] + ToggleGroupMarking(super::ToggleGroupMarkingAction), + } +} +// Action message definitions (all 91 variants) + +/// Simple action types (no data) +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuitAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FocusNextPaneAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FocusPreviousPaneAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchFocusAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MovePaneBackwardsAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClearScreenAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DumpLayoutAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EditScrollbackAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScrollUpAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScrollDownAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScrollToBottomAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScrollToTopAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PageScrollUpAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PageScrollDownAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HalfPageScrollUpAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HalfPageScrollDownAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ToggleFocusFullscreenAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TogglePaneFramesAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ToggleActiveSyncTabAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TogglePaneEmbedOrFloatingAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ToggleFloatingPanesAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseFocusAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UndoRenamePaneAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NoOpAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GoToNextTabAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GoToPreviousTabAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseTabAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ToggleTabAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UndoRenameTabAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DetachAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CopyAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfirmAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DenyAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ToggleMouseModeAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PreviousSwapLayoutAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NextSwapLayoutAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTabNamesAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BreakPaneAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BreakPaneRightAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BreakPaneLeftAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListClientsAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TogglePanePinnedAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TogglePaneInGroupAction { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ToggleGroupMarkingAction { +} +/// Complex action types (with data) +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteAction { + #[prost(message, optional, tag="1")] + pub key_with_modifier: ::core::option::Option<KeyWithModifier>, + #[prost(uint32, repeated, tag="2")] + pub bytes: ::prost::alloc::vec::Vec<u32>, + #[prost(bool, tag="3")] + pub is_kitty_keyboard_protocol: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteCharsAction { + #[prost(string, tag="1")] + pub chars: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchToModeAction { + #[prost(enumeration="InputMode", tag="1")] + pub input_mode: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchModeForAllClientsAction { + #[prost(enumeration="InputMode", tag="1")] + pub input_mode: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResizeAction { + #[prost(enumeration="ResizeType", tag="1")] + pub resize: i32, + #[prost(enumeration="Direction", optional, tag="2")] + pub direction: ::core::option::Option<i32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MoveFocusAction { + #[prost(enumeration="Direction", tag="1")] + pub direction: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MoveFocusOrTabAction { + #[prost(enumeration="Direction", tag="1")] + pub direction: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MovePaneAction { + #[prost(enumeration="Direction", optional, tag="1")] + pub direction: ::core::option::Option<i32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DumpScreenAction { + #[prost(string, tag="1")] + pub file_path: ::prost::alloc::string::String, + #[prost(bool, tag="2")] + pub include_scrollback: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScrollUpAtAction { + #[prost(message, optional, tag="1")] + pub position: ::core::option::Option<Position>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScrollDownAtAction { + #[prost(message, optional, tag="1")] + pub position: ::core::option::Option<Position>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewPaneAction { + #[prost(enumeration="Direction", optional, tag="1")] + pub direction: ::core::option::Option<i32>, + #[prost(string, optional, tag="2")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub start_suppressed: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EditFileAction { + #[prost(message, optional, tag="1")] + pub payload: ::core::option::Option<OpenFilePayload>, + #[prost(enumeration="Direction", optional, tag="2")] + pub direction: ::core::option::Option<i32>, + #[prost(bool, tag="3")] + pub floating: bool, + #[prost(bool, tag="4")] + pub in_place: bool, + #[prost(bool, tag="5")] + pub start_suppressed: bool, + #[prost(message, optional, tag="6")] + pub coordinates: ::core::option::Option<FloatingPaneCoordinates>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewFloatingPaneAction { + #[prost(message, optional, tag="1")] + pub command: ::core::option::Option<RunCommandAction>, + #[prost(string, optional, tag="2")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub coordinates: ::core::option::Option<FloatingPaneCoordinates>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewTiledPaneAction { + #[prost(enumeration="Direction", optional, tag="1")] + pub direction: ::core::option::Option<i32>, + #[prost(message, optional, tag="2")] + pub command: ::core::option::Option<RunCommandAction>, + #[prost(string, optional, tag="3")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewInPlacePaneAction { + #[prost(message, optional, tag="1")] + pub command: ::core::option::Option<RunCommandAction>, + #[prost(string, optional, tag="2")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewStackedPaneAction { + #[prost(message, optional, tag="1")] + pub command: ::core::option::Option<RunCommandAction>, + #[prost(string, optional, tag="2")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PaneNameInputAction { + #[prost(uint32, repeated, tag="1")] + pub input: ::prost::alloc::vec::Vec<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewTabAction { + #[prost(message, optional, tag="1")] + pub tiled_layout: ::core::option::Option<TiledPaneLayout>, + #[prost(message, repeated, tag="2")] + pub floating_layouts: ::prost::alloc::vec::Vec<FloatingPaneLayout>, + #[prost(message, repeated, tag="3")] + pub swap_tiled_layouts: ::prost::alloc::vec::Vec<SwapTiledLayout>, + #[prost(message, repeated, tag="4")] + pub swap_floating_layouts: ::prost::alloc::vec::Vec<SwapFloatingLayout>, + #[prost(string, optional, tag="5")] + pub tab_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag="6")] + pub should_change_focus_to_new_tab: bool, + #[prost(string, optional, tag="7")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GoToTabAction { + #[prost(uint32, tag="1")] + pub index: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GoToTabNameAction { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(bool, tag="2")] + pub create: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TabNameInputAction { + #[prost(uint32, repeated, tag="1")] + pub input: ::prost::alloc::vec::Vec<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MoveTabAction { + #[prost(enumeration="Direction", tag="1")] + pub direction: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RunAction { + #[prost(message, optional, tag="1")] + pub command: ::core::option::Option<RunCommandAction>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LaunchOrFocusPluginAction { + #[prost(message, optional, tag="1")] + pub plugin: ::core::option::Option<RunPluginOrAlias>, + #[prost(bool, tag="2")] + pub should_float: bool, + #[prost(bool, tag="3")] + pub move_to_focused_tab: bool, + #[prost(bool, tag="4")] + pub should_open_in_place: bool, + #[prost(bool, tag="5")] + pub skip_cache: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LaunchPluginAction { + #[prost(message, optional, tag="1")] + pub plugin: ::core::option::Option<RunPluginOrAlias>, + #[prost(bool, tag="2")] + pub should_float: bool, + #[prost(bool, tag="3")] + pub should_open_in_place: bool, + #[prost(bool, tag="4")] + pub skip_cache: bool, + #[prost(string, optional, tag="5")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MouseEventAction { + #[prost(message, optional, tag="1")] + pub event: ::core::option::Option<MouseEvent>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SkipConfirmAction { + #[prost(message, optional, boxed, tag="1")] + pub action: ::core::option::Option<::prost::alloc::boxed::Box<Action>>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SearchInputAction { + #[prost(uint32, repeated, tag="1")] + pub input: ::prost::alloc::vec::Vec<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SearchAction { + #[prost(enumeration="SearchDirection", tag="1")] + pub direction: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SearchToggleOptionAction { + #[prost(enumeration="SearchOption", tag="1")] + pub option: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewTiledPluginPaneAction { + #[prost(message, optional, tag="1")] + pub plugin: ::core::option::Option<RunPluginOrAlias>, + #[prost(string, optional, tag="2")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub skip_cache: bool, + #[prost(string, optional, tag="4")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewFloatingPluginPaneAction { + #[prost(message, optional, tag="1")] + pub plugin: ::core::option::Option<RunPluginOrAlias>, + #[prost(string, optional, tag="2")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub skip_cache: bool, + #[prost(string, optional, tag="4")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="5")] + pub coordinates: ::core::option::Option<FloatingPaneCoordinates>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewInPlacePluginPaneAction { + #[prost(message, optional, tag="1")] + pub plugin: ::core::option::Option<RunPluginOrAlias>, + #[prost(string, optional, tag="2")] + pub pane_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub skip_cache: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartOrReloadPluginAction { + #[prost(message, optional, tag="1")] + pub plugin: ::core::option::Option<RunPluginOrAlias>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseTerminalPaneAction { + #[prost(uint32, tag="1")] + pub pane_id: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClosePluginPaneAction { + #[prost(uint32, tag="1")] + pub pane_id: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FocusTerminalPaneWithIdAction { + #[prost(uint32, tag="1")] + pub pane_id: u32, + #[prost(bool, tag="2")] + pub should_float_if_hidden: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FocusPluginPaneWithIdAction { + #[prost(uint32, tag="1")] + pub pane_id: u32, + #[prost(bool, tag="2")] + pub should_float_if_hidden: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenameTerminalPaneAction { + #[prost(uint32, tag="1")] + pub pane_id: u32, + #[prost(uint32, repeated, tag="2")] + pub name: ::prost::alloc::vec::Vec<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenamePluginPaneAction { + #[prost(uint32, tag="1")] + pub pane_id: u32, + #[prost(uint32, repeated, tag="2")] + pub name: ::prost::alloc::vec::Vec<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenameTabAction { + #[prost(uint32, tag="1")] + pub tab_index: u32, + #[prost(uint32, repeated, tag="2")] + pub name: ::prost::alloc::vec::Vec<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenameSessionAction { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CliPipeAction { + #[prost(string, tag="1")] + pub pipe_id: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="3")] + pub payload: ::core::option::Option<::prost::alloc::string::String>, + #[prost(map="string, string", tag="4")] + pub args: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + #[prost(string, optional, tag="5")] + pub plugin: ::core::option::Option<::prost::alloc::string::String>, + #[prost(map="string, string", tag="6")] + pub configuration: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + #[prost(bool, tag="7")] + pub launch_new: bool, + #[prost(bool, tag="8")] + pub skip_cache: bool, + #[prost(bool, optional, tag="9")] + pub floating: ::core::option::Option<bool>, + #[prost(bool, optional, tag="10")] + pub in_place: ::core::option::Option<bool>, + #[prost(string, optional, tag="11")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="12")] + pub pane_title: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KeybindPipeAction { + #[prost(string, optional, tag="1")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="2")] + pub payload: ::core::option::Option<::prost::alloc::string::String>, + #[prost(map="string, string", tag="3")] + pub args: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + #[prost(string, optional, tag="4")] + pub plugin: ::core::option::Option<::prost::alloc::string::String>, + #[prost(uint32, optional, tag="5")] + pub plugin_id: ::core::option::Option<u32>, + #[prost(map="string, string", tag="6")] + pub configuration: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + #[prost(bool, tag="7")] + pub launch_new: bool, + #[prost(bool, tag="8")] + pub skip_cache: bool, + #[prost(bool, optional, tag="9")] + pub floating: ::core::option::Option<bool>, + #[prost(bool, optional, tag="10")] + pub in_place: ::core::option::Option<bool>, + #[prost(string, optional, tag="11")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="12")] + pub pane_title: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StackPanesAction { + #[prost(message, repeated, tag="1")] + pub pane_ids: ::prost::alloc::vec::Vec<PaneId>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeFloatingPaneCoordinatesAction { + #[prost(message, optional, tag="1")] + pub pane_id: ::core::option::Option<PaneId>, + #[prost(message, optional, tag="2")] + pub coordinates: ::core::option::Option<FloatingPaneCoordinates>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Position { + /// Changed from uint32 to int32 to support negative line numbers + #[prost(int32, tag="1")] + pub line: i32, + /// Changed from uint32 to uint64 to support large column numbers + #[prost(uint64, tag="2")] + pub column: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CliAssets { + #[prost(string, optional, tag="1")] + pub config_file_path: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="2")] + pub config_dir: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub should_ignore_config: bool, + #[prost(message, optional, tag="4")] + pub configuration_options: ::core::option::Option<Options>, + #[prost(message, optional, tag="5")] + pub layout: ::core::option::Option<LayoutInfo>, + #[prost(message, optional, tag="6")] + pub terminal_window_size: ::core::option::Option<Size>, + #[prost(string, optional, tag="7")] + pub data_dir: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, tag="8")] + pub is_debug: bool, + #[prost(uint32, optional, tag="9")] + pub max_panes: ::core::option::Option<u32>, + #[prost(bool, tag="10")] + pub force_run_layout_commands: bool, + #[prost(string, optional, tag="11")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LayoutInfo { + #[prost(oneof="layout_info::LayoutType", tags="1, 2, 3, 4")] + pub layout_type: ::core::option::Option<layout_info::LayoutType>, +} +/// Nested message and enum types in `LayoutInfo`. +pub mod layout_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum LayoutType { + #[prost(string, tag="1")] + FilePath(::prost::alloc::string::String), + #[prost(string, tag="2")] + BuiltinName(::prost::alloc::string::String), + #[prost(string, tag="3")] + Url(::prost::alloc::string::String), + #[prost(string, tag="4")] + Stringified(::prost::alloc::string::String), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConnectToSession { + #[prost(string, optional, tag="1")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(uint32, optional, tag="2")] + pub tab_position: ::core::option::Option<u32>, + #[prost(message, optional, tag="3")] + pub pane_id: ::core::option::Option<PaneIdWithPlugin>, + #[prost(message, optional, tag="4")] + pub layout: ::core::option::Option<LayoutInfo>, + #[prost(string, optional, tag="5")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PaneIdWithPlugin { + #[prost(uint32, tag="1")] + pub pane_id: u32, + #[prost(bool, tag="2")] + pub is_plugin: bool, +} +// Additional supporting types for Action messages + +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenFilePayload { + #[prost(string, tag="1")] + pub file_to_open: ::prost::alloc::string::String, + #[prost(uint32, optional, tag="2")] + pub line_number: ::core::option::Option<u32>, + /// Renumbered after removing column_number + #[prost(string, optional, tag="3")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, + /// Added missing originating_plugin field + #[prost(message, optional, tag="4")] + pub originating_plugin: ::core::option::Option<OriginatingPlugin>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FloatingPaneCoordinates { + #[prost(message, optional, tag="1")] + pub x: ::core::option::Option<FloatingCoordinate>, + #[prost(message, optional, tag="2")] + pub y: ::core::option::Option<FloatingCoordinate>, + #[prost(message, optional, tag="3")] + pub width: ::core::option::Option<FloatingCoordinate>, + #[prost(message, optional, tag="4")] + pub height: ::core::option::Option<FloatingCoordinate>, + /// Added missing pinned field + #[prost(bool, optional, tag="5")] + pub pinned: ::core::option::Option<bool>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FloatingCoordinate { + #[prost(oneof="floating_coordinate::CoordinateType", tags="1, 2")] + pub coordinate_type: ::core::option::Option<floating_coordinate::CoordinateType>, +} +/// Nested message and enum types in `FloatingCoordinate`. +pub mod floating_coordinate { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum CoordinateType { + #[prost(uint32, tag="1")] + Fixed(u32), + #[prost(float, tag="2")] + Percent(f32), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RunCommandAction { + #[prost(string, tag="1")] + pub command: ::prost::alloc::string::String, + #[prost(string, repeated, tag="2")] + pub args: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, optional, tag="3")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, + /// Added missing direction field + #[prost(enumeration="Direction", optional, tag="4")] + pub direction: ::core::option::Option<i32>, + /// Renumbered + #[prost(bool, tag="5")] + pub hold_on_close: bool, + /// Renumbered + #[prost(bool, tag="6")] + pub hold_on_start: bool, + /// Added missing originating_plugin field + #[prost(message, optional, tag="7")] + pub originating_plugin: ::core::option::Option<OriginatingPlugin>, + /// Added missing use_terminal_title field + #[prost(bool, tag="8")] + pub use_terminal_title: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TiledPaneLayout { + #[prost(enumeration="SplitDirection", tag="1")] + pub children_split_direction: i32, + #[prost(string, optional, tag="2")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, repeated, tag="3")] + pub children: ::prost::alloc::vec::Vec<TiledPaneLayout>, + #[prost(message, optional, tag="4")] + pub split_size: ::core::option::Option<SplitSize>, + #[prost(message, optional, tag="5")] + pub run: ::core::option::Option<Run>, + #[prost(bool, tag="6")] + pub borderless: bool, + #[prost(string, optional, tag="7")] + pub focus: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, optional, tag="8")] + pub exclude_from_sync: ::core::option::Option<bool>, + #[prost(bool, tag="9")] + pub children_are_stacked: bool, + #[prost(uint32, optional, tag="10")] + pub external_children_index: ::core::option::Option<u32>, + #[prost(bool, tag="11")] + pub is_expanded_in_stack: bool, + #[prost(bool, tag="12")] + pub hide_floating_panes: bool, + /// NOTE: run_instructions_to_ignore is not represented here because it's a field used only inside the server itself and not part of the server/client contract + #[prost(string, optional, tag="13")] + pub pane_initial_contents: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FloatingPaneLayout { + #[prost(string, optional, tag="1")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="2")] + pub height: ::core::option::Option<PercentOrFixed>, + #[prost(message, optional, tag="3")] + pub width: ::core::option::Option<PercentOrFixed>, + #[prost(message, optional, tag="4")] + pub x: ::core::option::Option<PercentOrFixed>, + #[prost(message, optional, tag="5")] + pub y: ::core::option::Option<PercentOrFixed>, + #[prost(bool, optional, tag="6")] + pub pinned: ::core::option::Option<bool>, + #[prost(message, optional, tag="7")] + pub run: ::core::option::Option<Run>, + #[prost(bool, optional, tag="8")] + pub focus: ::core::option::Option<bool>, + #[prost(bool, tag="9")] + pub already_running: bool, + #[prost(string, optional, tag="10")] + pub pane_initial_contents: ::core::option::Option<::prost::alloc::string::String>, + #[prost(uint32, optional, tag="11")] + pub logical_position: ::core::option::Option<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwapTiledLayout { + #[prost(message, repeated, tag="1")] + pub constraint_map: ::prost::alloc::vec::Vec<LayoutConstraintTiledPair>, + #[prost(string, optional, tag="2")] + pub name: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwapFloatingLayout { + #[prost(message, repeated, tag="1")] + pub constraint_map: ::prost::alloc::vec::Vec<LayoutConstraintFloatingPair>, + #[prost(string, optional, tag="2")] + pub name: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LayoutConstraintTiledPair { + #[prost(message, optional, tag="1")] + pub constraint: ::core::option::Option<LayoutConstraintWithValue>, + #[prost(message, optional, tag="2")] + pub layout: ::core::option::Option<TiledPaneLayout>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LayoutConstraintFloatingPair { + #[prost(message, optional, tag="1")] + pub constraint: ::core::option::Option<LayoutConstraintWithValue>, + #[prost(message, repeated, tag="2")] + pub layouts: ::prost::alloc::vec::Vec<FloatingPaneLayout>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RunPluginOrAlias { + #[prost(oneof="run_plugin_or_alias::PluginType", tags="1, 2")] + pub plugin_type: ::core::option::Option<run_plugin_or_alias::PluginType>, +} +/// Nested message and enum types in `RunPluginOrAlias`. +pub mod run_plugin_or_alias { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum PluginType { + #[prost(message, tag="1")] + Plugin(super::RunPlugin), + #[prost(message, tag="2")] + Alias(super::PluginAlias), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RunPlugin { + #[prost(bool, tag="1")] + pub allow_exec_host_cmd: bool, + #[prost(message, optional, tag="2")] + pub location: ::core::option::Option<RunPluginLocationData>, + #[prost(message, optional, tag="3")] + pub configuration: ::core::option::Option<PluginUserConfiguration>, + #[prost(string, optional, tag="4")] + pub initial_cwd: ::core::option::Option<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PluginAlias { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub configuration: ::core::option::Option<PluginUserConfiguration>, + #[prost(string, optional, tag="3")] + pub initial_cwd: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="4")] + pub run_plugin: ::core::option::Option<RunPlugin>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MouseEvent { + #[prost(enumeration="MouseEventType", tag="1")] + pub event_type: i32, + #[prost(bool, tag="2")] + pub left: bool, + #[prost(bool, tag="3")] + pub right: bool, + #[prost(bool, tag="4")] + pub middle: bool, + #[prost(bool, tag="5")] + pub wheel_up: bool, + #[prost(bool, tag="6")] + pub wheel_down: bool, + #[prost(bool, tag="7")] + pub shift: bool, + #[prost(bool, tag="8")] + pub alt: bool, + #[prost(bool, tag="9")] + pub ctrl: bool, + #[prost(message, optional, tag="10")] + pub position: ::core::option::Option<Position>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PaneId { + #[prost(oneof="pane_id::PaneType", tags="1, 2")] + pub pane_type: ::core::option::Option<pane_id::PaneType>, +} +/// Nested message and enum types in `PaneId`. +pub mod pane_id { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum PaneType { + #[prost(uint32, tag="1")] + Terminal(u32), + #[prost(uint32, tag="2")] + Plugin(u32), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitSize { + #[prost(oneof="split_size::SizeType", tags="1, 2")] + pub size_type: ::core::option::Option<split_size::SizeType>, +} +/// Nested message and enum types in `SplitSize`. +pub mod split_size { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum SizeType { + /// 1 to 100 + #[prost(uint32, tag="1")] + Percent(u32), + /// absolute number + #[prost(uint32, tag="2")] + Fixed(u32), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PercentOrFixed { + #[prost(oneof="percent_or_fixed::SizeType", tags="1, 2")] + pub size_type: ::core::option::Option<percent_or_fixed::SizeType>, +} +/// Nested message and enum types in `PercentOrFixed`. +pub mod percent_or_fixed { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum SizeType { + /// 1 to 100 + #[prost(uint32, tag="1")] + Percent(u32), + /// absolute number + #[prost(uint32, tag="2")] + Fixed(u32), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LayoutConstraintWithValue { + #[prost(enumeration="LayoutConstraint", tag="1")] + pub constraint_type: i32, + /// Only used for MAX_PANES, MIN_PANES, EXACT_PANES + #[prost(uint32, optional, tag="2")] + pub value: ::core::option::Option<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PluginUserConfiguration { + #[prost(map="string, string", tag="1")] + pub configuration: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RunPluginLocationData { + #[prost(enumeration="RunPluginLocation", tag="1")] + pub location_type: i32, + #[prost(oneof="run_plugin_location_data::LocationData", tags="2, 3, 4")] + pub location_data: ::core::option::Option<run_plugin_location_data::LocationData>, +} +/// Nested message and enum types in `RunPluginLocationData`. +pub mod run_plugin_location_data { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum LocationData { + /// For FILE + #[prost(string, tag="2")] + FilePath(::prost::alloc::string::String), + /// For ZELLIJ + #[prost(message, tag="3")] + ZellijTag(super::PluginTag), + /// For REMOTE + #[prost(string, tag="4")] + RemoteUrl(::prost::alloc::string::String), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PluginTag { + #[prost(string, tag="1")] + pub tag: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OriginatingPlugin { + #[prost(uint32, tag="1")] + pub plugin_id: u32, + /// ClientId is u16, but using uint32 for protobuf compatibility + #[prost(uint32, tag="2")] + pub client_id: u32, + /// Context is BTreeMap<String, String> + #[prost(map="string, string", tag="3")] + pub context: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Run { + #[prost(oneof="run::RunType", tags="1, 2, 3, 4")] + pub run_type: ::core::option::Option<run::RunType>, +} +/// Nested message and enum types in `Run`. +pub mod run { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum RunType { + #[prost(message, tag="1")] + Command(super::RunCommandAction), + #[prost(message, tag="2")] + Plugin(super::RunPluginOrAlias), + #[prost(message, tag="3")] + EditFile(super::RunEditFileAction), + #[prost(string, tag="4")] + Cwd(::prost::alloc::string::String), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RunEditFileAction { + #[prost(string, tag="1")] + pub file_path: ::prost::alloc::string::String, + #[prost(uint32, optional, tag="2")] + pub line_number: ::core::option::Option<u32>, + #[prost(string, optional, tag="3")] + pub cwd: ::core::option::Option<::prost::alloc::string::String>, +} +// Config Options message - comprehensive configuration structure + +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Options { + #[prost(bool, optional, tag="1")] + pub simplified_ui: ::core::option::Option<bool>, + #[prost(string, optional, tag="2")] + pub theme: ::core::option::Option<::prost::alloc::string::String>, + #[prost(enumeration="InputMode", optional, tag="3")] + pub default_mode: ::core::option::Option<i32>, + #[prost(string, optional, tag="4")] + pub default_shell: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="5")] + pub default_cwd: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="6")] + pub default_layout: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="7")] + pub layout_dir: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="8")] + pub theme_dir: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, optional, tag="9")] + pub mouse_mode: ::core::option::Option<bool>, + #[prost(bool, optional, tag="10")] + pub pane_frames: ::core::option::Option<bool>, + #[prost(bool, optional, tag="11")] + pub mirror_session: ::core::option::Option<bool>, + #[prost(enumeration="OnForceClose", optional, tag="12")] + pub on_force_close: ::core::option::Option<i32>, + #[prost(uint32, optional, tag="13")] + pub scroll_buffer_size: ::core::option::Option<u32>, + #[prost(string, optional, tag="14")] + pub copy_command: ::core::option::Option<::prost::alloc::string::String>, + #[prost(enumeration="Clipboard", optional, tag="15")] + pub copy_clipboard: ::core::option::Option<i32>, + #[prost(bool, optional, tag="16")] + pub copy_on_select: ::core::option::Option<bool>, + #[prost(string, optional, tag="17")] + pub scrollback_editor: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="18")] + pub session_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, optional, tag="19")] + pub attach_to_session: ::core::option::Option<bool>, + #[prost(bool, optional, tag="20")] + pub auto_layout: ::core::option::Option<bool>, + #[prost(bool, optional, tag="21")] + pub session_serialization: ::core::option::Option<bool>, + #[prost(bool, optional, tag="22")] + pub serialize_pane_viewport: ::core::option::Option<bool>, + #[prost(uint32, optional, tag="23")] + pub scrollback_lines_to_serialize: ::core::option::Option<u32>, + #[prost(bool, optional, tag="24")] + pub styled_underlines: ::core::option::Option<bool>, + #[prost(uint64, optional, tag="25")] + pub serialization_interval: ::core::option::Option<u64>, + #[prost(bool, optional, tag="26")] + pub disable_session_metadata: ::core::option::Option<bool>, + #[prost(bool, optional, tag="27")] + pub support_kitty_keyboard_protocol: ::core::option::Option<bool>, + #[prost(bool, optional, tag="28")] + pub web_server: ::core::option::Option<bool>, + #[prost(enumeration="WebSharing", optional, tag="29")] + pub web_sharing: ::core::option::Option<i32>, + #[prost(bool, optional, tag="30")] + pub stacked_resize: ::core::option::Option<bool>, + #[prost(bool, optional, tag="31")] + pub show_startup_tips: ::core::option::Option<bool>, + #[prost(bool, optional, tag="32")] + pub show_release_notes: ::core::option::Option<bool>, + #[prost(bool, optional, tag="33")] + pub advanced_mouse_actions: ::core::option::Option<bool>, + #[prost(string, optional, tag="34")] + pub web_server_ip: ::core::option::Option<::prost::alloc::string::String>, + #[prost(uint32, optional, tag="35")] + pub web_server_port: ::core::option::Option<u32>, + #[prost(string, optional, tag="36")] + pub web_server_cert: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="37")] + pub web_server_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, optional, tag="38")] + pub enforce_https_for_localhost: ::core::option::Option<bool>, + #[prost(string, optional, tag="39")] + pub post_command_discovery_hook: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum BareKey { + Unspecified = 0, + PageDown = 1, + PageUp = 2, + Left = 3, + Down = 4, + Up = 5, + Right = 6, + Home = 7, + End = 8, + Backspace = 9, + Delete = 10, + Insert = 11, + F1 = 12, + F2 = 13, + F3 = 14, + F4 = 15, + F5 = 16, + F6 = 17, + F7 = 18, + F8 = 19, + F9 = 20, + F10 = 21, + F11 = 22, + F12 = 23, + Char = 24, + Tab = 25, + Esc = 26, + Enter = 27, + CapsLock = 28, + ScrollLock = 29, + NumLock = 30, + PrintScreen = 31, + Pause = 32, + Menu = 33, +} +impl BareKey { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + BareKey::Unspecified => "BARE_KEY_UNSPECIFIED", + BareKey::PageDown => "BARE_KEY_PAGE_DOWN", + BareKey::PageUp => "BARE_KEY_PAGE_UP", + BareKey::Left => "BARE_KEY_LEFT", + BareKey::Down => "BARE_KEY_DOWN", + BareKey::Up => "BARE_KEY_UP", + BareKey::Right => "BARE_KEY_RIGHT", + BareKey::Home => "BARE_KEY_HOME", + BareKey::End => "BARE_KEY_END", + BareKey::Backspace => "BARE_KEY_BACKSPACE", + BareKey::Delete => "BARE_KEY_DELETE", + BareKey::Insert => "BARE_KEY_INSERT", + BareKey::F1 => "BARE_KEY_F1", + BareKey::F2 => "BARE_KEY_F2", + BareKey::F3 => "BARE_KEY_F3", + BareKey::F4 => "BARE_KEY_F4", + BareKey::F5 => "BARE_KEY_F5", + BareKey::F6 => "BARE_KEY_F6", + BareKey::F7 => "BARE_KEY_F7", + BareKey::F8 => "BARE_KEY_F8", + BareKey::F9 => "BARE_KEY_F9", + BareKey::F10 => "BARE_KEY_F10", + BareKey::F11 => "BARE_KEY_F11", + BareKey::F12 => "BARE_KEY_F12", + BareKey::Char => "BARE_KEY_CHAR", + BareKey::Tab => "BARE_KEY_TAB", + BareKey::Esc => "BARE_KEY_ESC", + BareKey::Enter => "BARE_KEY_ENTER", + BareKey::CapsLock => "BARE_KEY_CAPS_LOCK", + BareKey::ScrollLock => "BARE_KEY_SCROLL_LOCK", + BareKey::NumLock => "BARE_KEY_NUM_LOCK", + BareKey::PrintScreen => "BARE_KEY_PRINT_SCREEN", + BareKey::Pause => "BARE_KEY_PAUSE", + BareKey::Menu => "BARE_KEY_MENU", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "BARE_KEY_UNSPECIFIED" => Some(Self::Unspecified), + "BARE_KEY_PAGE_DOWN" => Some(Self::PageDown), + "BARE_KEY_PAGE_UP" => Some(Self::PageUp), + "BARE_KEY_LEFT" => Some(Self::Left), + "BARE_KEY_DOWN" => Some(Self::Down), + "BARE_KEY_UP" => Some(Self::Up), + "BARE_KEY_RIGHT" => Some(Self::Right), + "BARE_KEY_HOME" => Some(Self::Home), + "BARE_KEY_END" => Some(Self::End), + "BARE_KEY_BACKSPACE" => Some(Self::Backspace), + "BARE_KEY_DELETE" => Some(Self::Delete), + "BARE_KEY_INSERT" => Some(Self::Insert), + "BARE_KEY_F1" => Some(Self::F1), + "BARE_KEY_F2" => Some(Self::F2), + "BARE_KEY_F3" => Some(Self::F3), + "BARE_KEY_F4" => Some(Self::F4), + "BARE_KEY_F5" => Some(Self::F5), + "BARE_KEY_F6" => Some(Self::F6), + "BARE_KEY_F7" => Some(Self::F7), + "BARE_KEY_F8" => Some(Self::F8), + "BARE_KEY_F9" => Some(Self::F9), + "BARE_KEY_F10" => Some(Self::F10), + "BARE_KEY_F11" => Some(Self::F11), + "BARE_KEY_F12" => Some(Self::F12), + "BARE_KEY_CHAR" => Some(Self::Char), + "BARE_KEY_TAB" => Some(Self::Tab), + "BARE_KEY_ESC" => Some(Self::Esc), + "BARE_KEY_ENTER" => Some(Self::Enter), + "BARE_KEY_CAPS_LOCK" => Some(Self::CapsLock), + "BARE_KEY_SCROLL_LOCK" => Some(Self::ScrollLock), + "BARE_KEY_NUM_LOCK" => Some(Self::NumLock), + "BARE_KEY_PRINT_SCREEN" => Some(Self::PrintScreen), + "BARE_KEY_PAUSE" => Some(Self::Pause), + "BARE_KEY_MENU" => Some(Self::Menu), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum KeyModifier { + Unspecified = 0, + Ctrl = 1, + Alt = 2, + Shift = 3, + Super = 4, +} +impl KeyModifier { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + KeyModifier::Unspecified => "KEY_MODIFIER_UNSPECIFIED", + KeyModifier::Ctrl => "KEY_MODIFIER_CTRL", + KeyModifier::Alt => "KEY_MODIFIER_ALT", + KeyModifier::Shift => "KEY_MODIFIER_SHIFT", + KeyModifier::Super => "KEY_MODIFIER_SUPER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "KEY_MODIFIER_UNSPECIFIED" => Some(Self::Unspecified), + "KEY_MODIFIER_CTRL" => Some(Self::Ctrl), + "KEY_MODIFIER_ALT" => Some(Self::Alt), + "KEY_MODIFIER_SHIFT" => Some(Self::Shift), + "KEY_MODIFIER_SUPER" => Some(Self::Super), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AnsiCode { + Unspecified = 0, + Black = 1, + Red = 2, + Green = 3, + Yellow = 4, + Blue = 5, + Magenta = 6, + Cyan = 7, + White = 8, + BrightBlack = 9, + BrightRed = 10, + BrightGreen = 11, + BrightYellow = 12, + BrightBlue = 13, + BrightMagenta = 14, + BrightCyan = 15, + BrightWhite = 16, +} +impl AnsiCode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + AnsiCode::Unspecified => "ANSI_CODE_UNSPECIFIED", + AnsiCode::Black => "BLACK", + AnsiCode::Red => "RED", + AnsiCode::Green => "GREEN", + AnsiCode::Yellow => "YELLOW", + AnsiCode::Blue => "BLUE", + AnsiCode::Magenta => "MAGENTA", + AnsiCode::Cyan => "CYAN", + AnsiCode::White => "WHITE", + AnsiCode::BrightBlack => "BRIGHT_BLACK", + AnsiCode::BrightRed => "BRIGHT_RED", + AnsiCode::BrightGreen => "BRIGHT_GREEN", + AnsiCode::BrightYellow => "BRIGHT_YELLOW", + AnsiCode::BrightBlue => "BRIGHT_BLUE", + AnsiCode::BrightMagenta => "BRIGHT_MAGENTA", + AnsiCode::BrightCyan => "BRIGHT_CYAN", + AnsiCode::BrightWhite => "BRIGHT_WHITE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "ANSI_CODE_UNSPECIFIED" => Some(Self::Unspecified), + "BLACK" => Some(Self::Black), + "RED" => Some(Self::Red), + "GREEN" => Some(Self::Green), + "YELLOW" => Some(Self::Yellow), + "BLUE" => Some(Self::Blue), + "MAGENTA" => Some(Self::Magenta), + "CYAN" => Some(Self::Cyan), + "WHITE" => Some(Self::White), + "BRIGHT_BLACK" => Some(Self::BrightBlack), + "BRIGHT_RED" => Some(Self::BrightRed), + "BRIGHT_GREEN" => Some(Self::BrightGreen), + "BRIGHT_YELLOW" => Some(Self::BrightYellow), + "BRIGHT_BLUE" => Some(Self::BrightBlue), + "BRIGHT_MAGENTA" => Some(Self::BrightMagenta), + "BRIGHT_CYAN" => Some(Self::BrightCyan), + "BRIGHT_WHITE" => Some(Self::BrightWhite), + _ => None, + } + } +} +/// Supporting enums and messages +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum InputMode { + Unspecified = 0, + Normal = 1, + Locked = 2, + Resize = 3, + Pane = 4, + Tab = 5, + Scroll = 6, + EnterSearch = 7, + Search = 8, + RenameTab = 9, + RenamePane = 10, + Session = 11, + Move = 12, + Prompt = 13, + Tmux = 14, +} +impl InputMode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + InputMode::Unspecified => "INPUT_MODE_UNSPECIFIED", + InputMode::Normal => "INPUT_MODE_NORMAL", + InputMode::Locked => "INPUT_MODE_LOCKED", + InputMode::Resize => "INPUT_MODE_RESIZE", + InputMode::Pane => "INPUT_MODE_PANE", + InputMode::Tab => "INPUT_MODE_TAB", + InputMode::Scroll => "INPUT_MODE_SCROLL", + InputMode::EnterSearch => "INPUT_MODE_ENTER_SEARCH", + InputMode::Search => "INPUT_MODE_SEARCH", + InputMode::RenameTab => "INPUT_MODE_RENAME_TAB", + InputMode::RenamePane => "INPUT_MODE_RENAME_PANE", + InputMode::Session => "INPUT_MODE_SESSION", + InputMode::Move => "INPUT_MODE_MOVE", + InputMode::Prompt => "INPUT_MODE_PROMPT", + InputMode::Tmux => "INPUT_MODE_TMUX", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "INPUT_MODE_UNSPECIFIED" => Some(Self::Unspecified), + "INPUT_MODE_NORMAL" => Some(Self::Normal), + "INPUT_MODE_LOCKED" => Some(Self::Locked), + "INPUT_MODE_RESIZE" => Some(Self::Resize), + "INPUT_MODE_PANE" => Some(Self::Pane), + "INPUT_MODE_TAB" => Some(Self::Tab), + "INPUT_MODE_SCROLL" => Some(Self::Scroll), + "INPUT_MODE_ENTER_SEARCH" => Some(Self::EnterSearch), + "INPUT_MODE_SEARCH" => Some(Self::Search), + "INPUT_MODE_RENAME_TAB" => Some(Self::RenameTab), + "INPUT_MODE_RENAME_PANE" => Some(Self::RenamePane), + "INPUT_MODE_SESSION" => Some(Self::Session), + "INPUT_MODE_MOVE" => Some(Self::Move), + "INPUT_MODE_PROMPT" => Some(Self::Prompt), + "INPUT_MODE_TMUX" => Some(Self::Tmux), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Direction { + Unspecified = 0, + Left = 1, + Right = 2, + Up = 3, + Down = 4, +} +impl Direction { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Direction::Unspecified => "DIRECTION_UNSPECIFIED", + Direction::Left => "DIRECTION_LEFT", + Direction::Right => "DIRECTION_RIGHT", + Direction::Up => "DIRECTION_UP", + Direction::Down => "DIRECTION_DOWN", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "DIRECTION_UNSPECIFIED" => Some(Self::Unspecified), + "DIRECTION_LEFT" => Some(Self::Left), + "DIRECTION_RIGHT" => Some(Self::Right), + "DIRECTION_UP" => Some(Self::Up), + "DIRECTION_DOWN" => Some(Self::Down), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ResizeType { + Unspecified = 0, + Increase = 1, + Decrease = 2, +} +impl ResizeType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ResizeType::Unspecified => "RESIZE_TYPE_UNSPECIFIED", + ResizeType::Increase => "RESIZE_TYPE_INCREASE", + ResizeType::Decrease => "RESIZE_TYPE_DECREASE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "RESIZE_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "RESIZE_TYPE_INCREASE" => Some(Self::Increase), + "RESIZE_TYPE_DECREASE" => Some(Self::Decrease), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ExitReason { + Unspecified = 0, + Normal = 1, + NormalDetached = 2, + ForceDetached = 3, + CannotAttach = 4, + Disconnect = 5, + WebClientsForbidden = 6, + Error = 7, +} +impl ExitReason { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ExitReason::Unspecified => "EXIT_REASON_UNSPECIFIED", + ExitReason::Normal => "EXIT_REASON_NORMAL", + ExitReason::NormalDetached => "EXIT_REASON_NORMAL_DETACHED", + ExitReason::ForceDetached => "EXIT_REASON_FORCE_DETACHED", + ExitReason::CannotAttach => "EXIT_REASON_CANNOT_ATTACH", + ExitReason::Disconnect => "EXIT_REASON_DISCONNECT", + ExitReason::WebClientsForbidden => "EXIT_REASON_WEB_CLIENTS_FORBIDDEN", + ExitReason::Error => "EXIT_REASON_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "EXIT_REASON_UNSPECIFIED" => Some(Self::Unspecified), + "EXIT_REASON_NORMAL" => Some(Self::Normal), + "EXIT_REASON_NORMAL_DETACHED" => Some(Self::NormalDetached), + "EXIT_REASON_FORCE_DETACHED" => Some(Self::ForceDetached), + "EXIT_REASON_CANNOT_ATTACH" => Some(Self::CannotAttach), + "EXIT_REASON_DISCONNECT" => Some(Self::Disconnect), + "EXIT_REASON_WEB_CLIENTS_FORBIDDEN" => Some(Self::WebClientsForbidden), + "EXIT_REASON_ERROR" => Some(Self::Error), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum MouseEventType { + Unspecified = 0, + Press = 1, + Release = 2, + Motion = 3, +} +impl MouseEventType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + MouseEventType::Unspecified => "MOUSE_EVENT_TYPE_UNSPECIFIED", + MouseEventType::Press => "MOUSE_EVENT_TYPE_PRESS", + MouseEventType::Release => "MOUSE_EVENT_TYPE_RELEASE", + MouseEventType::Motion => "MOUSE_EVENT_TYPE_MOTION", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "MOUSE_EVENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "MOUSE_EVENT_TYPE_PRESS" => Some(Self::Press), + "MOUSE_EVENT_TYPE_RELEASE" => Some(Self::Release), + "MOUSE_EVENT_TYPE_MOTION" => Some(Self::Motion), + _ => None, + } + } +} +// Note: Old MousePressEvent, MouseReleaseEvent, MouseHoldEvent, MouseScrollEvent, +// MouseButton, and ScrollDirection removed - replaced with unified MouseEvent structure + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SearchDirection { + Unspecified = 0, + /// Changed from FORWARD to match Rust enum + Down = 1, + /// Changed from BACKWARD to match Rust enum + Up = 2, +} +impl SearchDirection { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SearchDirection::Unspecified => "SEARCH_DIRECTION_UNSPECIFIED", + SearchDirection::Down => "SEARCH_DIRECTION_DOWN", + SearchDirection::Up => "SEARCH_DIRECTION_UP", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "SEARCH_DIRECTION_UNSPECIFIED" => Some(Self::Unspecified), + "SEARCH_DIRECTION_DOWN" => Some(Self::Down), + "SEARCH_DIRECTION_UP" => Some(Self::Up), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SearchOption { + Unspecified = 0, + /// Changed from CASE_SENSITIVE to match Rust enum + CaseSensitivity = 1, + /// Changed from WHOLE_WORDS to match Rust enum + WholeWord = 2, + /// Unchanged - already matches + Wrap = 3, +} +impl SearchOption { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SearchOption::Unspecified => "SEARCH_OPTION_UNSPECIFIED", + SearchOption::CaseSensitivity => "SEARCH_OPTION_CASE_SENSITIVITY", + SearchOption::WholeWord => "SEARCH_OPTION_WHOLE_WORD", + SearchOption::Wrap => "SEARCH_OPTION_WRAP", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "SEARCH_OPTION_UNSPECIFIED" => Some(Self::Unspecified), + "SEARCH_OPTION_CASE_SENSITIVITY" => Some(Self::CaseSensitivity), + "SEARCH_OPTION_WHOLE_WORD" => Some(Self::WholeWord), + "SEARCH_OPTION_WRAP" => Some(Self::Wrap), + _ => None, + } + } +} +// Additional missing supporting types + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SplitDirection { + Unspecified = 0, + Horizontal = 1, + Vertical = 2, +} +impl SplitDirection { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SplitDirection::Unspecified => "SPLIT_DIRECTION_UNSPECIFIED", + SplitDirection::Horizontal => "SPLIT_DIRECTION_HORIZONTAL", + SplitDirection::Vertical => "SPLIT_DIRECTION_VERTICAL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "SPLIT_DIRECTION_UNSPECIFIED" => Some(Self::Unspecified), + "SPLIT_DIRECTION_HORIZONTAL" => Some(Self::Horizontal), + "SPLIT_DIRECTION_VERTICAL" => Some(Self::Vertical), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum LayoutConstraint { + Unspecified = 0, + MaxPanes = 1, + MinPanes = 2, + ExactPanes = 3, + NoConstraint = 4, +} +impl LayoutConstraint { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + LayoutConstraint::Unspecified => "LAYOUT_CONSTRAINT_UNSPECIFIED", + LayoutConstraint::MaxPanes => "LAYOUT_CONSTRAINT_MAX_PANES", + LayoutConstraint::MinPanes => "LAYOUT_CONSTRAINT_MIN_PANES", + LayoutConstraint::ExactPanes => "LAYOUT_CONSTRAINT_EXACT_PANES", + LayoutConstraint::NoConstraint => "LAYOUT_CONSTRAINT_NO_CONSTRAINT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "LAYOUT_CONSTRAINT_UNSPECIFIED" => Some(Self::Unspecified), + "LAYOUT_CONSTRAINT_MAX_PANES" => Some(Self::MaxPanes), + "LAYOUT_CONSTRAINT_MIN_PANES" => Some(Self::MinPanes), + "LAYOUT_CONSTRAINT_EXACT_PANES" => Some(Self::ExactPanes), + "LAYOUT_CONSTRAINT_NO_CONSTRAINT" => Some(Self::NoConstraint), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum RunPluginLocation { + Unspecified = 0, + File = 1, + Zellij = 2, + Remote = 3, +} +impl RunPluginLocation { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + RunPluginLocation::Unspecified => "RUN_PLUGIN_LOCATION_UNSPECIFIED", + RunPluginLocation::File => "RUN_PLUGIN_LOCATION_FILE", + RunPluginLocation::Zellij => "RUN_PLUGIN_LOCATION_ZELLIJ", + RunPluginLocation::Remote => "RUN_PLUGIN_LOCATION_REMOTE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "RUN_PLUGIN_LOCATION_UNSPECIFIED" => Some(Self::Unspecified), + "RUN_PLUGIN_LOCATION_FILE" => Some(Self::File), + "RUN_PLUGIN_LOCATION_ZELLIJ" => Some(Self::Zellij), + "RUN_PLUGIN_LOCATION_REMOTE" => Some(Self::Remote), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum OnForceClose { + Unspecified = 0, + Quit = 1, + Detach = 2, +} +impl OnForceClose { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OnForceClose::Unspecified => "ON_FORCE_CLOSE_UNSPECIFIED", + OnForceClose::Quit => "ON_FORCE_CLOSE_QUIT", + OnForceClose::Detach => "ON_FORCE_CLOSE_DETACH", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "ON_FORCE_CLOSE_UNSPECIFIED" => Some(Self::Unspecified), + "ON_FORCE_CLOSE_QUIT" => Some(Self::Quit), + "ON_FORCE_CLOSE_DETACH" => Some(Self::Detach), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Clipboard { + Unspecified = 0, + System = 1, + Primary = 2, +} +impl Clipboard { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Clipboard::Unspecified => "CLIPBOARD_UNSPECIFIED", + Clipboard::System => "CLIPBOARD_SYSTEM", + Clipboard::Primary => "CLIPBOARD_PRIMARY", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "CLIPBOARD_UNSPECIFIED" => Some(Self::Unspecified), + "CLIPBOARD_SYSTEM" => Some(Self::System), + "CLIPBOARD_PRIMARY" => Some(Self::Primary), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StackDirection { + Unspecified = 0, + Horizontal = 1, + Vertical = 2, +} +impl StackDirection { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + StackDirection::Unspecified => "STACK_DIRECTION_UNSPECIFIED", + StackDirection::Horizontal => "STACK_DIRECTION_HORIZONTAL", + StackDirection::Vertical => "STACK_DIRECTION_VERTICAL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "STACK_DIRECTION_UNSPECIFIED" => Some(Self::Unspecified), + "STACK_DIRECTION_HORIZONTAL" => Some(Self::Horizontal), + "STACK_DIRECTION_VERTICAL" => Some(Self::Vertical), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum WebSharing { + Unspecified = 0, + On = 1, + Off = 2, + Disabled = 3, +} +impl WebSharing { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + WebSharing::Unspecified => "WEB_SHARING_UNSPECIFIED", + WebSharing::On => "WEB_SHARING_ON", + WebSharing::Off => "WEB_SHARING_OFF", + WebSharing::Disabled => "WEB_SHARING_DISABLED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { + match value { + "WEB_SHARING_UNSPECIFIED" => Some(Self::Unspecified), + "WEB_SHARING_ON" => Some(Self::On), + "WEB_SHARING_OFF" => Some(Self::Off), + "WEB_SHARING_DISABLED" => Some(Self::Disabled), + _ => None, + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerToClientMsg { + #[prost(oneof="server_to_client_msg::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13")] + pub message: ::core::option::Option<server_to_client_msg::Message>, +} +/// Nested message and enum types in `ServerToClientMsg`. +pub mod server_to_client_msg { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Message { + #[prost(message, tag="1")] + Render(super::RenderMsg), + #[prost(message, tag="2")] + UnblockInputThread(super::UnblockInputThreadMsg), + #[prost(message, tag="3")] + Exit(super::ExitMsg), + #[prost(message, tag="4")] + Connected(super::ConnectedMsg), + #[prost(message, tag="5")] + Log(super::LogMsg), + #[prost(message, tag="6")] + LogError(super::LogErrorMsg), + #[prost(message, tag="7")] + SwitchSession(super::SwitchSessionMsg), + #[prost(message, tag="8")] + UnblockCliPipeInput(super::UnblockCliPipeInputMsg), + #[prost(message, tag="9")] + CliPipeOutput(super::CliPipeOutputMsg), + #[prost(message, tag="10")] + QueryTerminalSize(super::QueryTerminalSizeMsg), + #[prost(message, tag="11")] + StartWebServer(super::StartWebServerMsg), + #[prost(message, tag="12")] + RenamedSession(super::RenamedSessionMsg), + #[prost(message, tag="13")] + ConfigFileUpdated(super::ConfigFileUpdatedMsg), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenderMsg { + #[prost(string, tag="1")] + pub content: ::prost::alloc::string::String, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnblockInputThreadMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExitMsg { + #[prost(enumeration="ExitReason", tag="1")] + pub exit_reason: i32, + #[prost(string, optional, tag="2")] + pub payload: ::core::option::Option<::prost::alloc::string::String>, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConnectedMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LogMsg { + #[prost(string, repeated, tag="1")] + pub lines: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LogErrorMsg { + #[prost(string, repeated, tag="1")] + pub lines: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchSessionMsg { + #[prost(message, optional, tag="1")] + pub connect_to_session: ::core::option::Option<ConnectToSession>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnblockCliPipeInputMsg { + #[prost(string, tag="1")] + pub pipe_name: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CliPipeOutputMsg { + #[prost(string, tag="1")] + pub pipe_name: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub output: ::prost::alloc::string::String, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTerminalSizeMsg { +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartWebServerMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenamedSessionMsg { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigFileUpdatedMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClientToServerMsg { + #[prost(oneof="client_to_server_msg::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15")] + pub message: ::core::option::Option<client_to_server_msg::Message>, +} +/// Nested message and enum types in `ClientToServerMsg`. +pub mod client_to_server_msg { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Message { + #[prost(message, tag="1")] + DetachSession(super::DetachSessionMsg), + #[prost(message, tag="2")] + TerminalPixelDimensions(super::TerminalPixelDimensionsMsg), + #[prost(message, tag="3")] + BackgroundColor(super::BackgroundColorMsg), + #[prost(message, tag="4")] + ForegroundColor(super::ForegroundColorMsg), + #[prost(message, tag="5")] + ColorRegisters(super::ColorRegistersMsg), + #[prost(message, tag="6")] + TerminalResize(super::TerminalResizeMsg), + #[prost(message, tag="7")] + FirstClientConnected(super::FirstClientConnectedMsg), + #[prost(message, tag="8")] + AttachClient(super::AttachClientMsg), + #[prost(message, tag="9")] + Action(super::ActionMsg), + #[prost(message, tag="10")] + Key(super::KeyMsg), + #[prost(message, tag="11")] + ClientExited(super::ClientExitedMsg), + #[prost(message, tag="12")] + KillSession(super::KillSessionMsg), + #[prost(message, tag="13")] + ConnStatus(super::ConnStatusMsg), + #[prost(message, tag="14")] + WebServerStarted(super::WebServerStartedMsg), + #[prost(message, tag="15")] + FailedToStartWebServer(super::FailedToStartWebServerMsg), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DetachSessionMsg { + #[prost(uint32, repeated, tag="1")] + pub client_ids: ::prost::alloc::vec::Vec<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TerminalPixelDimensionsMsg { + #[prost(message, optional, tag="1")] + pub pixel_dimensions: ::core::option::Option<PixelDimensions>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BackgroundColorMsg { + #[prost(string, tag="1")] + pub color: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ForegroundColorMsg { + #[prost(string, tag="1")] + pub color: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ColorRegistersMsg { + #[prost(message, repeated, tag="1")] + pub color_registers: ::prost::alloc::vec::Vec<ColorRegister>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TerminalResizeMsg { + #[prost(message, optional, tag="1")] + pub new_size: ::core::option::Option<Size>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FirstClientConnectedMsg { + #[prost(message, optional, tag="1")] + pub cli_assets: ::core::option::Option<CliAssets>, + #[prost(bool, tag="2")] + pub is_web_client: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AttachClientMsg { + #[prost(message, optional, tag="1")] + pub cli_assets: ::core::option::Option<CliAssets>, + #[prost(uint32, optional, tag="2")] + pub tab_position_to_focus: ::core::option::Option<u32>, + #[prost(message, optional, tag="3")] + pub pane_to_focus: ::core::option::Option<PaneReference>, + #[prost(bool, tag="4")] + pub is_web_client: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionMsg { + #[prost(message, optional, tag="1")] + pub action: ::core::option::Option<Action>, + #[prost(uint32, optional, tag="2")] + pub terminal_id: ::core::option::Option<u32>, + #[prost(uint32, optional, tag="3")] + pub client_id: ::core::option::Option<u32>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KeyMsg { + #[prost(message, optional, tag="1")] + pub key: ::core::option::Option<KeyWithModifier>, + #[prost(uint32, repeated, tag="2")] + pub raw_bytes: ::prost::alloc::vec::Vec<u32>, + #[prost(bool, tag="3")] + pub is_kitty_keyboard_protocol: bool, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClientExitedMsg { +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KillSessionMsg { +} +/// Empty message (just indicates connection status request) +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConnStatusMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WebServerStartedMsg { + #[prost(string, tag="1")] + pub base_url: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FailedToStartWebServerMsg { + #[prost(string, tag="1")] + pub error: ::prost::alloc::string::String, +} diff --git a/zellij-utils/assets/prost_ipc/generated_client_server_api.rs b/zellij-utils/assets/prost_ipc/generated_client_server_api.rs new file mode 100644 index 00000000..8370cdbf --- /dev/null +++ b/zellij-utils/assets/prost_ipc/generated_client_server_api.rs @@ -0,0 +1,3 @@ +pub mod client_server_contract { + include!("client_server_contract.rs"); +} diff --git a/zellij-utils/assets/prost_web_server/generated_web_server_api.rs b/zellij-utils/assets/prost_web_server/generated_web_server_api.rs new file mode 100644 index 00000000..74643583 --- /dev/null +++ b/zellij-utils/assets/prost_web_server/generated_web_server_api.rs @@ -0,0 +1,3 @@ +pub mod web_server_contract { + include!("web_server_contract.rs"); +} diff --git a/zellij-utils/assets/prost_web_server/web_server_contract.rs b/zellij-utils/assets/prost_web_server/web_server_contract.rs new file mode 100644 index 00000000..c2e4dda5 --- /dev/null +++ b/zellij-utils/assets/prost_web_server/web_server_contract.rs @@ -0,0 +1,23 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InstructionForWebServer { + #[prost(oneof="instruction_for_web_server::Instruction", tags="1")] + pub instruction: ::core::option::Option<instruction_for_web_server::Instruction>, +} +/// Nested message and enum types in `InstructionForWebServer`. +pub mod instruction_for_web_server { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Instruction { + /// Future commands can be added here + /// RestartWebServerMsg restart_web_server = 2; + /// ReloadConfigMsg reload_config = 3; + #[prost(message, tag="1")] + ShutdownWebServer(super::ShutdownWebServerMsg), + } +} +/// Empty for now, but allows for future parameters like graceful timeout +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ShutdownWebServerMsg { +} diff --git a/zellij-utils/src/client_server_contract/client_to_server.proto b/zellij-utils/src/client_server_contract/client_to_server.proto new file mode 100644 index 00000000..f9b01994 --- /dev/null +++ b/zellij-utils/src/client_server_contract/client_to_server.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; +package client_server_contract; + +import "common_types.proto"; + +message ClientToServerMsg { + oneof message { + DetachSessionMsg detach_session = 1; + TerminalPixelDimensionsMsg terminal_pixel_dimensions = 2; + BackgroundColorMsg background_color = 3; + ForegroundColorMsg foreground_color = 4; + ColorRegistersMsg color_registers = 5; + TerminalResizeMsg terminal_resize = 6; + FirstClientConnectedMsg first_client_connected = 7; + AttachClientMsg attach_client = 8; + ActionMsg action = 9; + KeyMsg key = 10; + ClientExitedMsg client_exited = 11; + KillSessionMsg kill_session = 12; + ConnStatusMsg conn_status = 13; + WebServerStartedMsg web_server_started = 14; + FailedToStartWebServerMsg failed_to_start_web_server = 15; + } +} + +message DetachSessionMsg { + repeated uint32 client_ids = 1; +} + +message TerminalPixelDimensionsMsg { + PixelDimensions pixel_dimensions = 1; +} + +message BackgroundColorMsg { + string color = 1; +} + +message ForegroundColorMsg { + string color = 1; +} + +message ColorRegistersMsg { + repeated ColorRegister color_registers = 1; +} + +message TerminalResizeMsg { + Size new_size = 1; +} + +message FirstClientConnectedMsg { + CliAssets cli_assets = 1; + bool is_web_client = 2; +} + +message AttachClientMsg { + CliAssets cli_assets = 1; + optional uint32 tab_position_to_focus = 2; + optional PaneReference pane_to_focus = 3; + bool is_web_client = 4; +} + +message ActionMsg { + Action action = 1; + optional uint32 terminal_id = 2; + optional uint32 client_id = 3; +} + +message KeyMsg { + KeyWithModifier key = 1; + repeated uint32 raw_bytes = 2; + bool is_kitty_keyboard_protocol = 3; +} + +message ClientExitedMsg { + // Empty message +} + +message KillSessionMsg { + // Empty message +} + +message ConnStatusMsg { + // Empty message (just indicates connection status request) +} + +message WebServerStartedMsg { + string base_url = 1; +} + +message FailedToStartWebServerMsg { + string error = 1; +} diff --git a/zellij-utils/src/client_server_contract/common_types.proto b/zellij-utils/src/client_server_contract/common_types.proto new file mode 100644 index 00000000..be86e0d1 --- /dev/null +++ b/zellij-utils/src/client_server_contract/common_types.proto @@ -0,0 +1,922 @@ +syntax = "proto3"; +package client_server_contract; + +message Size { + uint32 cols = 1; + uint32 rows = 2; +} + +message PixelDimensions { + optional SizeInPixels text_area_size = 1; + optional SizeInPixels character_cell_size = 2; +} + +message SizeInPixels { + uint32 width = 1; + uint32 height = 2; +} + +message PaneReference { + uint32 pane_id = 1; + bool is_plugin = 2; +} + +message ColorRegister { + uint32 index = 1; + string color = 2; +} + +message KeyWithModifier { + BareKey bare_key = 1; + repeated KeyModifier key_modifiers = 2; + optional string character = 3; // Only set when bare_key is CHAR +} + +enum BareKey { + BARE_KEY_UNSPECIFIED = 0; + BARE_KEY_PAGE_DOWN = 1; + BARE_KEY_PAGE_UP = 2; + BARE_KEY_LEFT = 3; + BARE_KEY_DOWN = 4; + BARE_KEY_UP = 5; + BARE_KEY_RIGHT = 6; + BARE_KEY_HOME = 7; + BARE_KEY_END = 8; + BARE_KEY_BACKSPACE = 9; + BARE_KEY_DELETE = 10; + BARE_KEY_INSERT = 11; + BARE_KEY_F1 = 12; + BARE_KEY_F2 = 13; + BARE_KEY_F3 = 14; + BARE_KEY_F4 = 15; + BARE_KEY_F5 = 16; + BARE_KEY_F6 = 17; + BARE_KEY_F7 = 18; + BARE_KEY_F8 = 19; + BARE_KEY_F9 = 20; + BARE_KEY_F10 = 21; + BARE_KEY_F11 = 22; + BARE_KEY_F12 = 23; + BARE_KEY_CHAR = 24; + BARE_KEY_TAB = 25; + BARE_KEY_ESC = 26; + BARE_KEY_ENTER = 27; + BARE_KEY_CAPS_LOCK = 28; + BARE_KEY_SCROLL_LOCK = 29; + BARE_KEY_NUM_LOCK = 30; + BARE_KEY_PRINT_SCREEN = 31; + BARE_KEY_PAUSE = 32; + BARE_KEY_MENU = 33; +} + +message CharKey { + string character = 1; +} + +message FunctionKey { + uint32 function_number = 1; +} + +enum KeyModifier { + KEY_MODIFIER_UNSPECIFIED = 0; + KEY_MODIFIER_CTRL = 1; + KEY_MODIFIER_ALT = 2; + KEY_MODIFIER_SHIFT = 3; + KEY_MODIFIER_SUPER = 4; +} + +message Style { + Styling colors = 1; + bool rounded_corners = 2; + bool hide_session_name = 3; +} + +message Styling { + PaletteColor base = 1; + PaletteColor background = 2; + PaletteColor emphasis_0 = 3; + PaletteColor emphasis_1 = 4; + PaletteColor emphasis_2 = 5; + PaletteColor emphasis_3 = 6; +} + +message PaletteColor { + oneof color_type { + RgbColor rgb = 1; + uint32 eight_bit = 2; + AnsiCode ansi = 3; + } +} + +message RgbColor { + uint32 r = 1; + uint32 g = 2; + uint32 b = 3; +} + +enum AnsiCode { + ANSI_CODE_UNSPECIFIED = 0; + BLACK = 1; + RED = 2; + GREEN = 3; + YELLOW = 4; + BLUE = 5; + MAGENTA = 6; + CYAN = 7; + WHITE = 8; + BRIGHT_BLACK = 9; + BRIGHT_RED = 10; + BRIGHT_GREEN = 11; + BRIGHT_YELLOW = 12; + BRIGHT_BLUE = 13; + BRIGHT_MAGENTA = 14; + BRIGHT_CYAN = 15; + BRIGHT_WHITE = 16; +} + +message Action { + oneof action_type { + QuitAction quit = 1; + WriteAction write = 2; + WriteCharsAction write_chars = 3; + SwitchToModeAction switch_to_mode = 4; + SwitchModeForAllClientsAction switch_mode_for_all_clients = 5; + ResizeAction resize = 6; + FocusNextPaneAction focus_next_pane = 7; + FocusPreviousPaneAction focus_previous_pane = 8; + SwitchFocusAction switch_focus = 9; + MoveFocusAction move_focus = 10; + MoveFocusOrTabAction move_focus_or_tab = 11; + MovePaneAction move_pane = 12; + MovePaneBackwardsAction move_pane_backwards = 13; + ClearScreenAction clear_screen = 14; + DumpScreenAction dump_screen = 15; + DumpLayoutAction dump_layout = 16; + EditScrollbackAction edit_scrollback = 17; + ScrollUpAction scroll_up = 18; + ScrollUpAtAction scroll_up_at = 19; + ScrollDownAction scroll_down = 20; + ScrollDownAtAction scroll_down_at = 21; + ScrollToBottomAction scroll_to_bottom = 22; + ScrollToTopAction scroll_to_top = 23; + PageScrollUpAction page_scroll_up = 24; + PageScrollDownAction page_scroll_down = 25; + HalfPageScrollUpAction half_page_scroll_up = 26; + HalfPageScrollDownAction half_page_scroll_down = 27; + ToggleFocusFullscreenAction toggle_focus_fullscreen = 28; + TogglePaneFramesAction toggle_pane_frames = 29; + ToggleActiveSyncTabAction toggle_active_sync_tab = 30; + NewPaneAction new_pane = 31; + EditFileAction edit_file = 32; + NewFloatingPaneAction new_floating_pane = 33; + NewTiledPaneAction new_tiled_pane = 34; + NewInPlacePaneAction new_in_place_pane = 35; + NewStackedPaneAction new_stacked_pane = 36; + TogglePaneEmbedOrFloatingAction toggle_pane_embed_or_floating = 37; + ToggleFloatingPanesAction toggle_floating_panes = 38; + CloseFocusAction close_focus = 39; + PaneNameInputAction pane_name_input = 40; + UndoRenamePaneAction undo_rename_pane = 41; + NewTabAction new_tab = 42; + NoOpAction no_op = 43; + GoToNextTabAction go_to_next_tab = 44; + GoToPreviousTabAction go_to_previous_tab = 45; + CloseTabAction close_tab = 46; + GoToTabAction go_to_tab = 47; + GoToTabNameAction go_to_tab_name = 48; + ToggleTabAction toggle_tab = 49; + TabNameInputAction tab_name_input = 50; + UndoRenameTabAction undo_rename_tab = 51; + MoveTabAction move_tab = 52; + RunAction run = 53; + DetachAction detach = 54; + LaunchOrFocusPluginAction launch_or_focus_plugin = 55; + LaunchPluginAction launch_plugin = 56; + MouseEventAction mouse_event = 57; + CopyAction copy = 58; + ConfirmAction confirm = 59; + DenyAction deny = 60; + SkipConfirmAction skip_confirm = 61; + SearchInputAction search_input = 62; + SearchAction search = 63; + SearchToggleOptionAction search_toggle_option = 64; + ToggleMouseModeAction toggle_mouse_mode = 65; + PreviousSwapLayoutAction previous_swap_layout = 66; + NextSwapLayoutAction next_swap_layout = 67; + QueryTabNamesAction query_tab_names = 68; + NewTiledPluginPaneAction new_tiled_plugin_pane = 69; + NewFloatingPluginPaneAction new_floating_plugin_pane = 70; + NewInPlacePluginPaneAction new_in_place_plugin_pane = 71; + StartOrReloadPluginAction start_or_reload_plugin = 72; + CloseTerminalPaneAction close_terminal_pane = 73; + ClosePluginPaneAction close_plugin_pane = 74; + FocusTerminalPaneWithIdAction focus_terminal_pane_with_id = 75; + FocusPluginPaneWithIdAction focus_plugin_pane_with_id = 76; + RenameTerminalPaneAction rename_terminal_pane = 77; + RenamePluginPaneAction rename_plugin_pane = 78; + RenameTabAction rename_tab = 79; + BreakPaneAction break_pane = 80; + BreakPaneRightAction break_pane_right = 81; + BreakPaneLeftAction break_pane_left = 82; + RenameSessionAction rename_session = 83; + CliPipeAction cli_pipe = 84; + KeybindPipeAction keybind_pipe = 85; + ListClientsAction list_clients = 86; + TogglePanePinnedAction toggle_pane_pinned = 87; + StackPanesAction stack_panes = 88; + ChangeFloatingPaneCoordinatesAction change_floating_pane_coordinates = 89; + TogglePaneInGroupAction toggle_pane_in_group = 90; + ToggleGroupMarkingAction toggle_group_marking = 91; + } +} + +// Action message definitions (all 91 variants) + +// Simple action types (no data) +message QuitAction {} +message FocusNextPaneAction {} +message FocusPreviousPaneAction {} +message SwitchFocusAction {} +message MovePaneBackwardsAction {} +message ClearScreenAction {} +message DumpLayoutAction {} +message EditScrollbackAction {} +message ScrollUpAction {} +message ScrollDownAction {} +message ScrollToBottomAction {} +message ScrollToTopAction {} +message PageScrollUpAction {} +message PageScrollDownAction {} +message HalfPageScrollUpAction {} +message HalfPageScrollDownAction {} +message ToggleFocusFullscreenAction {} +message TogglePaneFramesAction {} +message ToggleActiveSyncTabAction {} +message TogglePaneEmbedOrFloatingAction {} +message ToggleFloatingPanesAction {} +message CloseFocusAction {} +message UndoRenamePaneAction {} +message NoOpAction {} +message GoToNextTabAction {} +message GoToPreviousTabAction {} +message CloseTabAction {} +message ToggleTabAction {} +message UndoRenameTabAction {} +message DetachAction {} +message CopyAction {} +message ConfirmAction {} +message DenyAction {} +message ToggleMouseModeAction {} +message PreviousSwapLayoutAction {} +message NextSwapLayoutAction {} +message QueryTabNamesAction {} +message BreakPaneAction {} +message BreakPaneRightAction {} +message BreakPaneLeftAction {} +message ListClientsAction {} +message TogglePanePinnedAction {} +message TogglePaneInGroupAction {} +message ToggleGroupMarkingAction {} + +// Complex action types (with data) +message WriteAction { + optional KeyWithModifier key_with_modifier = 1; + repeated uint32 bytes = 2; + bool is_kitty_keyboard_protocol = 3; +} + +message WriteCharsAction { + string chars = 1; +} + +message SwitchToModeAction { + InputMode input_mode = 1; +} + +message SwitchModeForAllClientsAction { + InputMode input_mode = 1; +} + +message ResizeAction { + ResizeType resize = 1; + optional Direction direction = 2; +} + +message MoveFocusAction { + Direction direction = 1; +} + +message MoveFocusOrTabAction { + Direction direction = 1; +} + +message MovePaneAction { + optional Direction direction = 1; +} + +message DumpScreenAction { + string file_path = 1; + bool include_scrollback = 2; +} + +message ScrollUpAtAction { + Position position = 1; +} + +message ScrollDownAtAction { + Position position = 1; +} + +message NewPaneAction { + optional Direction direction = 1; + optional string pane_name = 2; + bool start_suppressed = 3; +} + +message EditFileAction { + OpenFilePayload payload = 1; + optional Direction direction = 2; + bool floating = 3; + bool in_place = 4; + bool start_suppressed = 5; + optional FloatingPaneCoordinates coordinates = 6; +} + +message NewFloatingPaneAction { + optional RunCommandAction command = 1; + optional string pane_name = 2; + optional FloatingPaneCoordinates coordinates = 3; +} + +message NewTiledPaneAction { + optional Direction direction = 1; + optional RunCommandAction command = 2; + optional string pane_name = 3; +} + +message NewInPlacePaneAction { + optional RunCommandAction command = 1; + optional string pane_name = 2; +} + +message NewStackedPaneAction { + optional RunCommandAction command = 1; + optional string pane_name = 2; +} + +message PaneNameInputAction { + repeated uint32 input = 1; +} + +message NewTabAction { + optional TiledPaneLayout tiled_layout = 1; + repeated FloatingPaneLayout floating_layouts = 2; + repeated SwapTiledLayout swap_tiled_layouts = 3; + repeated SwapFloatingLayout swap_floating_layouts = 4; + optional string tab_name = 5; + bool should_change_focus_to_new_tab = 6; + optional string cwd = 7; +} + +message GoToTabAction { + uint32 index = 1; +} + +message GoToTabNameAction { + string name = 1; + bool create = 2; +} + +message TabNameInputAction { + repeated uint32 input = 1; +} + +message MoveTabAction { + Direction direction = 1; +} + +message RunAction { + RunCommandAction command = 1; +} + +message LaunchOrFocusPluginAction { + RunPluginOrAlias plugin = 1; + bool should_float = 2; + bool move_to_focused_tab = 3; + bool should_open_in_place = 4; + bool skip_cache = 5; +} + +message LaunchPluginAction { + RunPluginOrAlias plugin = 1; + bool should_float = 2; + bool should_open_in_place = 3; + bool skip_cache = 4; + optional string cwd = 5; +} + +message MouseEventAction { + MouseEvent event = 1; +} + +message SkipConfirmAction { + Action action = 1; +} + +message SearchInputAction { + repeated uint32 input = 1; +} + +message SearchAction { + SearchDirection direction = 1; +} + +message SearchToggleOptionAction { + SearchOption option = 1; +} + +message NewTiledPluginPaneAction { + RunPluginOrAlias plugin = 1; + optional string pane_name = 2; + bool skip_cache = 3; + optional string cwd = 4; +} + +message NewFloatingPluginPaneAction { + RunPluginOrAlias plugin = 1; + optional string pane_name = 2; + bool skip_cache = 3; + optional string cwd = 4; + optional FloatingPaneCoordinates coordinates = 5; +} + +message NewInPlacePluginPaneAction { + RunPluginOrAlias plugin = 1; + optional string pane_name = 2; + bool skip_cache = 3; +} + +message StartOrReloadPluginAction { + RunPluginOrAlias plugin = 1; +} + +message CloseTerminalPaneAction { + uint32 pane_id = 1; +} + +message ClosePluginPaneAction { + uint32 pane_id = 1; +} + +message FocusTerminalPaneWithIdAction { + uint32 pane_id = 1; + bool should_float_if_hidden = 2; +} + +message FocusPluginPaneWithIdAction { + uint32 pane_id = 1; + bool should_float_if_hidden = 2; +} + +message RenameTerminalPaneAction { + uint32 pane_id = 1; + repeated uint32 name = 2; +} + +message RenamePluginPaneAction { + uint32 pane_id = 1; + repeated uint32 name = 2; +} + +message RenameTabAction { + uint32 tab_index = 1; + repeated uint32 name = 2; +} + +message RenameSessionAction { + string name = 1; +} + +message CliPipeAction { + string pipe_id = 1; + optional string name = 2; + optional string payload = 3; + map<string, string> args = 4; + optional string plugin = 5; + map<string, string> configuration = 6; + bool launch_new = 7; + bool skip_cache = 8; + optional bool floating = 9; + optional bool in_place = 10; + optional string cwd = 11; + optional string pane_title = 12; +} + +message KeybindPipeAction { + optional string name = 1; + optional string payload = 2; + map<string, string> args = 3; + optional string plugin = 4; + optional uint32 plugin_id = 5; + map<string, string> configuration = 6; + bool launch_new = 7; + bool skip_cache = 8; + optional bool floating = 9; + optional bool in_place = 10; + optional string cwd = 11; + optional string pane_title = 12; +} + +message StackPanesAction { + repeated PaneId pane_ids = 1; +} + +message ChangeFloatingPaneCoordinatesAction { + PaneId pane_id = 1; + FloatingPaneCoordinates coordinates = 2; +} + +// Supporting enums and messages +enum InputMode { + INPUT_MODE_UNSPECIFIED = 0; + INPUT_MODE_NORMAL = 1; + INPUT_MODE_LOCKED = 2; + INPUT_MODE_RESIZE = 3; + INPUT_MODE_PANE = 4; + INPUT_MODE_TAB = 5; + INPUT_MODE_SCROLL = 6; + INPUT_MODE_ENTER_SEARCH = 7; + INPUT_MODE_SEARCH = 8; + INPUT_MODE_RENAME_TAB = 9; + INPUT_MODE_RENAME_PANE = 10; + INPUT_MODE_SESSION = 11; + INPUT_MODE_MOVE = 12; + INPUT_MODE_PROMPT = 13; + INPUT_MODE_TMUX = 14; +} + +enum Direction { + DIRECTION_UNSPECIFIED = 0; + DIRECTION_LEFT = 1; + DIRECTION_RIGHT = 2; + DIRECTION_UP = 3; + DIRECTION_DOWN = 4; +} + +enum ResizeType { + RESIZE_TYPE_UNSPECIFIED = 0; + RESIZE_TYPE_INCREASE = 1; + RESIZE_TYPE_DECREASE = 2; +} + +message Position { + int32 line = 1; // Changed from uint32 to int32 to support negative line numbers + uint64 column = 2; // Changed from uint32 to uint64 to support large column numbers +} + +message CliAssets { + optional string config_file_path = 1; + optional string config_dir = 2; + bool should_ignore_config = 3; + optional Options configuration_options = 4; + optional LayoutInfo layout = 5; + Size terminal_window_size = 6; + optional string data_dir = 7; + bool is_debug = 8; + optional uint32 max_panes = 9; + bool force_run_layout_commands = 10; + optional string cwd = 11; +} + +message LayoutInfo { + oneof layout_type { + string file_path = 1; + string builtin_name = 2; + string url = 3; + string stringified = 4; + } +} + +message ConnectToSession { + optional string name = 1; + optional uint32 tab_position = 2; + optional PaneIdWithPlugin pane_id = 3; + optional LayoutInfo layout = 4; + optional string cwd = 5; +} + +message PaneIdWithPlugin { + uint32 pane_id = 1; + bool is_plugin = 2; +} + +enum ExitReason { + EXIT_REASON_UNSPECIFIED = 0; + EXIT_REASON_NORMAL = 1; + EXIT_REASON_NORMAL_DETACHED = 2; + EXIT_REASON_FORCE_DETACHED = 3; + EXIT_REASON_CANNOT_ATTACH = 4; + EXIT_REASON_DISCONNECT = 5; + EXIT_REASON_WEB_CLIENTS_FORBIDDEN = 6; + EXIT_REASON_ERROR = 7; +} + +// Additional supporting types for Action messages + +message OpenFilePayload { + string file_to_open = 1; + optional uint32 line_number = 2; + optional string cwd = 3; // Renumbered after removing column_number + optional OriginatingPlugin originating_plugin = 4; // Added missing originating_plugin field +} + +message FloatingPaneCoordinates { + optional FloatingCoordinate x = 1; + optional FloatingCoordinate y = 2; + optional FloatingCoordinate width = 3; + optional FloatingCoordinate height = 4; + optional bool pinned = 5; // Added missing pinned field +} + +message FloatingCoordinate { + oneof coordinate_type { + uint32 fixed = 1; + float percent = 2; + } +} + +message RunCommandAction { + string command = 1; + repeated string args = 2; + optional string cwd = 3; + optional Direction direction = 4; // Added missing direction field + bool hold_on_close = 5; // Renumbered + bool hold_on_start = 6; // Renumbered + optional OriginatingPlugin originating_plugin = 7; // Added missing originating_plugin field + bool use_terminal_title = 8; // Added missing use_terminal_title field +} + +message TiledPaneLayout { + SplitDirection children_split_direction = 1; + optional string name = 2; + repeated TiledPaneLayout children = 3; + optional SplitSize split_size = 4; + optional Run run = 5; + bool borderless = 6; + optional string focus = 7; + optional bool exclude_from_sync = 8; + bool children_are_stacked = 9; + optional uint32 external_children_index = 10; + bool is_expanded_in_stack = 11; + bool hide_floating_panes = 12; + optional string pane_initial_contents = 13; + // NOTE: run_instructions_to_ignore is not represented here because it's a field used only inside the server itself and not part of the server/client contract +} + +message FloatingPaneLayout { + optional string name = 1; + optional PercentOrFixed height = 2; + optional PercentOrFixed width = 3; + optional PercentOrFixed x = 4; + optional PercentOrFixed y = 5; + optional bool pinned = 6; + optional Run run = 7; + optional bool focus = 8; + bool already_running = 9; + optional string pane_initial_contents = 10; + optional uint32 logical_position = 11; +} + +message SwapTiledLayout { + repeated LayoutConstraintTiledPair constraint_map = 1; + optional string name = 2; +} + +message SwapFloatingLayout { + repeated LayoutConstraintFloatingPair constraint_map = 1; + optional string name = 2; +} + +message LayoutConstraintTiledPair { + LayoutConstraintWithValue constraint = 1; + TiledPaneLayout layout = 2; +} + +message LayoutConstraintFloatingPair { + LayoutConstraintWithValue constraint = 1; + repeated FloatingPaneLayout layouts = 2; +} + + +message RunPluginOrAlias { + oneof plugin_type { + RunPlugin plugin = 1; + PluginAlias alias = 2; + } +} + +message RunPlugin { + bool _allow_exec_host_cmd = 1; + RunPluginLocationData location = 2; + PluginUserConfiguration configuration = 3; + optional string initial_cwd = 4; +} + +message PluginAlias { + string name = 1; + optional PluginUserConfiguration configuration = 2; + optional string initial_cwd = 3; + optional RunPlugin run_plugin = 4; +} + +message MouseEvent { + MouseEventType event_type = 1; + bool left = 2; + bool right = 3; + bool middle = 4; + bool wheel_up = 5; + bool wheel_down = 6; + bool shift = 7; + bool alt = 8; + bool ctrl = 9; + Position position = 10; +} + +enum MouseEventType { + MOUSE_EVENT_TYPE_UNSPECIFIED = 0; + MOUSE_EVENT_TYPE_PRESS = 1; + MOUSE_EVENT_TYPE_RELEASE = 2; + MOUSE_EVENT_TYPE_MOTION = 3; +} + +// Note: Old MousePressEvent, MouseReleaseEvent, MouseHoldEvent, MouseScrollEvent, +// MouseButton, and ScrollDirection removed - replaced with unified MouseEvent structure + +enum SearchDirection { + SEARCH_DIRECTION_UNSPECIFIED = 0; + SEARCH_DIRECTION_DOWN = 1; // Changed from FORWARD to match Rust enum + SEARCH_DIRECTION_UP = 2; // Changed from BACKWARD to match Rust enum +} + +enum SearchOption { + SEARCH_OPTION_UNSPECIFIED = 0; + SEARCH_OPTION_CASE_SENSITIVITY = 1; // Changed from CASE_SENSITIVE to match Rust enum + SEARCH_OPTION_WHOLE_WORD = 2; // Changed from WHOLE_WORDS to match Rust enum + SEARCH_OPTION_WRAP = 3; // Unchanged - already matches +} + +message PaneId { + oneof pane_type { + uint32 terminal = 1; + uint32 plugin = 2; + } +} + +// Additional missing supporting types + +enum SplitDirection { + SPLIT_DIRECTION_UNSPECIFIED = 0; + SPLIT_DIRECTION_HORIZONTAL = 1; + SPLIT_DIRECTION_VERTICAL = 2; +} + +message SplitSize { + oneof size_type { + uint32 percent = 1; // 1 to 100 + uint32 fixed = 2; // absolute number + } +} + +message PercentOrFixed { + oneof size_type { + uint32 percent = 1; // 1 to 100 + uint32 fixed = 2; // absolute number + } +} + +enum LayoutConstraint { + LAYOUT_CONSTRAINT_UNSPECIFIED = 0; + LAYOUT_CONSTRAINT_MAX_PANES = 1; + LAYOUT_CONSTRAINT_MIN_PANES = 2; + LAYOUT_CONSTRAINT_EXACT_PANES = 3; + LAYOUT_CONSTRAINT_NO_CONSTRAINT = 4; +} + +message LayoutConstraintWithValue { + LayoutConstraint constraint_type = 1; + optional uint32 value = 2; // Only used for MAX_PANES, MIN_PANES, EXACT_PANES +} + +message PluginUserConfiguration { + map<string, string> configuration = 1; +} + +enum RunPluginLocation { + RUN_PLUGIN_LOCATION_UNSPECIFIED = 0; + RUN_PLUGIN_LOCATION_FILE = 1; + RUN_PLUGIN_LOCATION_ZELLIJ = 2; + RUN_PLUGIN_LOCATION_REMOTE = 3; +} + +message RunPluginLocationData { + RunPluginLocation location_type = 1; + oneof location_data { + string file_path = 2; // For FILE + PluginTag zellij_tag = 3; // For ZELLIJ + string remote_url = 4; // For REMOTE + } +} + +message PluginTag { + string tag = 1; +} + +message OriginatingPlugin { + uint32 plugin_id = 1; + uint32 client_id = 2; // ClientId is u16, but using uint32 for protobuf compatibility + map<string, string> context = 3; // Context is BTreeMap<String, String> +} + +message Run { + oneof run_type { + RunCommandAction command = 1; + RunPluginOrAlias plugin = 2; + RunEditFileAction edit_file = 3; + string cwd = 4; + } +} + +message RunEditFileAction { + string file_path = 1; + optional uint32 line_number = 2; + optional string cwd = 3; +} + +// Config Options message - comprehensive configuration structure + +message Options { + optional bool simplified_ui = 1; + optional string theme = 2; + optional InputMode default_mode = 3; + optional string default_shell = 4; + optional string default_cwd = 5; + optional string default_layout = 6; + optional string layout_dir = 7; + optional string theme_dir = 8; + optional bool mouse_mode = 9; + optional bool pane_frames = 10; + optional bool mirror_session = 11; + optional OnForceClose on_force_close = 12; + optional uint32 scroll_buffer_size = 13; + optional string copy_command = 14; + optional Clipboard copy_clipboard = 15; + optional bool copy_on_select = 16; + optional string scrollback_editor = 17; + optional string session_name = 18; + optional bool attach_to_session = 19; + optional bool auto_layout = 20; + optional bool session_serialization = 21; + optional bool serialize_pane_viewport = 22; + optional uint32 scrollback_lines_to_serialize = 23; + optional bool styled_underlines = 24; + optional uint64 serialization_interval = 25; + optional bool disable_session_metadata = 26; + optional bool support_kitty_keyboard_protocol = 27; + optional bool web_server = 28; + optional WebSharing web_sharing = 29; + optional bool stacked_resize = 30; + optional bool show_startup_tips = 31; + optional bool show_release_notes = 32; + optional bool advanced_mouse_actions = 33; + optional string web_server_ip = 34; + optional uint32 web_server_port = 35; + optional string web_server_cert = 36; + optional string web_server_key = 37; + optional bool enforce_https_for_localhost = 38; + optional string post_command_discovery_hook = 39; +} + +enum OnForceClose { + ON_FORCE_CLOSE_UNSPECIFIED = 0; + ON_FORCE_CLOSE_QUIT = 1; + ON_FORCE_CLOSE_DETACH = 2; +} + +enum Clipboard { + CLIPBOARD_UNSPECIFIED = 0; + CLIPBOARD_SYSTEM = 1; + CLIPBOARD_PRIMARY = 2; +} + +enum StackDirection { + STACK_DIRECTION_UNSPECIFIED = 0; + STACK_DIRECTION_HORIZONTAL = 1; + STACK_DIRECTION_VERTICAL = 2; +} + +enum WebSharing { + WEB_SHARING_UNSPECIFIED = 0; + WEB_SHARING_ON = 1; + WEB_SHARING_OFF = 2; + WEB_SHARING_DISABLED = 3; +} diff --git a/zellij-utils/src/client_server_contract/mod.rs b/zellij-utils/src/client_server_contract/mod.rs new file mode 100644 index 00000000..d5c35b33 --- /dev/null +++ b/zellij-utils/src/client_server_contract/mod.rs @@ -0,0 +1,4 @@ +include!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/assets/prost_ipc/generated_client_server_api.rs" +)); diff --git a/zellij-utils/src/client_server_contract/server_to_client.proto b/zellij-utils/src/client_server_contract/server_to_client.proto new file mode 100644 index 00000000..57813ebb --- /dev/null +++ b/zellij-utils/src/client_server_contract/server_to_client.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; +package client_server_contract; + +import "common_types.proto"; + +message ServerToClientMsg { + oneof message { + RenderMsg render = 1; + UnblockInputThreadMsg unblock_input_thread = 2; + ExitMsg exit = 3; + ConnectedMsg connected = 4; + LogMsg log = 5; + LogErrorMsg log_error = 6; + SwitchSessionMsg switch_session = 7; + UnblockCliPipeInputMsg unblock_cli_pipe_input = 8; + CliPipeOutputMsg cli_pipe_output = 9; + QueryTerminalSizeMsg query_terminal_size = 10; + StartWebServerMsg start_web_server = 11; + RenamedSessionMsg renamed_session = 12; + ConfigFileUpdatedMsg config_file_updated = 13; + } +} + +message RenderMsg { + string content = 1; +} + +message UnblockInputThreadMsg { + // Empty message +} + +message ExitMsg { + ExitReason exit_reason = 1; + optional string payload = 2; +} + +message ConnectedMsg { + // Empty message +} + +message LogMsg { + repeated string lines = 1; +} + +message LogErrorMsg { + repeated string lines = 1; +} + +message SwitchSessionMsg { + ConnectToSession connect_to_session = 1; +} + +message UnblockCliPipeInputMsg { + string pipe_name = 1; +} + +message CliPipeOutputMsg { + string pipe_name = 1; + string output = 2; +} + +message QueryTerminalSizeMsg { + // Empty message +} + +message StartWebServerMsg { + // Empty message +} + +message RenamedSessionMsg { + string name = 1; +} + +message ConfigFileUpdatedMsg { + // Empty message +} diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index ab1dfb31..4f5b729d 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -20,6 +20,8 @@ pub const SYSTEM_DEFAULT_DATA_DIR_PREFIX: &str = system_default_data_dir(); pub static ZELLIJ_DEFAULT_THEMES: Dir = include_dir!("$CARGO_MANIFEST_DIR/assets/themes"); +pub const CLIENT_SERVER_CONTRACT_VERSION: usize = 1; + pub fn session_info_cache_file_name(session_name: &str) -> PathBuf { session_info_folder_for_session(session_name).join("session-metadata.kdl") } @@ -57,6 +59,8 @@ const fn system_default_data_dir() -> &'static str { } lazy_static! { + pub static ref CLIENT_SERVER_CONTRACT_DIR: String = + format!("contract_version_{}", CLIENT_SERVER_CONTRACT_VERSION); pub static ref ZELLIJ_PROJ_DIR: ProjectDirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap(); pub static ref ZELLIJ_CACHE_DIR: PathBuf = ZELLIJ_PROJ_DIR.cache_dir().to_path_buf(); @@ -66,8 +70,9 @@ lazy_static! { .join(format!("{}", Uuid::new_v4())); pub static ref ZELLIJ_PLUGIN_PERMISSIONS_CACHE: PathBuf = ZELLIJ_CACHE_DIR.join("permissions.kdl"); - pub static ref ZELLIJ_SESSION_INFO_CACHE_DIR: PathBuf = - ZELLIJ_CACHE_DIR.join(VERSION).join("session_info"); + pub static ref ZELLIJ_SESSION_INFO_CACHE_DIR: PathBuf = ZELLIJ_CACHE_DIR + .join(CLIENT_SERVER_CONTRACT_DIR.clone()) + .join("session_info"); pub static ref ZELLIJ_STDIN_CACHE_FILE: PathBuf = ZELLIJ_CACHE_DIR.join(VERSION).join("stdin_cache"); pub static ref ZELLIJ_PLUGIN_ARTIFACT_DIR: PathBuf = ZELLIJ_CACHE_DIR.join(VERSION); @@ -166,7 +171,7 @@ mod unix_only { }, PathBuf::from, ); - ipc_dir.push(VERSION); + ipc_dir.push(CLIENT_SERVER_CONTRACT_DIR.clone()); ipc_dir }; pub static ref WEBSERVER_SOCKET_PATH: PathBuf = ZELLIJ_SOCK_DIR.join("web_server_bus"); diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index 6cdac7f1..3328e1de 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -2084,7 +2084,7 @@ impl MessageToPlugin { } } -#[derive(Debug, Default, Clone, Serialize, Deserialize)] +#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)] pub struct ConnectToSession { pub name: Option<String>, pub tab_position: Option<usize>, diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index 5f2b2af0..fa5374f0 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -31,6 +31,7 @@ pub enum ResizeDirection { Increase, Decrease, } + impl FromStr for ResizeDirection { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { @@ -103,41 +104,67 @@ pub enum Action { /// Quit Zellij. Quit, /// Write to the terminal. - Write(Option<KeyWithModifier>, Vec<u8>, bool), // bool -> is_kitty_keyboard_protocol + Write { + key_with_modifier: Option<KeyWithModifier>, + bytes: Vec<u8>, + is_kitty_keyboard_protocol: bool, + }, /// Write Characters to the terminal. - WriteChars(String), + WriteChars { + chars: String, + }, /// Switch to the specified input mode. - SwitchToMode(InputMode), + SwitchToMode { + input_mode: InputMode, + }, /// Switch all connected clients to the specified input mode. - SwitchModeForAllClients(InputMode), + SwitchModeForAllClients { + input_mode: InputMode, + }, /// Shrink/enlarge focused pane at specified border - Resize(Resize, Option<Direction>), + Resize { + resize: Resize, + direction: Option<Direction>, + }, /// Switch focus to next pane in specified direction. FocusNextPane, FocusPreviousPane, /// Move the focus pane in specified direction. SwitchFocus, - MoveFocus(Direction), + MoveFocus { + direction: Direction, + }, /// Tries to move the focus pane in specified direction. /// If there is no pane in the direction, move to previous/next Tab. - MoveFocusOrTab(Direction), - MovePane(Option<Direction>), + MoveFocusOrTab { + direction: Direction, + }, + MovePane { + direction: Option<Direction>, + }, MovePaneBackwards, /// Clear all buffers of a current screen ClearScreen, /// Dumps the screen to a file - DumpScreen(String, bool), + DumpScreen { + file_path: String, + include_scrollback: bool, + }, /// Dumps DumpLayout, /// Scroll up in focus pane. EditScrollback, ScrollUp, /// Scroll up at point - ScrollUpAt(Position), + ScrollUpAt { + position: Position, + }, /// Scroll down in focus pane. ScrollDown, /// Scroll down at point - ScrollDownAt(Position), + ScrollDownAt { + position: Position, + }, /// Scroll down to bottom in focus pane. ScrollToBottom, /// Scroll up to top in focus pane. @@ -158,49 +185,61 @@ pub enum Action { ToggleActiveSyncTab, /// Open a new pane in the specified direction (relative to focus). /// If no direction is specified, will try to use the biggest available space. - NewPane(Option<Direction>, Option<String>, bool), // String is an optional pane name - /// Open the file in a new pane using the default editor, bool -> start suppressed - EditFile( - OpenFilePayload, - Option<Direction>, - bool, - bool, - bool, - Option<FloatingPaneCoordinates>, - ), // bool is floating true/false, second bool is in_place - // third bool is start_suppressed + NewPane { + direction: Option<Direction>, + pane_name: Option<String>, + start_suppressed: bool, + }, + /// Open the file in a new pane using the default editor + EditFile { + payload: OpenFilePayload, + direction: Option<Direction>, + floating: bool, + in_place: bool, + start_suppressed: bool, + coordinates: Option<FloatingPaneCoordinates>, + }, /// Open a new floating pane - NewFloatingPane( - Option<RunCommandAction>, - Option<String>, - Option<FloatingPaneCoordinates>, - ), // String is an optional pane name + NewFloatingPane { + command: Option<RunCommandAction>, + pane_name: Option<String>, + coordinates: Option<FloatingPaneCoordinates>, + }, /// Open a new tiled (embedded, non-floating) pane - NewTiledPane(Option<Direction>, Option<RunCommandAction>, Option<String>), // String is an + NewTiledPane { + direction: Option<Direction>, + command: Option<RunCommandAction>, + pane_name: Option<String>, + }, /// Open a new pane in place of the focused one, suppressing it instead - NewInPlacePane(Option<RunCommandAction>, Option<String>), // String is an - // optional pane - NewStackedPane(Option<RunCommandAction>, Option<String>), // String is an - // optional pane - // name + NewInPlacePane { + command: Option<RunCommandAction>, + pane_name: Option<String>, + }, + NewStackedPane { + command: Option<RunCommandAction>, + pane_name: Option<String>, + }, /// Embed focused pane in tab if floating or float focused pane if embedded TogglePaneEmbedOrFloating, /// Toggle the visibility of all floating panes (if any) in the current Tab ToggleFloatingPanes, /// Close the focus pane. CloseFocus, - PaneNameInput(Vec<u8>), + PaneNameInput { + input: Vec<u8>, + }, UndoRenamePane, /// Create a new tab, optionally with a specified tab layout. - NewTab( - Option<TiledPaneLayout>, - Vec<FloatingPaneLayout>, - Option<Vec<SwapTiledLayout>>, - Option<Vec<SwapFloatingLayout>>, - Option<String>, - bool, // should_change_focus_to_new_tab - Option<PathBuf>, // cwd - ), // the String is the tab name + NewTab { + tiled_layout: Option<TiledPaneLayout>, + floating_layouts: Vec<FloatingPaneLayout>, + swap_tiled_layouts: Option<Vec<SwapTiledLayout>>, + swap_floating_layouts: Option<Vec<SwapFloatingLayout>>, + tab_name: Option<String>, + should_change_focus_to_new_tab: bool, + cwd: Option<PathBuf>, + }, /// Do nothing. NoOp, /// Go to the next tab. @@ -209,64 +248,124 @@ pub enum Action { GoToPreviousTab, /// Close the current tab. CloseTab, - GoToTab(u32), - GoToTabName(String, bool), + GoToTab { + index: u32, + }, + GoToTabName { + name: String, + create: bool, + }, ToggleTab, - TabNameInput(Vec<u8>), + TabNameInput { + input: Vec<u8>, + }, UndoRenameTab, - MoveTab(Direction), + MoveTab { + direction: Direction, + }, /// Run specified command in new pane. - Run(RunCommandAction), + Run { + command: RunCommandAction, + }, /// Detach session and exit Detach, - LaunchOrFocusPlugin(RunPluginOrAlias, bool, bool, bool, bool), // bools => should float, - // move_to_focused_tab, should_open_in_place, skip_cache - LaunchPlugin(RunPluginOrAlias, bool, bool, bool, Option<PathBuf>), // bools => should float, - // should_open_in_place, skip_cache, Option<PathBuf> is cwd - MouseEvent(MouseEvent), + LaunchOrFocusPlugin { + plugin: RunPluginOrAlias, + should_float: bool, + move_to_focused_tab: bool, + should_open_in_place: bool, + skip_cache: bool, + }, + LaunchPlugin { + plugin: RunPluginOrAlias, + should_float: bool, + should_open_in_place: bool, + skip_cache: bool, + cwd: Option<PathBuf>, + }, + MouseEvent { + event: MouseEvent, + }, Copy, /// Confirm a prompt Confirm, /// Deny a prompt Deny, /// Confirm an action that invokes a prompt automatically - SkipConfirm(Box<Action>), + SkipConfirm { + action: Box<Action>, + }, /// Search for String - SearchInput(Vec<u8>), + SearchInput { + input: Vec<u8>, + }, /// Search for something - Search(SearchDirection), + Search { + direction: SearchDirection, + }, /// Toggle case sensitivity of search - SearchToggleOption(SearchOption), + SearchToggleOption { + option: SearchOption, + }, ToggleMouseMode, PreviousSwapLayout, NextSwapLayout, /// Query all tab names QueryTabNames, /// Open a new tiled (embedded, non-floating) plugin pane - NewTiledPluginPane(RunPluginOrAlias, Option<String>, bool, Option<PathBuf>), // String is an optional name, bool is - // skip_cache, Option<PathBuf> is cwd - NewFloatingPluginPane( - RunPluginOrAlias, - Option<String>, - bool, - Option<PathBuf>, - Option<FloatingPaneCoordinates>, - ), // String is an optional name, bool is - // skip_cache, Option<PathBuf> is cwd - NewInPlacePluginPane(RunPluginOrAlias, Option<String>, bool), // String is an optional name, bool is - // skip_cache - StartOrReloadPlugin(RunPluginOrAlias), - CloseTerminalPane(u32), - ClosePluginPane(u32), - FocusTerminalPaneWithId(u32, bool), // bool is should_float_if_hidden - FocusPluginPaneWithId(u32, bool), // bool is should_float_if_hidden - RenameTerminalPane(u32, Vec<u8>), - RenamePluginPane(u32, Vec<u8>), - RenameTab(u32, Vec<u8>), + NewTiledPluginPane { + plugin: RunPluginOrAlias, + pane_name: Option<String>, + skip_cache: bool, + cwd: Option<PathBuf>, + }, + NewFloatingPluginPane { + plugin: RunPluginOrAlias, + pane_name: Option<String>, + skip_cache: bool, + cwd: Option<PathBuf>, + coordinates: Option<FloatingPaneCoordinates>, + }, + NewInPlacePluginPane { + plugin: RunPluginOrAlias, + pane_name: Option<String>, + skip_cache: bool, + }, + StartOrReloadPlugin { + plugin: RunPluginOrAlias, + }, + CloseTerminalPane { + pane_id: u32, + }, + ClosePluginPane { + pane_id: u32, + }, + FocusTerminalPaneWithId { + pane_id: u32, + should_float_if_hidden: bool, + }, + FocusPluginPaneWithId { + pane_id: u32, + should_float_if_hidden: bool, + }, + RenameTerminalPane { + pane_id: u32, + name: Vec<u8>, + }, + RenamePluginPane { + pane_id: u32, + name: Vec<u8>, + }, + RenameTab { + tab_index: u32, + name: Vec<u8>, + }, BreakPane, BreakPaneRight, BreakPaneLeft, - RenameSession(String), + RenameSession { + name: String, + }, CliPipe { pipe_id: String, name: Option<String>, @@ -297,8 +396,13 @@ pub enum Action { }, ListClients, TogglePanePinned, - StackPanes(Vec<PaneId>), - ChangeFloatingPaneCoordinates(PaneId, FloatingPaneCoordinates), + StackPanes { + pane_ids: Vec<PaneId>, + }, + ChangeFloatingPaneCoordinates { + pane_id: PaneId, + coordinates: FloatingPaneCoordinates, + }, TogglePaneInGroup, ToggleGroupMarking, } @@ -307,9 +411,9 @@ impl Action { /// Checks that two Action are match except their mutable attributes. pub fn shallow_eq(&self, other_action: &Action) -> bool { match (self, other_action) { - (Action::NewTab(..), Action::NewTab(..)) => true, - (Action::LaunchOrFocusPlugin(..), Action::LaunchOrFocusPlugin(..)) => true, - (Action::LaunchPlugin(..), Action::LaunchPlugin(..)) => true, + (Action::NewTab { .. }, Action::NewTab { .. }) => true, + (Action::LaunchOrFocusPlugin { .. }, Action::LaunchOrFocusPlugin { .. }) => true, + (Action::LaunchPlugin { .. }, Action::LaunchPlugin { .. }) => true, _ => self == other_action, } } @@ -320,21 +424,29 @@ impl Action { config: Option<Config>, ) -> Result<Vec<Action>, String> { match cli_action { - CliAction::Write { bytes } => Ok(vec![Action::Write(None, bytes, false)]), - CliAction::WriteChars { chars } => Ok(vec![Action::WriteChars(chars)]), - CliAction::Resize { resize, direction } => Ok(vec![Action::Resize(resize, direction)]), + CliAction::Write { bytes } => Ok(vec![Action::Write { + key_with_modifier: None, + bytes, + is_kitty_keyboard_protocol: false, + }]), + CliAction::WriteChars { chars } => Ok(vec![Action::WriteChars { chars }]), + CliAction::Resize { resize, direction } => { + Ok(vec![Action::Resize { resize, direction }]) + }, CliAction::FocusNextPane => Ok(vec![Action::FocusNextPane]), CliAction::FocusPreviousPane => Ok(vec![Action::FocusPreviousPane]), - CliAction::MoveFocus { direction } => Ok(vec![Action::MoveFocus(direction)]), - CliAction::MoveFocusOrTab { direction } => Ok(vec![Action::MoveFocusOrTab(direction)]), - CliAction::MovePane { direction } => Ok(vec![Action::MovePane(direction)]), + CliAction::MoveFocus { direction } => Ok(vec![Action::MoveFocus { direction }]), + CliAction::MoveFocusOrTab { direction } => { + Ok(vec![Action::MoveFocusOrTab { direction }]) + }, + CliAction::MovePane { direction } => Ok(vec![Action::MovePane { direction }]), CliAction::MovePaneBackwards => Ok(vec![Action::MovePaneBackwards]), - CliAction::MoveTab { direction } => Ok(vec![Action::MoveTab(direction)]), + CliAction::MoveTab { direction } => Ok(vec![Action::MoveTab { direction }]), CliAction::Clear => Ok(vec![Action::ClearScreen]), - CliAction::DumpScreen { path, full } => Ok(vec![Action::DumpScreen( - path.as_os_str().to_string_lossy().into(), - full, - )]), + CliAction::DumpScreen { path, full } => Ok(vec![Action::DumpScreen { + file_path: path.as_os_str().to_string_lossy().into(), + include_scrollback: full, + }]), CliAction::DumpLayout => Ok(vec![Action::DumpLayout]), CliAction::EditScrollback => Ok(vec![Action::EditScrollback]), CliAction::ScrollUp => Ok(vec![Action::ScrollUp]), @@ -396,19 +508,19 @@ impl Action { }, }; if floating { - Ok(vec![Action::NewFloatingPluginPane( + Ok(vec![Action::NewFloatingPluginPane { plugin, - name, - skip_plugin_cache, + pane_name: name, + skip_cache: skip_plugin_cache, cwd, - FloatingPaneCoordinates::new(x, y, width, height, pinned), - )]) + coordinates: FloatingPaneCoordinates::new(x, y, width, height, pinned), + }]) } else if in_place { - Ok(vec![Action::NewInPlacePluginPane( + Ok(vec![Action::NewInPlacePluginPane { plugin, - name, - skip_plugin_cache, - )]) + pane_name: name, + skip_cache: skip_plugin_cache, + }]) } else { // it is intentional that a new tiled plugin pane cannot include a // direction @@ -418,12 +530,12 @@ impl Action { // is being loaded // this is not the case with terminal panes for historical reasons of // backwards compatibility to a time before we had auto layouts - Ok(vec![Action::NewTiledPluginPane( + Ok(vec![Action::NewTiledPluginPane { plugin, - name, - skip_plugin_cache, + pane_name: name, + skip_cache: skip_plugin_cache, cwd, - )]) + }]) } } else if !command.is_empty() { let mut command = command.clone(); @@ -440,35 +552,51 @@ impl Action { ..Default::default() }; if floating { - Ok(vec![Action::NewFloatingPane( - Some(run_command_action), - name, - FloatingPaneCoordinates::new(x, y, width, height, pinned), - )]) + Ok(vec![Action::NewFloatingPane { + command: Some(run_command_action), + pane_name: name, + coordinates: FloatingPaneCoordinates::new(x, y, width, height, pinned), + }]) } else if in_place { - Ok(vec![Action::NewInPlacePane(Some(run_command_action), name)]) + Ok(vec![Action::NewInPlacePane { + command: Some(run_command_action), + pane_name: name, + }]) } else if stacked { - Ok(vec![Action::NewStackedPane(Some(run_command_action), name)]) + Ok(vec![Action::NewStackedPane { + command: Some(run_command_action), + pane_name: name, + }]) } else { - Ok(vec![Action::NewTiledPane( + Ok(vec![Action::NewTiledPane { direction, - Some(run_command_action), - name, - )]) + command: Some(run_command_action), + pane_name: name, + }]) } } else { if floating { - Ok(vec![Action::NewFloatingPane( - None, - name, - FloatingPaneCoordinates::new(x, y, width, height, pinned), - )]) + Ok(vec![Action::NewFloatingPane { + command: None, + pane_name: name, + coordinates: FloatingPaneCoordinates::new(x, y, width, height, pinned), + }]) } else if in_place { - Ok(vec![Action::NewInPlacePane(None, name)]) + Ok(vec![Action::NewInPlacePane { + command: None, + pane_name: name, + }]) } else if stacked { - Ok(vec![Action::NewStackedPane(None, name)]) + Ok(vec![Action::NewStackedPane { + command: None, + pane_name: name, + }]) } else { - Ok(vec![Action::NewTiledPane(direction, None, name)]) + Ok(vec![Action::NewTiledPane { + direction, + command: None, + pane_name: name, + }]) } } }, @@ -496,34 +624,40 @@ impl Action { } } let start_suppressed = false; - Ok(vec![Action::EditFile( - OpenFilePayload::new(file, line_number, cwd), + Ok(vec![Action::EditFile { + payload: OpenFilePayload::new(file, line_number, cwd), direction, floating, in_place, start_suppressed, - FloatingPaneCoordinates::new(x, y, width, height, pinned), - )]) + coordinates: FloatingPaneCoordinates::new(x, y, width, height, pinned), + }]) }, CliAction::SwitchMode { input_mode } => { - Ok(vec![Action::SwitchModeForAllClients(input_mode)]) + Ok(vec![Action::SwitchModeForAllClients { input_mode }]) }, CliAction::TogglePaneEmbedOrFloating => Ok(vec![Action::TogglePaneEmbedOrFloating]), CliAction::ToggleFloatingPanes => Ok(vec![Action::ToggleFloatingPanes]), CliAction::ClosePane => Ok(vec![Action::CloseFocus]), CliAction::RenamePane { name } => Ok(vec![ Action::UndoRenamePane, - Action::PaneNameInput(name.as_bytes().to_vec()), + Action::PaneNameInput { + input: name.as_bytes().to_vec(), + }, ]), CliAction::UndoRenamePane => Ok(vec![Action::UndoRenamePane]), CliAction::GoToNextTab => Ok(vec![Action::GoToNextTab]), CliAction::GoToPreviousTab => Ok(vec![Action::GoToPreviousTab]), CliAction::CloseTab => Ok(vec![Action::CloseTab]), - CliAction::GoToTab { index } => Ok(vec![Action::GoToTab(index)]), - CliAction::GoToTabName { name, create } => Ok(vec![Action::GoToTabName(name, create)]), + CliAction::GoToTab { index } => Ok(vec![Action::GoToTab { index }]), + CliAction::GoToTabName { name, create } => { + Ok(vec![Action::GoToTabName { name, create }]) + }, CliAction::RenameTab { name } => Ok(vec![ - Action::TabNameInput(vec![0]), - Action::TabNameInput(name.as_bytes().to_vec()), + Action::TabNameInput { input: vec![0] }, + Action::TabNameInput { + input: name.as_bytes().to_vec(), + }, ]), CliAction::UndoRenameTab => Ok(vec![Action::UndoRenameTab]), CliAction::NewTab { @@ -615,15 +749,15 @@ impl Action { false } }); - new_tab_actions.push(Action::NewTab( - Some(layout), - floating_panes_layout, - swap_tiled_layouts.clone(), - swap_floating_layouts.clone(), - name, + new_tab_actions.push(Action::NewTab { + tiled_layout: Some(layout), + floating_layouts: floating_panes_layout, + swap_tiled_layouts: swap_tiled_layouts.clone(), + swap_floating_layouts: swap_floating_layouts.clone(), + tab_name: name, should_change_focus_to_new_tab, - None, // the cwd is done through the layout - )); + cwd: None, // the cwd is done through the layout + }); } Ok(new_tab_actions) } else { @@ -631,27 +765,27 @@ impl Action { let swap_floating_layouts = Some(layout.swap_floating_layouts.clone()); let (layout, floating_panes_layout) = layout.new_tab(); let should_change_focus_to_new_tab = true; - Ok(vec![Action::NewTab( - Some(layout), - floating_panes_layout, + Ok(vec![Action::NewTab { + tiled_layout: Some(layout), + floating_layouts: floating_panes_layout, swap_tiled_layouts, swap_floating_layouts, - name, + tab_name: name, should_change_focus_to_new_tab, - None, // the cwd is done through the layout - )]) + cwd: None, // the cwd is done through the layout + }]) } } else { let should_change_focus_to_new_tab = true; - Ok(vec![Action::NewTab( - None, - vec![], - None, - None, - name, + Ok(vec![Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: name, should_change_focus_to_new_tab, cwd, - )]) + }]) } }, CliAction::PreviousSwapLayout => Ok(vec![Action::PreviousSwapLayout]), @@ -665,7 +799,9 @@ impl Action { None, Some(current_dir), )?; - Ok(vec![Action::StartOrReloadPlugin(run_plugin_or_alias)]) + Ok(vec![Action::StartOrReloadPlugin { + plugin: run_plugin_or_alias, + }]) }, CliAction::LaunchOrFocusPlugin { url, @@ -682,13 +818,13 @@ impl Action { None, Some(current_dir), )?; - Ok(vec![Action::LaunchOrFocusPlugin( - run_plugin_or_alias, - floating, + Ok(vec![Action::LaunchOrFocusPlugin { + plugin: run_plugin_or_alias, + should_float: floating, move_to_focused_tab, - in_place, - skip_plugin_cache, - )]) + should_open_in_place: in_place, + skip_cache: skip_plugin_cache, + }]) }, CliAction::LaunchPlugin { url, @@ -704,15 +840,15 @@ impl Action { None, Some(current_dir.clone()), )?; - Ok(vec![Action::LaunchPlugin( - run_plugin_or_alias, - floating, - in_place, - skip_plugin_cache, - Some(current_dir), - )]) + Ok(vec![Action::LaunchPlugin { + plugin: run_plugin_or_alias, + should_float: floating, + should_open_in_place: in_place, + skip_cache: skip_plugin_cache, + cwd: Some(current_dir), + }]) }, - CliAction::RenameSession { name } => Ok(vec![Action::RenameSession(name)]), + CliAction::RenameSession { name } => Ok(vec![Action::RenameSession { name }]), CliAction::Pipe { name, payload, @@ -772,7 +908,7 @@ impl Action { ) ) } else { - Ok(vec![Action::StackPanes(pane_ids)]) + Ok(vec![Action::StackPanes { pane_ids }]) } }, CliAction::ChangeFloatingPaneCoordinates { @@ -790,7 +926,10 @@ impl Action { let parsed_pane_id = PaneId::from_str(&pane_id); match parsed_pane_id { Ok(parsed_pane_id) => { - Ok(vec![Action::ChangeFloatingPaneCoordinates(parsed_pane_id, coordinates)]) + Ok(vec![Action::ChangeFloatingPaneCoordinates { + pane_id: parsed_pane_id, + coordinates, + }]) }, Err(_e) => { Err(format!( @@ -804,17 +943,13 @@ impl Action { } pub fn launches_plugin(&self, plugin_url: &str) -> bool { match self { - Action::LaunchPlugin(run_plugin_or_alias, ..) => { - &run_plugin_or_alias.location_string() == plugin_url - }, - Action::LaunchOrFocusPlugin(run_plugin_or_alias, ..) => { - &run_plugin_or_alias.location_string() == plugin_url - }, + Action::LaunchPlugin { plugin, .. } => &plugin.location_string() == plugin_url, + Action::LaunchOrFocusPlugin { plugin, .. } => &plugin.location_string() == plugin_url, _ => false, } } pub fn is_mouse_action(&self) -> bool { - if let Action::MouseEvent(_mouse_event) = self { + if let Action::MouseEvent { .. } = self { return true; } false diff --git a/zellij-utils/src/input/cli_assets.rs b/zellij-utils/src/input/cli_assets.rs index 0db1395b..a809fb54 100644 --- a/zellij-utils/src/input/cli_assets.rs +++ b/zellij-utils/src/input/cli_assets.rs @@ -9,7 +9,7 @@ use crate::{ use serde::{Deserialize, Serialize}; use std::path::PathBuf; -#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] pub struct CliAssets { pub config_file_path: Option<PathBuf>, pub config_dir: Option<PathBuf>, diff --git a/zellij-utils/src/input/keybinds.rs b/zellij-utils/src/input/keybinds.rs index 3da34e4b..c3943182 100644 --- a/zellij-utils/src/input/keybinds.rs +++ b/zellij-utils/src/input/keybinds.rs @@ -76,15 +76,19 @@ impl Keybinds { key_is_kitty_protocol: bool, ) -> Action { match *mode { - InputMode::Locked => { - Action::Write(key_with_modifier.cloned(), raw_bytes, key_is_kitty_protocol) + InputMode::Locked => Action::Write { + key_with_modifier: key_with_modifier.cloned(), + bytes: raw_bytes, + is_kitty_keyboard_protocol: key_is_kitty_protocol, }, - mode if mode == default_input_mode => { - Action::Write(key_with_modifier.cloned(), raw_bytes, key_is_kitty_protocol) + mode if mode == default_input_mode => Action::Write { + key_with_modifier: key_with_modifier.cloned(), + bytes: raw_bytes, + is_kitty_keyboard_protocol: key_is_kitty_protocol, }, - InputMode::RenameTab => Action::TabNameInput(raw_bytes), - InputMode::RenamePane => Action::PaneNameInput(raw_bytes), - InputMode::EnterSearch => Action::SearchInput(raw_bytes), + InputMode::RenameTab => Action::TabNameInput { input: raw_bytes }, + InputMode::RenamePane => Action::PaneNameInput { input: raw_bytes }, + InputMode::EnterSearch => Action::SearchInput { input: raw_bytes }, _ => Action::NoOp, } } @@ -124,11 +128,11 @@ fn handle_ctrl_j( if mode_keybindings.get(&ctrl_j).is_some() { mode_keybindings.get(&ctrl_j).cloned() } else { - Some(vec![Action::Write( - Some(ctrl_j), - raw_bytes.to_vec().clone(), - key_is_kitty_protocol, - )]) + Some(vec![Action::Write { + key_with_modifier: Some(ctrl_j), + bytes: raw_bytes.to_vec().clone(), + is_kitty_keyboard_protocol: key_is_kitty_protocol, + }]) } } diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 83704439..ac0f54b9 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -237,7 +237,7 @@ pub enum Run { Plugin(RunPluginOrAlias), #[serde(rename = "command")] Command(RunCommand), - EditFile(PathBuf, Option<usize>, Option<PathBuf>), // TODO: merge this with TerminalAction::OpenFile + EditFile(PathBuf, Option<usize>, Option<PathBuf>), Cwd(PathBuf), } diff --git a/zellij-utils/src/input/unit/keybinds_test.rs b/zellij-utils/src/input/unit/keybinds_test.rs index 3e183d91..b9417ea1 100644 --- a/zellij-utils/src/input/unit/keybinds_test.rs +++ b/zellij-utils/src/input/unit/keybinds_test.rs @@ -21,7 +21,9 @@ fn can_define_keybindings_in_configfile() { ); assert_eq!( ctrl_g_normal_mode_action, - Some(&vec![Action::SwitchToMode(InputMode::Locked)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Locked + }]), "Keybinding successfully defined in config" ); } @@ -46,12 +48,16 @@ fn can_define_multiple_keybinds_for_same_action() { ); assert_eq!( alt_h_normal_mode_action, - Some(&vec![Action::MoveFocusOrTab(Direction::Left)]), + Some(&vec![Action::MoveFocusOrTab { + direction: Direction::Left + }]), "First keybinding successfully defined in config" ); assert_eq!( alt_left_normal_mode_action, - Some(&vec![Action::MoveFocusOrTab(Direction::Left)]), + Some(&vec![Action::MoveFocusOrTab { + direction: Direction::Left + }]), "Second keybinding successfully defined in config" ); } @@ -73,7 +79,9 @@ fn can_define_series_of_actions_for_same_keybinding() { z_in_pane_mode, Some(&vec![ Action::TogglePaneFrames, - Action::SwitchToMode(InputMode::Normal) + Action::SwitchToMode { + input_mode: InputMode::Normal + } ]), "Action series successfully defined" ); @@ -95,7 +103,9 @@ fn keybindings_bind_order_is_preserved() { .get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('z'))); assert_eq!( z_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Resize)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Resize + }]), "Second keybinding was applied" ); } @@ -121,13 +131,17 @@ fn uppercase_and_lowercase_keybindings_are_distinct() { z_in_pane_mode, Some(&vec![ Action::TogglePaneFrames, - Action::SwitchToMode(InputMode::Normal) + Action::SwitchToMode { + input_mode: InputMode::Normal + } ]), "Lowercase z successfully bound" ); assert_eq!( uppercase_z_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Resize)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Resize + }]), "Uppercase z successfully bound" ); } @@ -155,7 +169,9 @@ fn can_override_keybindings() { .get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('z'))); assert_eq!( z_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Resize)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Resize + }]), "Keybinding from config overrode keybinding from default config" ); } @@ -190,13 +206,17 @@ fn can_add_to_default_keybindings() { z_in_pane_mode, Some(&vec![ Action::TogglePaneFrames, - Action::SwitchToMode(InputMode::Normal) + Action::SwitchToMode { + input_mode: InputMode::Normal + } ]), "Keybinding from default config bound" ); assert_eq!( r_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Resize)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Resize + }]), "Keybinding from custom config bound as well" ); } @@ -249,12 +269,16 @@ fn can_clear_default_keybindings() { ); assert_eq!( r_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Resize)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Resize + }]), "Keybinding from pane mode in custom config still bound" ); assert_eq!( ctrl_r_in_normal_mode, - Some(&vec![Action::SwitchToMode(InputMode::Locked)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Locked + }]), "Keybinding from normal mode in custom config still bound" ); } @@ -292,7 +316,9 @@ fn can_clear_default_keybindings_per_single_mode() { .get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('r'))); assert_eq!( ctrl_g_normal_mode_action, - Some(&vec![Action::SwitchToMode(InputMode::Locked)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Locked + }]), "Keybind in different mode from default config not cleared" ); assert_eq!( @@ -301,7 +327,9 @@ fn can_clear_default_keybindings_per_single_mode() { ); assert_eq!( r_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Resize)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Resize + }]), "Keybinding from pane mode in custom config still bound" ); } @@ -363,7 +391,9 @@ fn can_unbind_multiple_keys_globally() { ); assert_eq!( t_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Tab)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Tab + }]), "Keybinding from custom config still bound" ); } @@ -411,7 +441,9 @@ fn can_unbind_multiple_keys_per_single_mode() { .get_actions_for_key_in_mode(&InputMode::Pane, &KeyWithModifier::new(BareKey::Char('t'))); assert_eq!( ctrl_g_normal_mode_action, - Some(&vec![Action::SwitchToMode(InputMode::Locked)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Locked + }]), "Keybind in different mode not cleared" ); assert_eq!( @@ -429,7 +461,9 @@ fn can_unbind_multiple_keys_per_single_mode() { ); assert_eq!( t_in_pane_mode, - Some(&vec![Action::SwitchToMode(InputMode::Tab)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Tab + }]), "Keybinding from custom config still bound" ); } @@ -451,7 +485,9 @@ fn can_define_shared_keybinds_for_all_modes() { ); assert_eq!( action_in_mode, - Some(&vec![Action::SwitchToMode(InputMode::Locked)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Locked + }]), "Keybind bound in mode" ); } @@ -477,7 +513,9 @@ fn can_define_shared_keybinds_with_exclusion() { } else { assert_eq!( action_in_mode, - Some(&vec![Action::SwitchToMode(InputMode::Locked)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Locked + }]), "Keybind bound in mode" ); } @@ -502,7 +540,9 @@ fn can_define_shared_keybinds_with_inclusion() { if mode == InputMode::Normal || mode == InputMode::Resize || mode == InputMode::Pane { assert_eq!( action_in_mode, - Some(&vec![Action::SwitchToMode(InputMode::Locked)]), + Some(&vec![Action::SwitchToMode { + input_mode: InputMode::Locked + }]), "Keybind bound in included mode" ); } else { diff --git a/zellij-utils/src/ipc.rs b/zellij-utils/src/ipc.rs index 57a31cd0..fdffaa07 100644 --- a/zellij-utils/src/ipc.rs +++ b/zellij-utils/src/ipc.rs @@ -1,7 +1,7 @@ //! IPC stuff for starting to split things into a client and server model. use crate::{ data::{ClientId, ConnectToSession, KeyWithModifier, Style}, - errors::{get_current_ctx, prelude::*, ErrorContext}, + errors::{prelude::*, ErrorContext}, input::{actions::Action, cli_assets::CliAssets}, pane_size::{Size, SizeInPixels}, }; @@ -11,11 +11,23 @@ use nix::unistd::dup; use serde::{Deserialize, Serialize}; use std::{ fmt::{Display, Error, Formatter}, - io::{self, Write}, + io::{self, Read, Write}, marker::PhantomData, os::unix::io::{AsRawFd, FromRawFd}, }; +// Protobuf imports +use crate::client_server_contract::client_server_contract::{ + ClientToServerMsg as ProtoClientToServerMsg, ServerToClientMsg as ProtoServerToClientMsg, +}; +use prost::Message; + +mod enum_conversions; +mod protobuf_conversion; + +#[cfg(test)] +mod tests; + type SessionId = u64; #[derive(PartialEq, Eq, Serialize, Deserialize, Hash)] @@ -47,6 +59,18 @@ pub struct PixelDimensions { pub character_cell_size: Option<SizeInPixels>, } +#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq)] +pub struct PaneReference { + pub pane_id: u32, + pub is_plugin: bool, +} + +#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq)] +pub struct ColorRegister { + pub index: usize, + pub color: String, +} + impl PixelDimensions { pub fn merge(&mut self, other: PixelDimensions) { if let Some(text_area_size) = other.text_area_size { @@ -60,52 +84,93 @@ impl PixelDimensions { // Types of messages sent from the client to the server #[allow(clippy::large_enum_variant)] -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub enum ClientToServerMsg { - DetachSession(Vec<ClientId>), - TerminalPixelDimensions(PixelDimensions), - BackgroundColor(String), - ForegroundColor(String), - ColorRegisters(Vec<(usize, String)>), - TerminalResize(Size), - FirstClientConnected( - CliAssets, - bool, // is_web_client - ), - AttachClient( - CliAssets, - Option<usize>, // tab position to focus - Option<(u32, bool)>, // (pane_id, is_plugin) => pane id to focus - bool, // is_web_client - ), - Action(Action, Option<u32>, Option<ClientId>), // u32 is the terminal id - Key(KeyWithModifier, Vec<u8>, bool), // key, raw_bytes, is_kitty_keyboard_protocol + DetachSession { + client_ids: Vec<ClientId>, + }, + TerminalPixelDimensions { + pixel_dimensions: PixelDimensions, + }, + BackgroundColor { + color: String, + }, + ForegroundColor { + color: String, + }, + ColorRegisters { + color_registers: Vec<ColorRegister>, + }, + TerminalResize { + new_size: Size, + }, + FirstClientConnected { + cli_assets: CliAssets, + is_web_client: bool, + }, + AttachClient { + cli_assets: CliAssets, + tab_position_to_focus: Option<usize>, + pane_to_focus: Option<PaneReference>, + is_web_client: bool, + }, + Action { + action: Action, + terminal_id: Option<u32>, + client_id: Option<ClientId>, + }, + Key { + key: KeyWithModifier, + raw_bytes: Vec<u8>, + is_kitty_keyboard_protocol: bool, + }, ClientExited, KillSession, ConnStatus, - WebServerStarted(String), // String -> base_url - FailedToStartWebServer(String), + WebServerStarted { + base_url: String, + }, + FailedToStartWebServer { + error: String, + }, } // Types of messages sent from the server to the client -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub enum ServerToClientMsg { - Render(String), + Render { + content: String, + }, UnblockInputThread, - Exit(ExitReason), + Exit { + exit_reason: ExitReason, + }, Connected, - Log(Vec<String>), - LogError(Vec<String>), - SwitchSession(ConnectToSession), - UnblockCliPipeInput(String), // String -> pipe name - CliPipeOutput(String, String), // String -> pipe name, String -> Output + Log { + lines: Vec<String>, + }, + LogError { + lines: Vec<String>, + }, + SwitchSession { + connect_to_session: ConnectToSession, + }, + UnblockCliPipeInput { + pipe_name: String, + }, + CliPipeOutput { + pipe_name: String, + output: String, + }, QueryTerminalSize, StartWebServer, - RenamedSession(String), // String -> new session name + RenamedSession { + name: String, + }, ConfigFileUpdated, } -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub enum ExitReason { Normal, NormalDetached, @@ -177,17 +242,22 @@ impl<T: Serialize> IpcSenderWithContext<T> { } } - /// Sends an event, along with the current [`ErrorContext`], on this [`IpcSenderWithContext`]'s socket. - pub fn send(&mut self, msg: T) -> Result<()> { - let err_ctx = get_current_ctx(); - if rmp_serde::encode::write(&mut self.sender, &(msg, err_ctx)).is_err() { - Err(anyhow!("failed to send message to client")) - } else { - if let Err(e) = self.sender.flush() { - log::error!("Failed to flush ipc sender: {}", e); - } - Ok(()) + pub fn send_client_msg(&mut self, msg: ClientToServerMsg) -> Result<()> { + let proto_msg: ProtoClientToServerMsg = msg.into(); + write_protobuf_message(&mut self.sender, &proto_msg)?; + if let Err(e) = self.sender.flush() { + log::error!("Failed to flush ipc sender: {}", e); + } + Ok(()) + } + + pub fn send_server_msg(&mut self, msg: ServerToClientMsg) -> Result<()> { + let proto_msg: ProtoServerToClientMsg = msg.into(); + write_protobuf_message(&mut self.sender, &proto_msg)?; + if let Err(e) = self.sender.flush() { + log::error!("Failed to flush ipc sender: {}", e); } + Ok(()) } /// Returns an [`IpcReceiverWithContext`] with the same socket as this sender. @@ -220,12 +290,33 @@ where } } - /// Receives an event, along with the current [`ErrorContext`], on this [`IpcReceiverWithContext`]'s socket. - pub fn recv(&mut self) -> Option<(T, ErrorContext)> { - match rmp_serde::decode::from_read(&mut self.receiver) { - Ok(msg) => Some(msg), + pub fn recv_client_msg(&mut self) -> Option<(ClientToServerMsg, ErrorContext)> { + match read_protobuf_message::<ProtoClientToServerMsg>(&mut self.receiver) { + Ok(proto_msg) => match proto_msg.try_into() { + Ok(rust_msg) => Some((rust_msg, ErrorContext::default())), + Err(e) => { + warn!("Error converting protobuf to ClientToServerMsg: {:?}", e); + None + }, + }, Err(e) => { - warn!("Error in IpcReceiver.recv(): {:?}", e); + warn!("Error in protobuf IpcReceiver.recv_client_msg(): {:?}", e); + None + }, + } + } + + pub fn recv_server_msg(&mut self) -> Option<(ServerToClientMsg, ErrorContext)> { + match read_protobuf_message::<ProtoServerToClientMsg>(&mut self.receiver) { + Ok(proto_msg) => match proto_msg.try_into() { + Ok(rust_msg) => Some((rust_msg, ErrorContext::default())), + Err(e) => { + warn!("Error converting protobuf to ServerToClientMsg: {:?}", e); + None + }, + }, + Err(e) => { + warn!("Error in protobuf IpcReceiver.recv_server_msg(): {:?}", e); None }, } @@ -239,3 +330,90 @@ where IpcSenderWithContext::new(socket) } } + +// Protobuf wire format utilities +fn read_protobuf_message<T: Message + Default>(reader: &mut impl Read) -> Result<T> { + // Read length-prefixed protobuf message + let mut len_bytes = [0u8; 4]; + reader.read_exact(&mut len_bytes)?; + let len = u32::from_le_bytes(len_bytes) as usize; + + let mut buf = vec![0u8; len]; + reader.read_exact(&mut buf)?; + + T::decode(&buf[..]).map_err(Into::into) +} + +fn write_protobuf_message<T: Message>(writer: &mut impl Write, msg: &T) -> Result<()> { + let encoded = msg.encode_to_vec(); + let len = encoded.len() as u32; + + // we measure the length of the message and transmit it first so that the reader will be able + // to first read exactly 4 bytes (representing this length) and then read that amount of bytes + // as the actual message - this is so that we are able to distinct whole messages over the wire + // stream + writer.write_all(&len.to_le_bytes())?; + writer.write_all(&encoded)?; + Ok(()) +} + +// Protobuf helper functions +pub fn send_protobuf_client_to_server( + sender: &mut IpcSenderWithContext<ClientToServerMsg>, + msg: ClientToServerMsg, +) -> Result<()> { + let proto_msg: ProtoClientToServerMsg = msg.into(); + write_protobuf_message(&mut sender.sender, &proto_msg)?; + if let Err(e) = sender.sender.flush() { + log::error!("Failed to flush ipc sender: {}", e); + } + Ok(()) +} + +pub fn send_protobuf_server_to_client( + sender: &mut IpcSenderWithContext<ServerToClientMsg>, + msg: ServerToClientMsg, +) -> Result<()> { + let proto_msg: ProtoServerToClientMsg = msg.into(); + write_protobuf_message(&mut sender.sender, &proto_msg)?; + if let Err(e) = sender.sender.flush() { + log::error!("Failed to flush ipc sender: {}", e); + } + Ok(()) +} + +pub fn recv_protobuf_client_to_server( + receiver: &mut IpcReceiverWithContext<ClientToServerMsg>, +) -> Option<(ClientToServerMsg, ErrorContext)> { + match read_protobuf_message::<ProtoClientToServerMsg>(&mut receiver.receiver) { + Ok(proto_msg) => match proto_msg.try_into() { + Ok(rust_msg) => Some((rust_msg, ErrorContext::default())), + Err(e) => { + warn!("Error converting protobuf message: {:?}", e); + None + }, + }, + Err(e) => { + warn!("Error reading protobuf message: {:?}", e); + None + }, + } +} + +pub fn recv_protobuf_server_to_client( + receiver: &mut IpcReceiverWithContext<ServerToClientMsg>, +) -> Option<(ServerToClientMsg, ErrorContext)> { + match read_protobuf_message::<ProtoServerToClientMsg>(&mut receiver.receiver) { + Ok(proto_msg) => match proto_msg.try_into() { + Ok(rust_msg) => Some((rust_msg, ErrorContext::default())), + Err(e) => { + warn!("Error converting protobuf message: {:?}", e); + None + }, + }, + Err(e) => { + warn!("Error reading protobuf message: {:?}", e); + None + }, + } +} diff --git a/zellij-utils/src/ipc/enum_conversions.rs b/zellij-utils/src/ipc/enum_conversions.rs new file mode 100644 index 00000000..69c72785 --- /dev/null +++ b/zellij-utils/src/ipc/enum_conversions.rs @@ -0,0 +1,139 @@ +use crate::{ + client_server_contract::client_server_contract::{ + BareKey as ProtoBareKey, KeyModifier as ProtoKeyModifier, + }, + data::{BareKey, KeyModifier}, + errors::prelude::*, +}; + +// BareKey conversions +impl From<BareKey> for ProtoBareKey { + fn from(key: BareKey) -> Self { + match key { + BareKey::PageDown => ProtoBareKey::PageDown, + BareKey::PageUp => ProtoBareKey::PageUp, + BareKey::Left => ProtoBareKey::Left, + BareKey::Down => ProtoBareKey::Down, + BareKey::Up => ProtoBareKey::Up, + BareKey::Right => ProtoBareKey::Right, + BareKey::Home => ProtoBareKey::Home, + BareKey::End => ProtoBareKey::End, + BareKey::Backspace => ProtoBareKey::Backspace, + BareKey::Delete => ProtoBareKey::Delete, + BareKey::Insert => ProtoBareKey::Insert, + BareKey::F(1) => ProtoBareKey::F1, + BareKey::F(2) => ProtoBareKey::F2, + BareKey::F(3) => ProtoBareKey::F3, + BareKey::F(4) => ProtoBareKey::F4, + BareKey::F(5) => ProtoBareKey::F5, + BareKey::F(6) => ProtoBareKey::F6, + BareKey::F(7) => ProtoBareKey::F7, + BareKey::F(8) => ProtoBareKey::F8, + BareKey::F(9) => ProtoBareKey::F9, + BareKey::F(10) => ProtoBareKey::F10, + BareKey::F(11) => ProtoBareKey::F11, + BareKey::F(12) => ProtoBareKey::F12, + BareKey::F(_) => ProtoBareKey::Unspecified, // Unsupported F-key + BareKey::Char(_) => ProtoBareKey::Char, // Character stored separately + BareKey::Tab => ProtoBareKey::Tab, + BareKey::Esc => ProtoBareKey::Esc, + BareKey::Enter => ProtoBareKey::Enter, + BareKey::CapsLock => ProtoBareKey::CapsLock, + BareKey::ScrollLock => ProtoBareKey::ScrollLock, + BareKey::NumLock => ProtoBareKey::NumLock, + BareKey::PrintScreen => ProtoBareKey::PrintScreen, + BareKey::Pause => ProtoBareKey::Pause, + BareKey::Menu => ProtoBareKey::Menu, + } + } +} + +impl TryFrom<ProtoBareKey> for BareKey { + type Error = anyhow::Error; + + fn try_from(key: ProtoBareKey) -> Result<Self> { + match key { + ProtoBareKey::PageDown => Ok(BareKey::PageDown), + ProtoBareKey::PageUp => Ok(BareKey::PageUp), + ProtoBareKey::Left => Ok(BareKey::Left), + ProtoBareKey::Down => Ok(BareKey::Down), + ProtoBareKey::Up => Ok(BareKey::Up), + ProtoBareKey::Right => Ok(BareKey::Right), + ProtoBareKey::Home => Ok(BareKey::Home), + ProtoBareKey::End => Ok(BareKey::End), + ProtoBareKey::Backspace => Ok(BareKey::Backspace), + ProtoBareKey::Delete => Ok(BareKey::Delete), + ProtoBareKey::Insert => Ok(BareKey::Insert), + ProtoBareKey::F1 => Ok(BareKey::F(1)), + ProtoBareKey::F2 => Ok(BareKey::F(2)), + ProtoBareKey::F3 => Ok(BareKey::F(3)), + ProtoBareKey::F4 => Ok(BareKey::F(4)), + ProtoBareKey::F5 => Ok(BareKey::F(5)), + ProtoBareKey::F6 => Ok(BareKey::F(6)), + ProtoBareKey::F7 => Ok(BareKey::F(7)), + ProtoBareKey::F8 => Ok(BareKey::F(8)), + ProtoBareKey::F9 => Ok(BareKey::F(9)), + ProtoBareKey::F10 => Ok(BareKey::F(10)), + ProtoBareKey::F11 => Ok(BareKey::F(11)), + ProtoBareKey::F12 => Ok(BareKey::F(12)), + ProtoBareKey::Char => Err(anyhow!("Character key needs character data")), + ProtoBareKey::Tab => Ok(BareKey::Tab), + ProtoBareKey::Esc => Ok(BareKey::Esc), + ProtoBareKey::Enter => Ok(BareKey::Enter), + ProtoBareKey::CapsLock => Ok(BareKey::CapsLock), + ProtoBareKey::ScrollLock => Ok(BareKey::ScrollLock), + ProtoBareKey::NumLock => Ok(BareKey::NumLock), + ProtoBareKey::PrintScreen => Ok(BareKey::PrintScreen), + ProtoBareKey::Pause => Ok(BareKey::Pause), + ProtoBareKey::Menu => Ok(BareKey::Menu), + ProtoBareKey::Unspecified => Err(anyhow!("Unspecified bare key")), + } + } +} + +// KeyModifier conversions +impl From<KeyModifier> for ProtoKeyModifier { + fn from(modifier: KeyModifier) -> Self { + match modifier { + KeyModifier::Ctrl => ProtoKeyModifier::Ctrl, + KeyModifier::Alt => ProtoKeyModifier::Alt, + KeyModifier::Shift => ProtoKeyModifier::Shift, + KeyModifier::Super => ProtoKeyModifier::Super, + } + } +} + +impl TryFrom<ProtoKeyModifier> for KeyModifier { + type Error = anyhow::Error; + + fn try_from(modifier: ProtoKeyModifier) -> Result<Self> { + match modifier { + ProtoKeyModifier::Ctrl => Ok(KeyModifier::Ctrl), + ProtoKeyModifier::Alt => Ok(KeyModifier::Alt), + ProtoKeyModifier::Shift => Ok(KeyModifier::Shift), + ProtoKeyModifier::Super => Ok(KeyModifier::Super), + ProtoKeyModifier::Unspecified => Err(anyhow!("Unspecified key modifier")), + } + } +} + +// Helper functions for converting between protobuf i32 and enum types +pub fn bare_key_to_proto_i32(key: BareKey) -> i32 { + ProtoBareKey::from(key) as i32 +} + +pub fn bare_key_from_proto_i32(value: i32) -> Result<BareKey> { + let proto_key = + ProtoBareKey::from_i32(value).ok_or_else(|| anyhow!("Invalid BareKey value: {}", value))?; + proto_key.try_into() +} + +pub fn key_modifier_to_proto_i32(modifier: KeyModifier) -> i32 { + ProtoKeyModifier::from(modifier) as i32 +} + +pub fn key_modifier_from_proto_i32(value: i32) -> Result<KeyModifier> { + let proto_modifier = ProtoKeyModifier::from_i32(value) + .ok_or_else(|| anyhow!("Invalid KeyModifier value: {}", value))?; + proto_modifier.try_into() +} diff --git a/zellij-utils/src/ipc/protobuf_conversion.rs b/zellij-utils/src/ipc/protobuf_conversion.rs new file mode 100644 index 00000000..23c9f201 --- /dev/null +++ b/zellij-utils/src/ipc/protobuf_conversion.rs @@ -0,0 +1,3021 @@ +use crate::{ + client_server_contract::client_server_contract::{ + client_to_server_msg, server_to_client_msg, ActionMsg, AttachClientMsg, BackgroundColorMsg, + CliPipeOutputMsg, ClientExitedMsg, ClientToServerMsg as ProtoClientToServerMsg, + ColorRegistersMsg, ConfigFileUpdatedMsg, ConnStatusMsg, ConnectedMsg, DetachSessionMsg, + ExitMsg, ExitReason as ProtoExitReason, FailedToStartWebServerMsg, FirstClientConnectedMsg, + ForegroundColorMsg, InputMode as ProtoInputMode, KeyMsg, KillSessionMsg, LogErrorMsg, + LogMsg, QueryTerminalSizeMsg, RenamedSessionMsg, RenderMsg, + ServerToClientMsg as ProtoServerToClientMsg, StartWebServerMsg, SwitchSessionMsg, + TerminalPixelDimensionsMsg, TerminalResizeMsg, UnblockCliPipeInputMsg, + UnblockInputThreadMsg, WebServerStartedMsg, + }, + data::InputMode, + errors::prelude::*, + ipc::{ + ClientToServerMsg, ColorRegister, ExitReason, PaneReference, PixelDimensions, + ServerToClientMsg, + }, +}; +use std::collections::BTreeMap; +use std::path::PathBuf; + +// Convert Rust ClientToServerMsg to protobuf +impl From<ClientToServerMsg> for ProtoClientToServerMsg { + fn from(msg: ClientToServerMsg) -> Self { + let message = match msg { + ClientToServerMsg::DetachSession { client_ids } => { + client_to_server_msg::Message::DetachSession(DetachSessionMsg { + client_ids: client_ids.into_iter().map(|id| id as u32).collect(), + }) + }, + ClientToServerMsg::TerminalPixelDimensions { pixel_dimensions } => { + client_to_server_msg::Message::TerminalPixelDimensions(TerminalPixelDimensionsMsg { + pixel_dimensions: Some(pixel_dimensions.into()), + }) + }, + ClientToServerMsg::BackgroundColor { color } => { + client_to_server_msg::Message::BackgroundColor(BackgroundColorMsg { color }) + }, + ClientToServerMsg::ForegroundColor { color } => { + client_to_server_msg::Message::ForegroundColor(ForegroundColorMsg { color }) + }, + ClientToServerMsg::ColorRegisters { color_registers } => { + client_to_server_msg::Message::ColorRegisters(ColorRegistersMsg { + color_registers: color_registers.into_iter().map(|cr| cr.into()).collect(), + }) + }, + ClientToServerMsg::TerminalResize { new_size } => { + client_to_server_msg::Message::TerminalResize(TerminalResizeMsg { + new_size: Some(new_size.into()), + }) + }, + ClientToServerMsg::FirstClientConnected { + cli_assets, + is_web_client, + } => client_to_server_msg::Message::FirstClientConnected(FirstClientConnectedMsg { + cli_assets: Some(cli_assets.into()), + is_web_client, + }), + ClientToServerMsg::AttachClient { + cli_assets, + tab_position_to_focus, + pane_to_focus, + is_web_client, + } => client_to_server_msg::Message::AttachClient(AttachClientMsg { + cli_assets: Some(cli_assets.into()), + tab_position_to_focus: tab_position_to_focus.map(|pos| pos as u32), + pane_to_focus: pane_to_focus.map(|p| p.into()), + is_web_client, + }), + ClientToServerMsg::Action { + action, + terminal_id, + client_id, + } => client_to_server_msg::Message::Action(ActionMsg { + action: Some(action.into()), + terminal_id, + client_id: client_id.map(|id| id as u32), + }), + ClientToServerMsg::Key { + key, + raw_bytes, + is_kitty_keyboard_protocol, + } => client_to_server_msg::Message::Key(KeyMsg { + key: Some(key.into()), + raw_bytes: raw_bytes.into_iter().map(|b| b as u32).collect(), + is_kitty_keyboard_protocol, + }), + ClientToServerMsg::ClientExited => { + client_to_server_msg::Message::ClientExited(ClientExitedMsg {}) + }, + ClientToServerMsg::KillSession => { + client_to_server_msg::Message::KillSession(KillSessionMsg {}) + }, + ClientToServerMsg::ConnStatus => { + client_to_server_msg::Message::ConnStatus(ConnStatusMsg {}) + }, + ClientToServerMsg::WebServerStarted { base_url } => { + client_to_server_msg::Message::WebServerStarted(WebServerStartedMsg { base_url }) + }, + ClientToServerMsg::FailedToStartWebServer { error } => { + client_to_server_msg::Message::FailedToStartWebServer(FailedToStartWebServerMsg { + error, + }) + }, + }; + + ProtoClientToServerMsg { + message: Some(message), + } + } +} + +// Convert protobuf ClientToServerMsg to Rust +impl TryFrom<ProtoClientToServerMsg> for ClientToServerMsg { + type Error = anyhow::Error; + + fn try_from(msg: ProtoClientToServerMsg) -> Result<Self> { + match msg.message { + Some(client_to_server_msg::Message::DetachSession(detach)) => { + Ok(ClientToServerMsg::DetachSession { + client_ids: detach.client_ids.into_iter().map(|id| id as u16).collect(), + }) + }, + Some(client_to_server_msg::Message::TerminalPixelDimensions(pixel_dims)) => { + Ok(ClientToServerMsg::TerminalPixelDimensions { + pixel_dimensions: pixel_dims + .pixel_dimensions + .ok_or_else(|| anyhow!("Missing pixel_dimensions"))? + .try_into()?, + }) + }, + Some(client_to_server_msg::Message::BackgroundColor(bg_color)) => { + Ok(ClientToServerMsg::BackgroundColor { + color: bg_color.color, + }) + }, + Some(client_to_server_msg::Message::ForegroundColor(fg_color)) => { + Ok(ClientToServerMsg::ForegroundColor { + color: fg_color.color, + }) + }, + Some(client_to_server_msg::Message::ColorRegisters(color_regs)) => { + Ok(ClientToServerMsg::ColorRegisters { + color_registers: color_regs + .color_registers + .into_iter() + .map(|cr| cr.try_into()) + .collect::<Result<Vec<_>>>()?, + }) + }, + Some(client_to_server_msg::Message::TerminalResize(resize)) => { + Ok(ClientToServerMsg::TerminalResize { + new_size: resize + .new_size + .ok_or_else(|| anyhow!("Missing new_size"))? + .try_into()?, + }) + }, + Some(client_to_server_msg::Message::FirstClientConnected(first_client)) => { + Ok(ClientToServerMsg::FirstClientConnected { + cli_assets: first_client + .cli_assets + .ok_or_else(|| anyhow!("Missing cli_assets"))? + .try_into()?, + is_web_client: first_client.is_web_client, + }) + }, + Some(client_to_server_msg::Message::AttachClient(attach)) => { + Ok(ClientToServerMsg::AttachClient { + cli_assets: attach + .cli_assets + .ok_or_else(|| anyhow!("Missing cli_assets"))? + .try_into()?, + tab_position_to_focus: attach.tab_position_to_focus.map(|pos| pos as usize), + pane_to_focus: attach.pane_to_focus.map(|p| p.try_into()).transpose()?, + is_web_client: attach.is_web_client, + }) + }, + Some(client_to_server_msg::Message::Action(action)) => Ok(ClientToServerMsg::Action { + action: action + .action + .ok_or_else(|| anyhow!("Missing action"))? + .try_into()?, + terminal_id: action.terminal_id, + client_id: action.client_id.map(|id| id as u16), + }), + Some(client_to_server_msg::Message::Key(key)) => Ok(ClientToServerMsg::Key { + key: key.key.ok_or_else(|| anyhow!("Missing key"))?.try_into()?, + raw_bytes: key.raw_bytes.into_iter().map(|b| b as u8).collect(), + is_kitty_keyboard_protocol: key.is_kitty_keyboard_protocol, + }), + Some(client_to_server_msg::Message::ClientExited(_)) => { + Ok(ClientToServerMsg::ClientExited) + }, + Some(client_to_server_msg::Message::KillSession(_)) => { + Ok(ClientToServerMsg::KillSession) + }, + Some(client_to_server_msg::Message::ConnStatus(_)) => Ok(ClientToServerMsg::ConnStatus), + Some(client_to_server_msg::Message::WebServerStarted(web_server)) => { + Ok(ClientToServerMsg::WebServerStarted { + base_url: web_server.base_url, + }) + }, + Some(client_to_server_msg::Message::FailedToStartWebServer(failed)) => { + Ok(ClientToServerMsg::FailedToStartWebServer { + error: failed.error, + }) + }, + None => Err(anyhow!("Empty ClientToServerMsg message")), + } + } +} + +// Convert Rust ServerToClientMsg to protobuf +impl From<ServerToClientMsg> for ProtoServerToClientMsg { + fn from(msg: ServerToClientMsg) -> Self { + let message = match msg { + ServerToClientMsg::Render { content } => { + server_to_client_msg::Message::Render(RenderMsg { content }) + }, + ServerToClientMsg::UnblockInputThread => { + server_to_client_msg::Message::UnblockInputThread(UnblockInputThreadMsg {}) + }, + ServerToClientMsg::Exit { exit_reason } => { + let (proto_exit_reason, payload) = match exit_reason { + ExitReason::Error(ref msg) => (ProtoExitReason::Error, Some(msg.clone())), + other => (ProtoExitReason::from(other), None), + }; + server_to_client_msg::Message::Exit(ExitMsg { + exit_reason: proto_exit_reason as i32, + payload, + }) + }, + ServerToClientMsg::Connected => { + server_to_client_msg::Message::Connected(ConnectedMsg {}) + }, + ServerToClientMsg::Log { lines } => { + server_to_client_msg::Message::Log(LogMsg { lines }) + }, + ServerToClientMsg::LogError { lines } => { + server_to_client_msg::Message::LogError(LogErrorMsg { lines }) + }, + ServerToClientMsg::SwitchSession { connect_to_session } => { + server_to_client_msg::Message::SwitchSession(SwitchSessionMsg { + connect_to_session: Some(connect_to_session.into()), + }) + }, + ServerToClientMsg::UnblockCliPipeInput { pipe_name } => { + server_to_client_msg::Message::UnblockCliPipeInput(UnblockCliPipeInputMsg { + pipe_name, + }) + }, + ServerToClientMsg::CliPipeOutput { pipe_name, output } => { + server_to_client_msg::Message::CliPipeOutput(CliPipeOutputMsg { pipe_name, output }) + }, + ServerToClientMsg::QueryTerminalSize => { + server_to_client_msg::Message::QueryTerminalSize(QueryTerminalSizeMsg {}) + }, + ServerToClientMsg::StartWebServer => { + server_to_client_msg::Message::StartWebServer(StartWebServerMsg {}) + }, + ServerToClientMsg::RenamedSession { name } => { + server_to_client_msg::Message::RenamedSession(RenamedSessionMsg { name }) + }, + ServerToClientMsg::ConfigFileUpdated => { + server_to_client_msg::Message::ConfigFileUpdated(ConfigFileUpdatedMsg {}) + }, + }; + + ProtoServerToClientMsg { + message: Some(message), + } + } +} + +// Convert protobuf ServerToClientMsg to Rust +impl TryFrom<ProtoServerToClientMsg> for ServerToClientMsg { + type Error = anyhow::Error; + + fn try_from(msg: ProtoServerToClientMsg) -> Result<Self> { + match msg.message { + Some(server_to_client_msg::Message::Render(render)) => Ok(ServerToClientMsg::Render { + content: render.content, + }), + Some(server_to_client_msg::Message::UnblockInputThread(_)) => { + Ok(ServerToClientMsg::UnblockInputThread) + }, + Some(server_to_client_msg::Message::Exit(exit)) => { + let proto_exit_reason = ProtoExitReason::from_i32(exit.exit_reason) + .ok_or_else(|| anyhow!("Invalid exit_reason"))?; + + let exit_reason = match proto_exit_reason { + ProtoExitReason::Error => { + let error_msg = + exit.payload.unwrap_or_else(|| "Protobuf error".to_string()); + ExitReason::Error(error_msg) + }, + other => other.try_into()?, + }; + + Ok(ServerToClientMsg::Exit { exit_reason }) + }, + Some(server_to_client_msg::Message::Connected(_)) => Ok(ServerToClientMsg::Connected), + Some(server_to_client_msg::Message::Log(log)) => { + Ok(ServerToClientMsg::Log { lines: log.lines }) + }, + Some(server_to_client_msg::Message::LogError(log_error)) => { + Ok(ServerToClientMsg::LogError { + lines: log_error.lines, + }) + }, + Some(server_to_client_msg::Message::SwitchSession(switch)) => { + Ok(ServerToClientMsg::SwitchSession { + connect_to_session: switch + .connect_to_session + .ok_or_else(|| anyhow!("Missing connect_to_session"))? + .try_into()?, + }) + }, + Some(server_to_client_msg::Message::UnblockCliPipeInput(unblock)) => { + Ok(ServerToClientMsg::UnblockCliPipeInput { + pipe_name: unblock.pipe_name, + }) + }, + Some(server_to_client_msg::Message::CliPipeOutput(pipe_output)) => { + Ok(ServerToClientMsg::CliPipeOutput { + pipe_name: pipe_output.pipe_name, + output: pipe_output.output, + }) + }, + Some(server_to_client_msg::Message::QueryTerminalSize(_)) => { + Ok(ServerToClientMsg::QueryTerminalSize) + }, + Some(server_to_client_msg::Message::StartWebServer(_)) => { + Ok(ServerToClientMsg::StartWebServer) + }, + Some(server_to_client_msg::Message::RenamedSession(renamed)) => { + Ok(ServerToClientMsg::RenamedSession { name: renamed.name }) + }, + Some(server_to_client_msg::Message::ConfigFileUpdated(_)) => { + Ok(ServerToClientMsg::ConfigFileUpdated) + }, + None => Err(anyhow!("Empty ServerToClientMsg message")), + } + } +} + +// Basic type conversions +impl From<crate::pane_size::Size> for crate::client_server_contract::client_server_contract::Size { + fn from(size: crate::pane_size::Size) -> Self { + Self { + cols: size.cols as u32, + rows: size.rows as u32, + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::Size> + for crate::pane_size::Size +{ + type Error = anyhow::Error; + fn try_from(size: crate::client_server_contract::client_server_contract::Size) -> Result<Self> { + Ok(Self { + rows: size.rows as usize, + cols: size.cols as usize, + }) + } +} + +impl From<PixelDimensions> + for crate::client_server_contract::client_server_contract::PixelDimensions +{ + fn from(pixel_dims: PixelDimensions) -> Self { + Self { + text_area_size: pixel_dims.text_area_size.map(|size| { + crate::client_server_contract::client_server_contract::SizeInPixels { + width: size.width as u32, + height: size.height as u32, + } + }), + character_cell_size: pixel_dims.character_cell_size.map(|size| { + crate::client_server_contract::client_server_contract::SizeInPixels { + width: size.width as u32, + height: size.height as u32, + } + }), + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::PixelDimensions> + for PixelDimensions +{ + type Error = anyhow::Error; + fn try_from( + pixel_dims: crate::client_server_contract::client_server_contract::PixelDimensions, + ) -> Result<Self> { + Ok(Self { + text_area_size: pixel_dims + .text_area_size + .map(|size| crate::pane_size::SizeInPixels { + width: size.width as usize, + height: size.height as usize, + }), + character_cell_size: pixel_dims.character_cell_size.map(|size| { + crate::pane_size::SizeInPixels { + width: size.width as usize, + height: size.height as usize, + } + }), + }) + } +} + +impl From<PaneReference> for crate::client_server_contract::client_server_contract::PaneReference { + fn from(pane_ref: PaneReference) -> Self { + Self { + pane_id: pane_ref.pane_id, + is_plugin: pane_ref.is_plugin, + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::PaneReference> + for PaneReference +{ + type Error = anyhow::Error; + fn try_from( + pane_ref: crate::client_server_contract::client_server_contract::PaneReference, + ) -> Result<Self> { + Ok(Self { + pane_id: pane_ref.pane_id, + is_plugin: pane_ref.is_plugin, + }) + } +} + +impl From<ColorRegister> for crate::client_server_contract::client_server_contract::ColorRegister { + fn from(color_reg: ColorRegister) -> Self { + Self { + index: color_reg.index as u32, + color: color_reg.color, + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::ColorRegister> + for ColorRegister +{ + type Error = anyhow::Error; + fn try_from( + color_reg: crate::client_server_contract::client_server_contract::ColorRegister, + ) -> Result<Self> { + Ok(Self { + index: color_reg.index as usize, + color: color_reg.color, + }) + } +} + +impl From<crate::input::cli_assets::CliAssets> + for crate::client_server_contract::client_server_contract::CliAssets +{ + fn from(cli_assets: crate::input::cli_assets::CliAssets) -> Self { + Self { + config_file_path: cli_assets + .config_file_path + .map(|p| p.to_string_lossy().to_string()), + config_dir: cli_assets + .config_dir + .map(|p| p.to_string_lossy().to_string()), + should_ignore_config: cli_assets.should_ignore_config, + configuration_options: cli_assets.configuration_options.map(|o| o.into()), + layout: cli_assets.layout.map(|l| l.into()), + terminal_window_size: Some(cli_assets.terminal_window_size.into()), + data_dir: cli_assets.data_dir.map(|p| p.to_string_lossy().to_string()), + is_debug: cli_assets.is_debug, + max_panes: cli_assets.max_panes.map(|m| m as u32), + force_run_layout_commands: cli_assets.force_run_layout_commands, + cwd: cli_assets.cwd.map(|p| p.to_string_lossy().to_string()), + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::CliAssets> + for crate::input::cli_assets::CliAssets +{ + type Error = anyhow::Error; + fn try_from( + cli_assets: crate::client_server_contract::client_server_contract::CliAssets, + ) -> Result<Self> { + Ok(Self { + config_file_path: cli_assets.config_file_path.map(PathBuf::from), + config_dir: cli_assets.config_dir.map(PathBuf::from), + should_ignore_config: cli_assets.should_ignore_config, + configuration_options: cli_assets + .configuration_options + .map(|o| o.try_into()) + .transpose()?, + layout: cli_assets.layout.map(|l| l.try_into()).transpose()?, + terminal_window_size: cli_assets + .terminal_window_size + .ok_or_else(|| anyhow!("CliAssets missing terminal_window_size"))? + .try_into()?, + data_dir: cli_assets.data_dir.map(PathBuf::from), + is_debug: cli_assets.is_debug, + max_panes: cli_assets.max_panes.map(|m| m as usize), + force_run_layout_commands: cli_assets.force_run_layout_commands, + cwd: cli_assets.cwd.map(PathBuf::from), + }) + } +} + +impl From<crate::input::options::Options> + for crate::client_server_contract::client_server_contract::Options +{ + fn from(options: crate::input::options::Options) -> Self { + use crate::client_server_contract::client_server_contract::{ + Clipboard as ProtoClipboard, OnForceClose as ProtoOnForceClose, + WebSharing as ProtoWebSharing, + }; + + Self { + simplified_ui: options.simplified_ui, + theme: options.theme, + default_mode: options.default_mode.map(|m| input_mode_to_proto_i32(m)), + default_shell: options + .default_shell + .map(|p| p.to_string_lossy().to_string()), + default_cwd: options.default_cwd.map(|p| p.to_string_lossy().to_string()), + default_layout: options + .default_layout + .map(|p| p.to_string_lossy().to_string()), + layout_dir: options.layout_dir.map(|p| p.to_string_lossy().to_string()), + theme_dir: options.theme_dir.map(|p| p.to_string_lossy().to_string()), + mouse_mode: options.mouse_mode, + pane_frames: options.pane_frames, + mirror_session: options.mirror_session, + on_force_close: options.on_force_close.map(|o| match o { + crate::input::options::OnForceClose::Quit => ProtoOnForceClose::Quit as i32, + crate::input::options::OnForceClose::Detach => ProtoOnForceClose::Detach as i32, + }), + scroll_buffer_size: options.scroll_buffer_size.map(|s| s as u32), + copy_command: options.copy_command, + copy_clipboard: options.copy_clipboard.map(|c| match c { + crate::input::options::Clipboard::System => ProtoClipboard::System as i32, + crate::input::options::Clipboard::Primary => ProtoClipboard::Primary as i32, + }), + copy_on_select: options.copy_on_select, + scrollback_editor: options + .scrollback_editor + .map(|p| p.to_string_lossy().to_string()), + session_name: options.session_name, + attach_to_session: options.attach_to_session, + auto_layout: options.auto_layout, + session_serialization: options.session_serialization, + serialize_pane_viewport: options.serialize_pane_viewport, + scrollback_lines_to_serialize: options.scrollback_lines_to_serialize.map(|s| s as u32), + styled_underlines: options.styled_underlines, + serialization_interval: options.serialization_interval, + disable_session_metadata: options.disable_session_metadata, + support_kitty_keyboard_protocol: options.support_kitty_keyboard_protocol, + web_server: options.web_server, + web_sharing: options.web_sharing.map(|w| match w { + crate::data::WebSharing::On => ProtoWebSharing::On as i32, + crate::data::WebSharing::Off => ProtoWebSharing::Off as i32, + crate::data::WebSharing::Disabled => ProtoWebSharing::Disabled as i32, + }), + stacked_resize: options.stacked_resize, + show_startup_tips: options.show_startup_tips, + show_release_notes: options.show_release_notes, + advanced_mouse_actions: options.advanced_mouse_actions, + web_server_ip: options.web_server_ip.map(|ip| ip.to_string()), + web_server_port: options.web_server_port.map(|p| p as u32), + web_server_cert: options + .web_server_cert + .map(|p| p.to_string_lossy().to_string()), + web_server_key: options + .web_server_key + .map(|p| p.to_string_lossy().to_string()), + enforce_https_for_localhost: options.enforce_https_for_localhost, + post_command_discovery_hook: options.post_command_discovery_hook, + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::Options> + for crate::input::options::Options +{ + type Error = anyhow::Error; + fn try_from( + options: crate::client_server_contract::client_server_contract::Options, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::{ + Clipboard as ProtoClipboard, OnForceClose as ProtoOnForceClose, + WebSharing as ProtoWebSharing, + }; + + Ok(Self { + simplified_ui: options.simplified_ui, + theme: options.theme, + default_mode: options + .default_mode + .map(|m| proto_i32_to_input_mode(m)) + .transpose()?, + default_shell: options.default_shell.map(std::path::PathBuf::from), + default_cwd: options.default_cwd.map(std::path::PathBuf::from), + default_layout: options.default_layout.map(std::path::PathBuf::from), + layout_dir: options.layout_dir.map(std::path::PathBuf::from), + theme_dir: options.theme_dir.map(std::path::PathBuf::from), + mouse_mode: options.mouse_mode, + pane_frames: options.pane_frames, + mirror_session: options.mirror_session, + on_force_close: options + .on_force_close + .map(|o| match ProtoOnForceClose::from_i32(o) { + Some(ProtoOnForceClose::Quit) => Ok(crate::input::options::OnForceClose::Quit), + Some(ProtoOnForceClose::Detach) => { + Ok(crate::input::options::OnForceClose::Detach) + }, + _ => Err(anyhow!("Invalid OnForceClose value: {}", o)), + }) + .transpose()?, + scroll_buffer_size: options.scroll_buffer_size.map(|s| s as usize), + copy_command: options.copy_command, + copy_clipboard: options + .copy_clipboard + .map(|c| match ProtoClipboard::from_i32(c) { + Some(ProtoClipboard::System) => Ok(crate::input::options::Clipboard::System), + Some(ProtoClipboard::Primary) => Ok(crate::input::options::Clipboard::Primary), + _ => Err(anyhow!("Invalid Clipboard value: {}", c)), + }) + .transpose()?, + copy_on_select: options.copy_on_select, + scrollback_editor: options.scrollback_editor.map(std::path::PathBuf::from), + session_name: options.session_name, + attach_to_session: options.attach_to_session, + auto_layout: options.auto_layout, + session_serialization: options.session_serialization, + serialize_pane_viewport: options.serialize_pane_viewport, + scrollback_lines_to_serialize: options + .scrollback_lines_to_serialize + .map(|s| s as usize), + styled_underlines: options.styled_underlines, + serialization_interval: options.serialization_interval, + disable_session_metadata: options.disable_session_metadata, + support_kitty_keyboard_protocol: options.support_kitty_keyboard_protocol, + web_server: options.web_server, + web_sharing: options + .web_sharing + .map(|w| match ProtoWebSharing::from_i32(w) { + Some(ProtoWebSharing::On) => Ok(crate::data::WebSharing::On), + Some(ProtoWebSharing::Off) => Ok(crate::data::WebSharing::Off), + Some(ProtoWebSharing::Disabled) => Ok(crate::data::WebSharing::Disabled), + _ => Err(anyhow!("Invalid WebSharing value: {}", w)), + }) + .transpose()?, + stacked_resize: options.stacked_resize, + show_startup_tips: options.show_startup_tips, + show_release_notes: options.show_release_notes, + advanced_mouse_actions: options.advanced_mouse_actions, + web_server_ip: options + .web_server_ip + .map(|ip| ip.parse()) + .transpose() + .map_err(|e| anyhow!("Invalid IP address: {}", e))?, + web_server_port: options.web_server_port.map(|p| p as u16), + web_server_cert: options.web_server_cert.map(std::path::PathBuf::from), + web_server_key: options.web_server_key.map(std::path::PathBuf::from), + enforce_https_for_localhost: options.enforce_https_for_localhost, + post_command_discovery_hook: options.post_command_discovery_hook, + }) + } +} + +// Complete Action conversion implementation - all 91 variants +impl From<crate::input::actions::Action> + for crate::client_server_contract::client_server_contract::Action +{ + fn from(action: crate::input::actions::Action) -> Self { + use crate::client_server_contract::client_server_contract::{ + action::ActionType, BreakPaneAction, BreakPaneLeftAction, BreakPaneRightAction, + ChangeFloatingPaneCoordinatesAction, ClearScreenAction, CliPipeAction, + CloseFocusAction, ClosePluginPaneAction, CloseTabAction, CloseTerminalPaneAction, + ConfirmAction, CopyAction, DenyAction, DetachAction, DumpLayoutAction, + DumpScreenAction, EditFileAction, EditScrollbackAction, FocusNextPaneAction, + FocusPluginPaneWithIdAction, FocusPreviousPaneAction, FocusTerminalPaneWithIdAction, + GoToNextTabAction, GoToPreviousTabAction, GoToTabAction, GoToTabNameAction, + HalfPageScrollDownAction, HalfPageScrollUpAction, KeybindPipeAction, + LaunchOrFocusPluginAction, LaunchPluginAction, ListClientsAction, MouseEventAction, + MoveFocusAction, MoveFocusOrTabAction, MovePaneAction, MovePaneBackwardsAction, + MoveTabAction, NewFloatingPaneAction, NewFloatingPluginPaneAction, + NewInPlacePaneAction, NewInPlacePluginPaneAction, NewPaneAction, NewStackedPaneAction, + NewTabAction, NewTiledPaneAction, NewTiledPluginPaneAction, NextSwapLayoutAction, + NoOpAction, PageScrollDownAction, PageScrollUpAction, PaneNameInputAction, + PreviousSwapLayoutAction, QueryTabNamesAction, QuitAction, RenamePluginPaneAction, + RenameSessionAction, RenameTabAction, RenameTerminalPaneAction, ResizeAction, + RunAction, ScrollDownAction, ScrollDownAtAction, ScrollToBottomAction, + ScrollToTopAction, ScrollUpAction, ScrollUpAtAction, SearchAction, SearchInputAction, + SearchToggleOptionAction, SkipConfirmAction, StackPanesAction, + StartOrReloadPluginAction, SwitchFocusAction, SwitchModeForAllClientsAction, + SwitchToModeAction, TabNameInputAction, ToggleActiveSyncTabAction, + ToggleFloatingPanesAction, ToggleFocusFullscreenAction, ToggleGroupMarkingAction, + ToggleMouseModeAction, TogglePaneEmbedOrFloatingAction, TogglePaneFramesAction, + TogglePaneInGroupAction, TogglePanePinnedAction, ToggleTabAction, UndoRenamePaneAction, + UndoRenameTabAction, WriteAction, WriteCharsAction, + }; + use std::collections::HashMap; + + let action_type = match action { + crate::input::actions::Action::Quit => ActionType::Quit(QuitAction {}), + crate::input::actions::Action::Write { + key_with_modifier, + bytes, + is_kitty_keyboard_protocol, + } => ActionType::Write(WriteAction { + key_with_modifier: key_with_modifier.map(|k| k.into()), + bytes: bytes.into_iter().map(|b| b as u32).collect(), + is_kitty_keyboard_protocol, + }), + crate::input::actions::Action::WriteChars { chars } => { + ActionType::WriteChars(WriteCharsAction { chars }) + }, + crate::input::actions::Action::SwitchToMode { input_mode } => { + ActionType::SwitchToMode(SwitchToModeAction { + input_mode: input_mode_to_proto_i32(input_mode), + }) + }, + crate::input::actions::Action::SwitchModeForAllClients { input_mode } => { + ActionType::SwitchModeForAllClients(SwitchModeForAllClientsAction { + input_mode: input_mode_to_proto_i32(input_mode), + }) + }, + crate::input::actions::Action::Resize { resize, direction } => { + ActionType::Resize(ResizeAction { + resize: resize_to_proto_i32(resize), + direction: direction.map(|d| direction_to_proto_i32(d)), + }) + }, + crate::input::actions::Action::FocusNextPane => { + ActionType::FocusNextPane(FocusNextPaneAction {}) + }, + crate::input::actions::Action::FocusPreviousPane => { + ActionType::FocusPreviousPane(FocusPreviousPaneAction {}) + }, + crate::input::actions::Action::SwitchFocus => { + ActionType::SwitchFocus(SwitchFocusAction {}) + }, + crate::input::actions::Action::MoveFocus { direction } => { + ActionType::MoveFocus(MoveFocusAction { + direction: direction_to_proto_i32(direction), + }) + }, + crate::input::actions::Action::MoveFocusOrTab { direction } => { + ActionType::MoveFocusOrTab(MoveFocusOrTabAction { + direction: direction_to_proto_i32(direction), + }) + }, + crate::input::actions::Action::MovePane { direction } => { + ActionType::MovePane(MovePaneAction { + direction: direction.map(|d| direction_to_proto_i32(d)), + }) + }, + crate::input::actions::Action::MovePaneBackwards => { + ActionType::MovePaneBackwards(MovePaneBackwardsAction {}) + }, + crate::input::actions::Action::ClearScreen => { + ActionType::ClearScreen(ClearScreenAction {}) + }, + crate::input::actions::Action::DumpScreen { + file_path, + include_scrollback, + } => ActionType::DumpScreen(DumpScreenAction { + file_path, + include_scrollback, + }), + crate::input::actions::Action::DumpLayout => { + ActionType::DumpLayout(DumpLayoutAction {}) + }, + crate::input::actions::Action::EditScrollback => { + ActionType::EditScrollback(EditScrollbackAction {}) + }, + crate::input::actions::Action::ScrollUp => ActionType::ScrollUp(ScrollUpAction {}), + crate::input::actions::Action::ScrollUpAt { position } => { + ActionType::ScrollUpAt(ScrollUpAtAction { + position: Some(position.into()), + }) + }, + crate::input::actions::Action::ScrollDown => { + ActionType::ScrollDown(ScrollDownAction {}) + }, + crate::input::actions::Action::ScrollDownAt { position } => { + ActionType::ScrollDownAt(ScrollDownAtAction { + position: Some(position.into()), + }) + }, + crate::input::actions::Action::ScrollToBottom => { + ActionType::ScrollToBottom(ScrollToBottomAction {}) + }, + crate::input::actions::Action::ScrollToTop => { + ActionType::ScrollToTop(ScrollToTopAction {}) + }, + crate::input::actions::Action::PageScrollUp => { + ActionType::PageScrollUp(PageScrollUpAction {}) + }, + crate::input::actions::Action::PageScrollDown => { + ActionType::PageScrollDown(PageScrollDownAction {}) + }, + crate::input::actions::Action::HalfPageScrollUp => { + ActionType::HalfPageScrollUp(HalfPageScrollUpAction {}) + }, + crate::input::actions::Action::HalfPageScrollDown => { + ActionType::HalfPageScrollDown(HalfPageScrollDownAction {}) + }, + crate::input::actions::Action::ToggleFocusFullscreen => { + ActionType::ToggleFocusFullscreen(ToggleFocusFullscreenAction {}) + }, + crate::input::actions::Action::TogglePaneFrames => { + ActionType::TogglePaneFrames(TogglePaneFramesAction {}) + }, + crate::input::actions::Action::ToggleActiveSyncTab => { + ActionType::ToggleActiveSyncTab(ToggleActiveSyncTabAction {}) + }, + crate::input::actions::Action::NewPane { + direction, + pane_name, + start_suppressed, + } => ActionType::NewPane(NewPaneAction { + direction: direction.map(|d| direction_to_proto_i32(d)), + pane_name, + start_suppressed, + }), + crate::input::actions::Action::EditFile { + payload, + direction, + floating, + in_place, + start_suppressed, + coordinates, + } => ActionType::EditFile(EditFileAction { + payload: Some(payload.into()), + direction: direction.map(|d| direction_to_proto_i32(d)), + floating, + in_place, + start_suppressed, + coordinates: coordinates.map(|c| c.into()), + }), + crate::input::actions::Action::NewFloatingPane { + command, + pane_name, + coordinates, + } => ActionType::NewFloatingPane(NewFloatingPaneAction { + command: command.map(|c| c.into()), + pane_name, + coordinates: coordinates.map(|c| c.into()), + }), + crate::input::actions::Action::NewTiledPane { + direction, + command, + pane_name, + } => ActionType::NewTiledPane(NewTiledPaneAction { + direction: direction.map(|d| direction_to_proto_i32(d)), + command: command.map(|c| c.into()), + pane_name, + }), + crate::input::actions::Action::NewInPlacePane { command, pane_name } => { + ActionType::NewInPlacePane(NewInPlacePaneAction { + command: command.map(|c| c.into()), + pane_name, + }) + }, + crate::input::actions::Action::NewStackedPane { command, pane_name } => { + ActionType::NewStackedPane(NewStackedPaneAction { + command: command.map(|c| c.into()), + pane_name, + }) + }, + crate::input::actions::Action::TogglePaneEmbedOrFloating => { + ActionType::TogglePaneEmbedOrFloating(TogglePaneEmbedOrFloatingAction {}) + }, + crate::input::actions::Action::ToggleFloatingPanes => { + ActionType::ToggleFloatingPanes(ToggleFloatingPanesAction {}) + }, + crate::input::actions::Action::CloseFocus => { + ActionType::CloseFocus(CloseFocusAction {}) + }, + crate::input::actions::Action::PaneNameInput { input } => { + ActionType::PaneNameInput(PaneNameInputAction { + input: input.into_iter().map(|b| b as u32).collect(), + }) + }, + crate::input::actions::Action::UndoRenamePane => { + ActionType::UndoRenamePane(UndoRenamePaneAction {}) + }, + crate::input::actions::Action::NewTab { + tiled_layout, + floating_layouts, + swap_tiled_layouts, + swap_floating_layouts, + tab_name, + should_change_focus_to_new_tab, + cwd, + } => ActionType::NewTab(NewTabAction { + tiled_layout: tiled_layout.map(|l| l.into()), + floating_layouts: floating_layouts.into_iter().map(|l| l.into()).collect(), + swap_tiled_layouts: swap_tiled_layouts + .map(|layouts| layouts.into_iter().map(|l| l.into()).collect()) + .unwrap_or_default(), + swap_floating_layouts: swap_floating_layouts + .map(|layouts| layouts.into_iter().map(|l| l.into()).collect()) + .unwrap_or_default(), + tab_name, + should_change_focus_to_new_tab, + cwd: cwd.map(|p| p.to_string_lossy().to_string()), + }), + crate::input::actions::Action::NoOp => ActionType::NoOp(NoOpAction {}), + crate::input::actions::Action::GoToNextTab => { + ActionType::GoToNextTab(GoToNextTabAction {}) + }, + crate::input::actions::Action::GoToPreviousTab => { + ActionType::GoToPreviousTab(GoToPreviousTabAction {}) + }, + crate::input::actions::Action::CloseTab => ActionType::CloseTab(CloseTabAction {}), + crate::input::actions::Action::GoToTab { index } => { + ActionType::GoToTab(GoToTabAction { index }) + }, + crate::input::actions::Action::GoToTabName { name, create } => { + ActionType::GoToTabName(GoToTabNameAction { name, create }) + }, + crate::input::actions::Action::ToggleTab => ActionType::ToggleTab(ToggleTabAction {}), + crate::input::actions::Action::TabNameInput { input } => { + ActionType::TabNameInput(TabNameInputAction { + input: input.into_iter().map(|b| b as u32).collect(), + }) + }, + crate::input::actions::Action::UndoRenameTab => { + ActionType::UndoRenameTab(UndoRenameTabAction {}) + }, + crate::input::actions::Action::MoveTab { direction } => { + ActionType::MoveTab(MoveTabAction { + direction: direction_to_proto_i32(direction), + }) + }, + crate::input::actions::Action::Run { command } => ActionType::Run(RunAction { + command: Some(command.into()), + }), + crate::input::actions::Action::Detach => ActionType::Detach(DetachAction {}), + crate::input::actions::Action::LaunchOrFocusPlugin { + plugin, + should_float, + move_to_focused_tab, + should_open_in_place, + skip_cache, + } => ActionType::LaunchOrFocusPlugin(LaunchOrFocusPluginAction { + plugin: Some(plugin.into()), + should_float, + move_to_focused_tab, + should_open_in_place, + skip_cache, + }), + crate::input::actions::Action::LaunchPlugin { + plugin, + should_float, + should_open_in_place, + skip_cache, + cwd, + } => ActionType::LaunchPlugin(LaunchPluginAction { + plugin: Some(plugin.into()), + should_float, + should_open_in_place, + skip_cache, + cwd: cwd.map(|p| p.to_string_lossy().to_string()), + }), + crate::input::actions::Action::MouseEvent { event } => { + ActionType::MouseEvent(MouseEventAction { + event: Some(event.into()), + }) + }, + crate::input::actions::Action::Copy => ActionType::Copy(CopyAction {}), + crate::input::actions::Action::Confirm => ActionType::Confirm(ConfirmAction {}), + crate::input::actions::Action::Deny => ActionType::Deny(DenyAction {}), + crate::input::actions::Action::SkipConfirm { action } => { + ActionType::SkipConfirm(Box::new(SkipConfirmAction { + action: Some(Box::new((*action).into())), + })) + }, + crate::input::actions::Action::SearchInput { input } => { + ActionType::SearchInput(SearchInputAction { + input: input.into_iter().map(|b| b as u32).collect(), + }) + }, + crate::input::actions::Action::Search { direction } => { + ActionType::Search(SearchAction { + direction: search_direction_to_proto_i32(direction), + }) + }, + crate::input::actions::Action::SearchToggleOption { option } => { + ActionType::SearchToggleOption(SearchToggleOptionAction { + option: search_option_to_proto_i32(option), + }) + }, + crate::input::actions::Action::ToggleMouseMode => { + ActionType::ToggleMouseMode(ToggleMouseModeAction {}) + }, + crate::input::actions::Action::PreviousSwapLayout => { + ActionType::PreviousSwapLayout(PreviousSwapLayoutAction {}) + }, + crate::input::actions::Action::NextSwapLayout => { + ActionType::NextSwapLayout(NextSwapLayoutAction {}) + }, + crate::input::actions::Action::QueryTabNames => { + ActionType::QueryTabNames(QueryTabNamesAction {}) + }, + crate::input::actions::Action::NewTiledPluginPane { + plugin, + pane_name, + skip_cache, + cwd, + } => ActionType::NewTiledPluginPane(NewTiledPluginPaneAction { + plugin: Some(plugin.into()), + pane_name, + skip_cache, + cwd: cwd.map(|p| p.to_string_lossy().to_string()), + }), + crate::input::actions::Action::NewFloatingPluginPane { + plugin, + pane_name, + skip_cache, + cwd, + coordinates, + } => ActionType::NewFloatingPluginPane(NewFloatingPluginPaneAction { + plugin: Some(plugin.into()), + pane_name, + skip_cache, + cwd: cwd.map(|p| p.to_string_lossy().to_string()), + coordinates: coordinates.map(|c| c.into()), + }), + crate::input::actions::Action::NewInPlacePluginPane { + plugin, + pane_name, + skip_cache, + } => ActionType::NewInPlacePluginPane(NewInPlacePluginPaneAction { + plugin: Some(plugin.into()), + pane_name, + skip_cache, + }), + crate::input::actions::Action::StartOrReloadPlugin { plugin } => { + ActionType::StartOrReloadPlugin(StartOrReloadPluginAction { + plugin: Some(plugin.into()), + }) + }, + crate::input::actions::Action::CloseTerminalPane { pane_id } => { + ActionType::CloseTerminalPane(CloseTerminalPaneAction { pane_id }) + }, + crate::input::actions::Action::ClosePluginPane { pane_id } => { + ActionType::ClosePluginPane(ClosePluginPaneAction { pane_id }) + }, + crate::input::actions::Action::FocusTerminalPaneWithId { + pane_id, + should_float_if_hidden, + } => ActionType::FocusTerminalPaneWithId(FocusTerminalPaneWithIdAction { + pane_id, + should_float_if_hidden, + }), + crate::input::actions::Action::FocusPluginPaneWithId { + pane_id, + should_float_if_hidden, + } => ActionType::FocusPluginPaneWithId(FocusPluginPaneWithIdAction { + pane_id, + should_float_if_hidden, + }), + crate::input::actions::Action::RenameTerminalPane { pane_id, name } => { + ActionType::RenameTerminalPane(RenameTerminalPaneAction { + pane_id, + name: name.into_iter().map(|b| b as u32).collect(), + }) + }, + crate::input::actions::Action::RenamePluginPane { pane_id, name } => { + ActionType::RenamePluginPane(RenamePluginPaneAction { + pane_id, + name: name.into_iter().map(|b| b as u32).collect(), + }) + }, + crate::input::actions::Action::RenameTab { tab_index, name } => { + ActionType::RenameTab(RenameTabAction { + tab_index, + name: name.into_iter().map(|b| b as u32).collect(), + }) + }, + crate::input::actions::Action::BreakPane => ActionType::BreakPane(BreakPaneAction {}), + crate::input::actions::Action::BreakPaneRight => { + ActionType::BreakPaneRight(BreakPaneRightAction {}) + }, + crate::input::actions::Action::BreakPaneLeft => { + ActionType::BreakPaneLeft(BreakPaneLeftAction {}) + }, + crate::input::actions::Action::RenameSession { name } => { + ActionType::RenameSession(RenameSessionAction { name }) + }, + crate::input::actions::Action::CliPipe { + pipe_id, + name, + payload, + args, + plugin, + configuration, + launch_new, + skip_cache, + floating, + in_place, + cwd, + pane_title, + } => ActionType::CliPipe(CliPipeAction { + pipe_id, + name, + payload, + args: args + .map(|a| a.into_iter().collect::<HashMap<_, _>>()) + .unwrap_or_default(), + plugin, + configuration: configuration + .map(|c| c.into_iter().collect::<HashMap<_, _>>()) + .unwrap_or_default(), + launch_new, + skip_cache, + floating, + in_place, + cwd: cwd.map(|p| p.to_string_lossy().to_string()), + pane_title, + }), + crate::input::actions::Action::KeybindPipe { + name, + payload, + args, + plugin, + plugin_id, + configuration, + launch_new, + skip_cache, + floating, + in_place, + cwd, + pane_title, + } => ActionType::KeybindPipe(KeybindPipeAction { + name, + payload, + args: args + .map(|a| a.into_iter().collect::<HashMap<_, _>>()) + .unwrap_or_default(), + plugin, + plugin_id, + configuration: configuration + .map(|c| c.into_iter().collect::<HashMap<_, _>>()) + .unwrap_or_default(), + launch_new, + skip_cache, + floating, + in_place, + cwd: cwd.map(|p| p.to_string_lossy().to_string()), + pane_title, + }), + crate::input::actions::Action::ListClients => { + ActionType::ListClients(ListClientsAction {}) + }, + crate::input::actions::Action::TogglePanePinned => { + ActionType::TogglePanePinned(TogglePanePinnedAction {}) + }, + crate::input::actions::Action::StackPanes { pane_ids } => { + ActionType::StackPanes(StackPanesAction { + pane_ids: pane_ids.into_iter().map(|id| id.into()).collect(), + }) + }, + crate::input::actions::Action::ChangeFloatingPaneCoordinates { + pane_id, + coordinates, + } => ActionType::ChangeFloatingPaneCoordinates(ChangeFloatingPaneCoordinatesAction { + pane_id: Some(pane_id.into()), + coordinates: Some(coordinates.into()), + }), + crate::input::actions::Action::TogglePaneInGroup => { + ActionType::TogglePaneInGroup(TogglePaneInGroupAction {}) + }, + crate::input::actions::Action::ToggleGroupMarking => { + ActionType::ToggleGroupMarking(ToggleGroupMarkingAction {}) + }, + }; + + Self { + action_type: Some(action_type), + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::Action> + for crate::input::actions::Action +{ + type Error = anyhow::Error; + fn try_from( + action: crate::client_server_contract::client_server_contract::Action, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::action::ActionType; + + let action_type = action + .action_type + .ok_or_else(|| anyhow!("Action missing action_type"))?; + + match action_type { + ActionType::Quit(_) => Ok(crate::input::actions::Action::Quit), + ActionType::Write(write_action) => Ok(crate::input::actions::Action::Write { + key_with_modifier: write_action + .key_with_modifier + .map(|k| k.try_into()) + .transpose()?, + bytes: write_action.bytes.into_iter().map(|b| b as u8).collect(), + is_kitty_keyboard_protocol: write_action.is_kitty_keyboard_protocol, + }), + ActionType::WriteChars(write_chars_action) => { + Ok(crate::input::actions::Action::WriteChars { + chars: write_chars_action.chars, + }) + }, + ActionType::SwitchToMode(switch_mode_action) => { + Ok(crate::input::actions::Action::SwitchToMode { + input_mode: proto_i32_to_input_mode(switch_mode_action.input_mode)?, + }) + }, + ActionType::SwitchModeForAllClients(switch_mode_action) => { + Ok(crate::input::actions::Action::SwitchModeForAllClients { + input_mode: proto_i32_to_input_mode(switch_mode_action.input_mode)?, + }) + }, + ActionType::Resize(resize_action) => Ok(crate::input::actions::Action::Resize { + resize: proto_i32_to_resize(resize_action.resize)?, + direction: resize_action + .direction + .map(|d| proto_i32_to_direction(d)) + .transpose()?, + }), + ActionType::FocusNextPane(_) => Ok(crate::input::actions::Action::FocusNextPane), + ActionType::FocusPreviousPane(_) => { + Ok(crate::input::actions::Action::FocusPreviousPane) + }, + ActionType::SwitchFocus(_) => Ok(crate::input::actions::Action::SwitchFocus), + ActionType::MoveFocus(move_focus_action) => { + Ok(crate::input::actions::Action::MoveFocus { + direction: proto_i32_to_direction(move_focus_action.direction)?, + }) + }, + ActionType::MoveFocusOrTab(move_focus_action) => { + Ok(crate::input::actions::Action::MoveFocusOrTab { + direction: proto_i32_to_direction(move_focus_action.direction)?, + }) + }, + ActionType::MovePane(move_pane_action) => Ok(crate::input::actions::Action::MovePane { + direction: move_pane_action + .direction + .map(|d| proto_i32_to_direction(d)) + .transpose()?, + }), + ActionType::MovePaneBackwards(_) => { + Ok(crate::input::actions::Action::MovePaneBackwards) + }, + ActionType::ClearScreen(_) => Ok(crate::input::actions::Action::ClearScreen), + ActionType::DumpScreen(dump_screen_action) => { + Ok(crate::input::actions::Action::DumpScreen { + file_path: dump_screen_action.file_path, + include_scrollback: dump_screen_action.include_scrollback, + }) + }, + ActionType::DumpLayout(_) => Ok(crate::input::actions::Action::DumpLayout), + ActionType::EditScrollback(_) => Ok(crate::input::actions::Action::EditScrollback), + ActionType::ScrollUp(_) => Ok(crate::input::actions::Action::ScrollUp), + ActionType::ScrollUpAt(scroll_action) => { + Ok(crate::input::actions::Action::ScrollUpAt { + position: scroll_action + .position + .ok_or_else(|| anyhow!("ScrollUpAt missing position"))? + .try_into()?, + }) + }, + ActionType::ScrollDown(_) => Ok(crate::input::actions::Action::ScrollDown), + ActionType::ScrollDownAt(scroll_action) => { + Ok(crate::input::actions::Action::ScrollDownAt { + position: scroll_action + .position + .ok_or_else(|| anyhow!("ScrollDownAt missing position"))? + .try_into()?, + }) + }, + ActionType::ScrollToBottom(_) => Ok(crate::input::actions::Action::ScrollToBottom), + ActionType::ScrollToTop(_) => Ok(crate::input::actions::Action::ScrollToTop), + ActionType::PageScrollUp(_) => Ok(crate::input::actions::Action::PageScrollUp), + ActionType::PageScrollDown(_) => Ok(crate::input::actions::Action::PageScrollDown), + ActionType::HalfPageScrollUp(_) => Ok(crate::input::actions::Action::HalfPageScrollUp), + ActionType::HalfPageScrollDown(_) => { + Ok(crate::input::actions::Action::HalfPageScrollDown) + }, + ActionType::ToggleFocusFullscreen(_) => { + Ok(crate::input::actions::Action::ToggleFocusFullscreen) + }, + ActionType::TogglePaneFrames(_) => Ok(crate::input::actions::Action::TogglePaneFrames), + ActionType::ToggleActiveSyncTab(_) => { + Ok(crate::input::actions::Action::ToggleActiveSyncTab) + }, + ActionType::NewPane(new_pane_action) => Ok(crate::input::actions::Action::NewPane { + direction: new_pane_action + .direction + .map(|d| proto_i32_to_direction(d)) + .transpose()?, + pane_name: new_pane_action.pane_name, + start_suppressed: new_pane_action.start_suppressed, + }), + ActionType::EditFile(edit_file_action) => Ok(crate::input::actions::Action::EditFile { + payload: edit_file_action + .payload + .ok_or_else(|| anyhow!("EditFile missing payload"))? + .try_into()?, + direction: edit_file_action + .direction + .map(|d| proto_i32_to_direction(d)) + .transpose()?, + floating: edit_file_action.floating, + in_place: edit_file_action.in_place, + start_suppressed: edit_file_action.start_suppressed, + coordinates: edit_file_action + .coordinates + .map(|c| c.try_into()) + .transpose()?, + }), + ActionType::NewFloatingPane(new_floating_action) => { + Ok(crate::input::actions::Action::NewFloatingPane { + command: new_floating_action + .command + .map(|c| c.try_into()) + .transpose()?, + pane_name: new_floating_action.pane_name, + coordinates: new_floating_action + .coordinates + .map(|c| c.try_into()) + .transpose()?, + }) + }, + ActionType::NewTiledPane(new_tiled_action) => { + Ok(crate::input::actions::Action::NewTiledPane { + direction: new_tiled_action + .direction + .map(|d| proto_i32_to_direction(d)) + .transpose()?, + command: new_tiled_action.command.map(|c| c.try_into()).transpose()?, + pane_name: new_tiled_action.pane_name, + }) + }, + ActionType::NewInPlacePane(new_in_place_action) => { + Ok(crate::input::actions::Action::NewInPlacePane { + command: new_in_place_action + .command + .map(|c| c.try_into()) + .transpose()?, + pane_name: new_in_place_action.pane_name, + }) + }, + ActionType::NewStackedPane(new_stacked_action) => { + Ok(crate::input::actions::Action::NewStackedPane { + command: new_stacked_action + .command + .map(|c| c.try_into()) + .transpose()?, + pane_name: new_stacked_action.pane_name, + }) + }, + ActionType::TogglePaneEmbedOrFloating(_) => { + Ok(crate::input::actions::Action::TogglePaneEmbedOrFloating) + }, + ActionType::ToggleFloatingPanes(_) => { + Ok(crate::input::actions::Action::ToggleFloatingPanes) + }, + ActionType::CloseFocus(_) => Ok(crate::input::actions::Action::CloseFocus), + ActionType::PaneNameInput(pane_name_action) => { + Ok(crate::input::actions::Action::PaneNameInput { + input: pane_name_action + .input + .into_iter() + .map(|b| b as u8) + .collect(), + }) + }, + ActionType::UndoRenamePane(_) => Ok(crate::input::actions::Action::UndoRenamePane), + ActionType::NewTab(new_tab_action) => Ok(crate::input::actions::Action::NewTab { + tiled_layout: new_tab_action + .tiled_layout + .map(|l| l.try_into()) + .transpose()?, + floating_layouts: new_tab_action + .floating_layouts + .into_iter() + .map(|l| l.try_into()) + .collect::<Result<Vec<_>>>()?, + swap_tiled_layouts: if new_tab_action.swap_tiled_layouts.is_empty() { + None + } else { + Some( + new_tab_action + .swap_tiled_layouts + .into_iter() + .map(|l| l.try_into()) + .collect::<Result<Vec<_>>>()?, + ) + }, + swap_floating_layouts: if new_tab_action.swap_floating_layouts.is_empty() { + None + } else { + Some( + new_tab_action + .swap_floating_layouts + .into_iter() + .map(|l| l.try_into()) + .collect::<Result<Vec<_>>>()?, + ) + }, + tab_name: new_tab_action.tab_name, + should_change_focus_to_new_tab: new_tab_action.should_change_focus_to_new_tab, + cwd: new_tab_action.cwd.map(PathBuf::from), + }), + ActionType::NoOp(_) => Ok(crate::input::actions::Action::NoOp), + ActionType::GoToNextTab(_) => Ok(crate::input::actions::Action::GoToNextTab), + ActionType::GoToPreviousTab(_) => Ok(crate::input::actions::Action::GoToPreviousTab), + ActionType::CloseTab(_) => Ok(crate::input::actions::Action::CloseTab), + ActionType::GoToTab(go_to_tab_action) => Ok(crate::input::actions::Action::GoToTab { + index: go_to_tab_action.index, + }), + ActionType::GoToTabName(go_to_tab_name_action) => { + Ok(crate::input::actions::Action::GoToTabName { + name: go_to_tab_name_action.name, + create: go_to_tab_name_action.create, + }) + }, + ActionType::ToggleTab(_) => Ok(crate::input::actions::Action::ToggleTab), + ActionType::TabNameInput(tab_name_action) => { + Ok(crate::input::actions::Action::TabNameInput { + input: tab_name_action.input.into_iter().map(|b| b as u8).collect(), + }) + }, + ActionType::UndoRenameTab(_) => Ok(crate::input::actions::Action::UndoRenameTab), + ActionType::MoveTab(move_tab_action) => Ok(crate::input::actions::Action::MoveTab { + direction: proto_i32_to_direction(move_tab_action.direction)?, + }), + ActionType::Run(run_action) => Ok(crate::input::actions::Action::Run { + command: run_action + .command + .ok_or_else(|| anyhow!("Run missing command"))? + .try_into()?, + }), + ActionType::Detach(_) => Ok(crate::input::actions::Action::Detach), + ActionType::LaunchOrFocusPlugin(launch_plugin_action) => { + Ok(crate::input::actions::Action::LaunchOrFocusPlugin { + plugin: launch_plugin_action + .plugin + .ok_or_else(|| anyhow!("LaunchOrFocusPlugin missing plugin"))? + .try_into()?, + should_float: launch_plugin_action.should_float, + move_to_focused_tab: launch_plugin_action.move_to_focused_tab, + should_open_in_place: launch_plugin_action.should_open_in_place, + skip_cache: launch_plugin_action.skip_cache, + }) + }, + ActionType::LaunchPlugin(launch_plugin_action) => { + Ok(crate::input::actions::Action::LaunchPlugin { + plugin: launch_plugin_action + .plugin + .ok_or_else(|| anyhow!("LaunchPlugin missing plugin"))? + .try_into()?, + should_float: launch_plugin_action.should_float, + should_open_in_place: launch_plugin_action.should_open_in_place, + skip_cache: launch_plugin_action.skip_cache, + cwd: launch_plugin_action.cwd.map(PathBuf::from), + }) + }, + ActionType::MouseEvent(mouse_event_action) => { + Ok(crate::input::actions::Action::MouseEvent { + event: mouse_event_action + .event + .ok_or_else(|| anyhow!("MouseEvent missing event"))? + .try_into()?, + }) + }, + ActionType::Copy(_) => Ok(crate::input::actions::Action::Copy), + ActionType::Confirm(_) => Ok(crate::input::actions::Action::Confirm), + ActionType::Deny(_) => Ok(crate::input::actions::Action::Deny), + ActionType::SkipConfirm(skip_confirm_action) => { + Ok(crate::input::actions::Action::SkipConfirm { + action: Box::new( + skip_confirm_action + .action + .ok_or_else(|| anyhow!("SkipConfirm missing action"))? + .as_ref() + .clone() + .try_into()?, + ), + }) + }, + ActionType::SearchInput(search_input_action) => { + Ok(crate::input::actions::Action::SearchInput { + input: search_input_action + .input + .into_iter() + .map(|b| b as u8) + .collect(), + }) + }, + ActionType::Search(search_action) => Ok(crate::input::actions::Action::Search { + direction: proto_i32_to_search_direction(search_action.direction)?, + }), + ActionType::SearchToggleOption(search_toggle_action) => { + Ok(crate::input::actions::Action::SearchToggleOption { + option: proto_i32_to_search_option(search_toggle_action.option)?, + }) + }, + ActionType::ToggleMouseMode(_) => Ok(crate::input::actions::Action::ToggleMouseMode), + ActionType::PreviousSwapLayout(_) => { + Ok(crate::input::actions::Action::PreviousSwapLayout) + }, + ActionType::NextSwapLayout(_) => Ok(crate::input::actions::Action::NextSwapLayout), + ActionType::QueryTabNames(_) => Ok(crate::input::actions::Action::QueryTabNames), + ActionType::NewTiledPluginPane(new_tiled_plugin_action) => { + Ok(crate::input::actions::Action::NewTiledPluginPane { + plugin: new_tiled_plugin_action + .plugin + .ok_or_else(|| anyhow!("NewTiledPluginPane missing plugin"))? + .try_into()?, + pane_name: new_tiled_plugin_action.pane_name, + skip_cache: new_tiled_plugin_action.skip_cache, + cwd: new_tiled_plugin_action.cwd.map(PathBuf::from), + }) + }, + ActionType::NewFloatingPluginPane(new_floating_plugin_action) => { + Ok(crate::input::actions::Action::NewFloatingPluginPane { + plugin: new_floating_plugin_action + .plugin + .ok_or_else(|| anyhow!("NewFloatingPluginPane missing plugin"))? + .try_into()?, + pane_name: new_floating_plugin_action.pane_name, + skip_cache: new_floating_plugin_action.skip_cache, + cwd: new_floating_plugin_action.cwd.map(PathBuf::from), + coordinates: new_floating_plugin_action + .coordinates + .map(|c| c.try_into()) + .transpose()?, + }) + }, + ActionType::NewInPlacePluginPane(new_in_place_plugin_action) => { + Ok(crate::input::actions::Action::NewInPlacePluginPane { + plugin: new_in_place_plugin_action + .plugin + .ok_or_else(|| anyhow!("NewInPlacePluginPane missing plugin"))? + .try_into()?, + pane_name: new_in_place_plugin_action.pane_name, + skip_cache: new_in_place_plugin_action.skip_cache, + }) + }, + ActionType::StartOrReloadPlugin(start_plugin_action) => { + Ok(crate::input::actions::Action::StartOrReloadPlugin { + plugin: start_plugin_action + .plugin + .ok_or_else(|| anyhow!("StartOrReloadPlugin missing plugin"))? + .try_into()?, + }) + }, + ActionType::CloseTerminalPane(close_pane_action) => { + Ok(crate::input::actions::Action::CloseTerminalPane { + pane_id: close_pane_action.pane_id, + }) + }, + ActionType::ClosePluginPane(close_pane_action) => { + Ok(crate::input::actions::Action::ClosePluginPane { + pane_id: close_pane_action.pane_id, + }) + }, + ActionType::FocusTerminalPaneWithId(focus_pane_action) => { + Ok(crate::input::actions::Action::FocusTerminalPaneWithId { + pane_id: focus_pane_action.pane_id, + should_float_if_hidden: focus_pane_action.should_float_if_hidden, + }) + }, + ActionType::FocusPluginPaneWithId(focus_pane_action) => { + Ok(crate::input::actions::Action::FocusPluginPaneWithId { + pane_id: focus_pane_action.pane_id, + should_float_if_hidden: focus_pane_action.should_float_if_hidden, + }) + }, + ActionType::RenameTerminalPane(rename_pane_action) => { + Ok(crate::input::actions::Action::RenameTerminalPane { + pane_id: rename_pane_action.pane_id, + name: rename_pane_action + .name + .into_iter() + .map(|b| b as u8) + .collect(), + }) + }, + ActionType::RenamePluginPane(rename_pane_action) => { + Ok(crate::input::actions::Action::RenamePluginPane { + pane_id: rename_pane_action.pane_id, + name: rename_pane_action + .name + .into_iter() + .map(|b| b as u8) + .collect(), + }) + }, + ActionType::RenameTab(rename_tab_action) => { + Ok(crate::input::actions::Action::RenameTab { + tab_index: rename_tab_action.tab_index, + name: rename_tab_action + .name + .into_iter() + .map(|b| b as u8) + .collect(), + }) + }, + ActionType::BreakPane(_) => Ok(crate::input::actions::Action::BreakPane), + ActionType::BreakPaneRight(_) => Ok(crate::input::actions::Action::BreakPaneRight), + ActionType::BreakPaneLeft(_) => Ok(crate::input::actions::Action::BreakPaneLeft), + ActionType::RenameSession(rename_session_action) => { + Ok(crate::input::actions::Action::RenameSession { + name: rename_session_action.name, + }) + }, + ActionType::CliPipe(cli_pipe_action) => Ok(crate::input::actions::Action::CliPipe { + pipe_id: cli_pipe_action.pipe_id, + name: cli_pipe_action.name, + payload: cli_pipe_action.payload, + args: if cli_pipe_action.args.is_empty() { + None + } else { + Some(cli_pipe_action.args.into_iter().collect()) + }, + plugin: cli_pipe_action.plugin, + configuration: if cli_pipe_action.configuration.is_empty() { + None + } else { + Some(cli_pipe_action.configuration.into_iter().collect()) + }, + launch_new: cli_pipe_action.launch_new, + skip_cache: cli_pipe_action.skip_cache, + floating: cli_pipe_action.floating, + in_place: cli_pipe_action.in_place, + cwd: cli_pipe_action.cwd.map(PathBuf::from), + pane_title: cli_pipe_action.pane_title, + }), + ActionType::KeybindPipe(keybind_pipe_action) => { + Ok(crate::input::actions::Action::KeybindPipe { + name: keybind_pipe_action.name, + payload: keybind_pipe_action.payload, + args: if keybind_pipe_action.args.is_empty() { + None + } else { + Some(keybind_pipe_action.args.into_iter().collect()) + }, + plugin: keybind_pipe_action.plugin, + plugin_id: keybind_pipe_action.plugin_id, + configuration: if keybind_pipe_action.configuration.is_empty() { + None + } else { + Some(keybind_pipe_action.configuration.into_iter().collect()) + }, + launch_new: keybind_pipe_action.launch_new, + skip_cache: keybind_pipe_action.skip_cache, + floating: keybind_pipe_action.floating, + in_place: keybind_pipe_action.in_place, + cwd: keybind_pipe_action.cwd.map(PathBuf::from), + pane_title: keybind_pipe_action.pane_title, + }) + }, + ActionType::ListClients(_) => Ok(crate::input::actions::Action::ListClients), + ActionType::TogglePanePinned(_) => Ok(crate::input::actions::Action::TogglePanePinned), + ActionType::StackPanes(stack_panes_action) => { + Ok(crate::input::actions::Action::StackPanes { + pane_ids: stack_panes_action + .pane_ids + .into_iter() + .map(|id| id.try_into()) + .collect::<Result<Vec<_>>>()?, + }) + }, + ActionType::ChangeFloatingPaneCoordinates(change_coords_action) => Ok( + crate::input::actions::Action::ChangeFloatingPaneCoordinates { + pane_id: change_coords_action + .pane_id + .ok_or_else(|| anyhow!("ChangeFloatingPaneCoordinates missing pane_id"))? + .try_into()?, + coordinates: change_coords_action + .coordinates + .ok_or_else(|| { + anyhow!("ChangeFloatingPaneCoordinates missing coordinates") + })? + .try_into()?, + }, + ), + ActionType::TogglePaneInGroup(_) => { + Ok(crate::input::actions::Action::TogglePaneInGroup) + }, + ActionType::ToggleGroupMarking(_) => { + Ok(crate::input::actions::Action::ToggleGroupMarking) + }, + } + } +} + +impl From<crate::data::KeyWithModifier> + for crate::client_server_contract::client_server_contract::KeyWithModifier +{ + fn from(key: crate::data::KeyWithModifier) -> Self { + use crate::ipc::enum_conversions::{bare_key_to_proto_i32, key_modifier_to_proto_i32}; + + // Handle character keys specially - store the character for Char variant + let (bare_key_enum, char_data) = match &key.bare_key { + crate::data::BareKey::Char(c) => ( + crate::client_server_contract::client_server_contract::BareKey::Char as i32, + Some(c.to_string()), + ), + other => (bare_key_to_proto_i32(*other), None), + }; + + Self { + bare_key: bare_key_enum, + key_modifiers: key + .key_modifiers + .into_iter() + .map(|modifier| key_modifier_to_proto_i32(modifier)) + .collect(), + character: char_data, + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::KeyWithModifier> + for crate::data::KeyWithModifier +{ + type Error = anyhow::Error; + fn try_from( + key: crate::client_server_contract::client_server_contract::KeyWithModifier, + ) -> Result<Self> { + use crate::ipc::enum_conversions::{bare_key_from_proto_i32, key_modifier_from_proto_i32}; + use std::collections::BTreeSet; + + // Handle character keys specially + let bare_key = if key.bare_key + == crate::client_server_contract::client_server_contract::BareKey::Char as i32 + { + let character_str = key + .character + .ok_or_else(|| anyhow!("Character key missing character data"))?; + let character = character_str + .chars() + .next() + .ok_or_else(|| anyhow!("Empty character string"))?; + crate::data::BareKey::Char(character) + } else { + bare_key_from_proto_i32(key.bare_key)? + }; + + let key_modifiers: Result<BTreeSet<_>> = key + .key_modifiers + .into_iter() + .map(|modifier| key_modifier_from_proto_i32(modifier)) + .collect(); + + Ok(Self { + bare_key, + key_modifiers: key_modifiers?, + }) + } +} + +impl From<crate::data::ConnectToSession> + for crate::client_server_contract::client_server_contract::ConnectToSession +{ + fn from(connect: crate::data::ConnectToSession) -> Self { + Self { + name: connect.name, + tab_position: connect.tab_position.map(|p| p as u32), + pane_id: connect.pane_id.map(|(id, is_plugin)| { + crate::client_server_contract::client_server_contract::PaneIdWithPlugin { + pane_id: id, + is_plugin, + } + }), + layout: connect.layout.map(|l| l.into()), + cwd: connect.cwd.map(|p| p.to_string_lossy().to_string()), + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::ConnectToSession> + for crate::data::ConnectToSession +{ + type Error = anyhow::Error; + fn try_from( + connect: crate::client_server_contract::client_server_contract::ConnectToSession, + ) -> Result<Self> { + Ok(Self { + name: connect.name, + tab_position: connect.tab_position.map(|p| p as usize), + pane_id: connect.pane_id.map(|p| (p.pane_id, p.is_plugin)), + layout: connect.layout.map(|l| l.try_into()).transpose()?, + cwd: connect.cwd.map(PathBuf::from), + }) + } +} + +impl From<crate::data::LayoutInfo> + for crate::client_server_contract::client_server_contract::LayoutInfo +{ + fn from(layout: crate::data::LayoutInfo) -> Self { + use crate::client_server_contract::client_server_contract::layout_info::LayoutType; + let layout_type = match layout { + crate::data::LayoutInfo::BuiltIn(name) => LayoutType::BuiltinName(name), + crate::data::LayoutInfo::File(path) => LayoutType::FilePath(path), + crate::data::LayoutInfo::Url(url) => LayoutType::Url(url), + crate::data::LayoutInfo::Stringified(content) => LayoutType::Stringified(content), + }; + Self { + layout_type: Some(layout_type), + } + } +} + +impl TryFrom<crate::client_server_contract::client_server_contract::LayoutInfo> + for crate::data::LayoutInfo +{ + type Error = anyhow::Error; + fn try_from( + layout: crate::client_server_contract::client_server_contract::LayoutInfo, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::layout_info::LayoutType; + match layout.layout_type { + Some(LayoutType::BuiltinName(name)) => Ok(crate::data::LayoutInfo::BuiltIn(name)), + Some(LayoutType::FilePath(path)) => Ok(crate::data::LayoutInfo::File(path)), + Some(LayoutType::Url(url)) => Ok(crate::data::LayoutInfo::Url(url)), + Some(LayoutType::Stringified(content)) => { + Ok(crate::data::LayoutInfo::Stringified(content)) + }, + None => Err(anyhow!("LayoutInfo missing layout_type")), + } + } +} + +impl From<ExitReason> for ProtoExitReason { + fn from(reason: ExitReason) -> Self { + match reason { + ExitReason::Normal => ProtoExitReason::Normal, + ExitReason::NormalDetached => ProtoExitReason::NormalDetached, + ExitReason::ForceDetached => ProtoExitReason::ForceDetached, + ExitReason::CannotAttach => ProtoExitReason::CannotAttach, + ExitReason::Disconnect => ProtoExitReason::Disconnect, + ExitReason::WebClientsForbidden => ProtoExitReason::WebClientsForbidden, + ExitReason::Error(_msg) => ProtoExitReason::Error, + } + } +} + +impl TryFrom<ProtoExitReason> for ExitReason { + type Error = anyhow::Error; + fn try_from(reason: ProtoExitReason) -> Result<Self> { + match reason { + ProtoExitReason::Normal => Ok(ExitReason::Normal), + ProtoExitReason::NormalDetached => Ok(ExitReason::NormalDetached), + ProtoExitReason::ForceDetached => Ok(ExitReason::ForceDetached), + ProtoExitReason::CannotAttach => Ok(ExitReason::CannotAttach), + ProtoExitReason::Disconnect => Ok(ExitReason::Disconnect), + ProtoExitReason::WebClientsForbidden => Ok(ExitReason::WebClientsForbidden), + ProtoExitReason::Error => Ok(ExitReason::Error("Protobuf error".to_string())), + ProtoExitReason::Unspecified => Err(anyhow!("Unspecified exit reason")), + } + } +} + +// InputMode conversion helper functions +fn input_mode_to_proto_i32(mode: InputMode) -> i32 { + match mode { + InputMode::Normal => ProtoInputMode::Normal as i32, + InputMode::Locked => ProtoInputMode::Locked as i32, + InputMode::Resize => ProtoInputMode::Resize as i32, + InputMode::Pane => ProtoInputMode::Pane as i32, + InputMode::Tab => ProtoInputMode::Tab as i32, + InputMode::Scroll => ProtoInputMode::Scroll as i32, + InputMode::EnterSearch => ProtoInputMode::EnterSearch as i32, + InputMode::Search => ProtoInputMode::Search as i32, + InputMode::RenameTab => ProtoInputMode::RenameTab as i32, + InputMode::RenamePane => ProtoInputMode::RenamePane as i32, + InputMode::Session => ProtoInputMode::Session as i32, + InputMode::Move => ProtoInputMode::Move as i32, + InputMode::Prompt => ProtoInputMode::Prompt as i32, + InputMode::Tmux => ProtoInputMode::Tmux as i32, + } +} + +fn proto_i32_to_input_mode(i: i32) -> Result<InputMode> { + match ProtoInputMode::from_i32(i) { + Some(ProtoInputMode::Normal) => Ok(InputMode::Normal), + Some(ProtoInputMode::Locked) => Ok(InputMode::Locked), + Some(ProtoInputMode::Resize) => Ok(InputMode::Resize), + Some(ProtoInputMode::Pane) => Ok(InputMode::Pane), + Some(ProtoInputMode::Tab) => Ok(InputMode::Tab), + Some(ProtoInputMode::Scroll) => Ok(InputMode::Scroll), + Some(ProtoInputMode::EnterSearch) => Ok(InputMode::EnterSearch), + Some(ProtoInputMode::Search) => Ok(InputMode::Search), + Some(ProtoInputMode::RenameTab) => Ok(InputMode::RenameTab), + Some(ProtoInputMode::RenamePane) => Ok(InputMode::RenamePane), + Some(ProtoInputMode::Session) => Ok(InputMode::Session), + Some(ProtoInputMode::Move) => Ok(InputMode::Move), + Some(ProtoInputMode::Prompt) => Ok(InputMode::Prompt), + Some(ProtoInputMode::Tmux) => Ok(InputMode::Tmux), + _ => Err(anyhow!("Invalid InputMode value: {}", i)), + } +} + +// Additional helper functions for Action conversion +fn resize_to_proto_i32(resize: crate::data::Resize) -> i32 { + use crate::client_server_contract::client_server_contract::ResizeType; + match resize { + crate::data::Resize::Increase => ResizeType::Increase as i32, + crate::data::Resize::Decrease => ResizeType::Decrease as i32, + } +} + +fn direction_to_proto_i32(direction: crate::data::Direction) -> i32 { + use crate::client_server_contract::client_server_contract::Direction as ProtoDirection; + match direction { + crate::data::Direction::Left => ProtoDirection::Left as i32, + crate::data::Direction::Right => ProtoDirection::Right as i32, + crate::data::Direction::Up => ProtoDirection::Up as i32, + crate::data::Direction::Down => ProtoDirection::Down as i32, + } +} + +fn search_direction_to_proto_i32(direction: crate::input::actions::SearchDirection) -> i32 { + use crate::client_server_contract::client_server_contract::SearchDirection as ProtoSearchDirection; + match direction { + crate::input::actions::SearchDirection::Up => ProtoSearchDirection::Up as i32, + crate::input::actions::SearchDirection::Down => ProtoSearchDirection::Down as i32, + } +} + +fn search_option_to_proto_i32(option: crate::input::actions::SearchOption) -> i32 { + use crate::client_server_contract::client_server_contract::SearchOption as ProtoSearchOption; + match option { + crate::input::actions::SearchOption::CaseSensitivity => { + ProtoSearchOption::CaseSensitivity as i32 + }, + crate::input::actions::SearchOption::Wrap => ProtoSearchOption::Wrap as i32, + crate::input::actions::SearchOption::WholeWord => ProtoSearchOption::WholeWord as i32, + } +} + +// Reverse helper functions for Action conversion + +fn proto_i32_to_resize(resize: i32) -> Result<crate::data::Resize> { + use crate::client_server_contract::client_server_contract::ResizeType as ProtoResize; + let proto_resize = match resize { + x if x == ProtoResize::Increase as i32 => ProtoResize::Increase, + x if x == ProtoResize::Decrease as i32 => ProtoResize::Decrease, + _ => return Err(anyhow!("Invalid ResizeType: {}", resize)), + }; + match proto_resize { + ProtoResize::Increase => Ok(crate::data::Resize::Increase), + ProtoResize::Decrease => Ok(crate::data::Resize::Decrease), + ProtoResize::Unspecified => Err(anyhow!("Unspecified ResizeType")), + } +} + +fn proto_i32_to_direction(direction: i32) -> Result<crate::data::Direction> { + use crate::client_server_contract::client_server_contract::Direction as ProtoDirection; + let proto_direction = match direction { + x if x == ProtoDirection::Left as i32 => ProtoDirection::Left, + x if x == ProtoDirection::Right as i32 => ProtoDirection::Right, + x if x == ProtoDirection::Up as i32 => ProtoDirection::Up, + x if x == ProtoDirection::Down as i32 => ProtoDirection::Down, + _ => return Err(anyhow!("Invalid Direction: {}", direction)), + }; + match proto_direction { + ProtoDirection::Left => Ok(crate::data::Direction::Left), + ProtoDirection::Right => Ok(crate::data::Direction::Right), + ProtoDirection::Up => Ok(crate::data::Direction::Up), + ProtoDirection::Down => Ok(crate::data::Direction::Down), + ProtoDirection::Unspecified => Err(anyhow!("Unspecified direction")), + } +} + +fn proto_i32_to_search_direction(direction: i32) -> Result<crate::input::actions::SearchDirection> { + use crate::client_server_contract::client_server_contract::SearchDirection as ProtoSearchDirection; + let proto_direction = match direction { + x if x == ProtoSearchDirection::Up as i32 => ProtoSearchDirection::Up, + x if x == ProtoSearchDirection::Down as i32 => ProtoSearchDirection::Down, + _ => return Err(anyhow!("Invalid SearchDirection: {}", direction)), + }; + match proto_direction { + ProtoSearchDirection::Up => Ok(crate::input::actions::SearchDirection::Up), + ProtoSearchDirection::Down => Ok(crate::input::actions::SearchDirection::Down), + ProtoSearchDirection::Unspecified => Err(anyhow!("Unspecified search direction")), + } +} + +fn proto_i32_to_search_option(option: i32) -> Result<crate::input::actions::SearchOption> { + use crate::client_server_contract::client_server_contract::SearchOption as ProtoSearchOption; + let proto_option = match option { + x if x == ProtoSearchOption::CaseSensitivity as i32 => ProtoSearchOption::CaseSensitivity, + x if x == ProtoSearchOption::WholeWord as i32 => ProtoSearchOption::WholeWord, + x if x == ProtoSearchOption::Wrap as i32 => ProtoSearchOption::Wrap, + _ => return Err(anyhow!("Invalid SearchOption: {}", option)), + }; + match proto_option { + ProtoSearchOption::CaseSensitivity => { + Ok(crate::input::actions::SearchOption::CaseSensitivity) + }, + ProtoSearchOption::Wrap => Ok(crate::input::actions::SearchOption::Wrap), + ProtoSearchOption::WholeWord => Ok(crate::input::actions::SearchOption::WholeWord), + ProtoSearchOption::Unspecified => Err(anyhow!("Unspecified search option")), + } +} + +// Position conversion +impl From<crate::position::Position> + for crate::client_server_contract::client_server_contract::Position +{ + fn from(pos: crate::position::Position) -> Self { + Self { + line: pos.line.0 as i32, + column: pos.column.0 as u64, + } + } +} + +// Reverse Position conversion +impl TryFrom<crate::client_server_contract::client_server_contract::Position> + for crate::position::Position +{ + type Error = anyhow::Error; + fn try_from( + pos: crate::client_server_contract::client_server_contract::Position, + ) -> Result<Self> { + Ok(Self { + line: crate::position::Line(pos.line as isize), + column: crate::position::Column(pos.column as usize), + }) + } +} + +// OpenFilePayload conversion +impl From<crate::input::command::OpenFilePayload> + for crate::client_server_contract::client_server_contract::OpenFilePayload +{ + fn from(payload: crate::input::command::OpenFilePayload) -> Self { + Self { + file_to_open: payload.path.to_string_lossy().to_string(), + line_number: payload.line_number.map(|n| n as u32), + cwd: payload.cwd.map(|p| p.to_string_lossy().to_string()), + originating_plugin: payload.originating_plugin.map(|op| op.into()), + } + } +} + +// Reverse OpenFilePayload conversion +impl TryFrom<crate::client_server_contract::client_server_contract::OpenFilePayload> + for crate::input::command::OpenFilePayload +{ + type Error = anyhow::Error; + fn try_from( + payload: crate::client_server_contract::client_server_contract::OpenFilePayload, + ) -> Result<Self> { + Ok(Self { + path: PathBuf::from(payload.file_to_open), + line_number: payload.line_number.map(|n| n as usize), + cwd: payload.cwd.map(PathBuf::from), + originating_plugin: payload + .originating_plugin + .map(|op| op.try_into()) + .transpose()?, + }) + } +} + +// PaneId conversion +impl From<crate::data::PaneId> for crate::client_server_contract::client_server_contract::PaneId { + fn from(pane_id: crate::data::PaneId) -> Self { + use crate::client_server_contract::client_server_contract::pane_id::PaneType; + match pane_id { + crate::data::PaneId::Terminal(id) => Self { + pane_type: Some(PaneType::Terminal(id)), + }, + crate::data::PaneId::Plugin(id) => Self { + pane_type: Some(PaneType::Plugin(id)), + }, + } + } +} + +// Reverse PaneId conversion +impl TryFrom<crate::client_server_contract::client_server_contract::PaneId> + for crate::data::PaneId +{ + type Error = anyhow::Error; + fn try_from( + pane_id: crate::client_server_contract::client_server_contract::PaneId, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::pane_id::PaneType; + match pane_id + .pane_type + .ok_or_else(|| anyhow!("PaneId missing pane_type"))? + { + PaneType::Terminal(id) => Ok(crate::data::PaneId::Terminal(id)), + PaneType::Plugin(id) => Ok(crate::data::PaneId::Plugin(id)), + } + } +} + +// FloatingCoordinate conversion - SplitSize to FloatingCoordinate +impl From<crate::input::layout::SplitSize> + for crate::client_server_contract::client_server_contract::FloatingCoordinate +{ + fn from(size: crate::input::layout::SplitSize) -> Self { + match size { + crate::input::layout::SplitSize::Percent(p) => Self { + coordinate_type: Some(crate::client_server_contract::client_server_contract::floating_coordinate::CoordinateType::Percent(p as f32)), + }, + crate::input::layout::SplitSize::Fixed(f) => Self { + coordinate_type: Some(crate::client_server_contract::client_server_contract::floating_coordinate::CoordinateType::Fixed(f as u32)), + }, + } + } +} + +// Reverse FloatingCoordinate conversion +impl TryFrom<crate::client_server_contract::client_server_contract::FloatingCoordinate> + for crate::input::layout::SplitSize +{ + type Error = anyhow::Error; + fn try_from( + coord: crate::client_server_contract::client_server_contract::FloatingCoordinate, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::floating_coordinate::CoordinateType; + match coord + .coordinate_type + .ok_or_else(|| anyhow!("FloatingCoordinate missing coordinate_type"))? + { + CoordinateType::Percent(p) => Ok(crate::input::layout::SplitSize::Percent(p as usize)), + CoordinateType::Fixed(f) => Ok(crate::input::layout::SplitSize::Fixed(f as usize)), + } + } +} + +// FloatingPaneCoordinates conversion +impl From<crate::data::FloatingPaneCoordinates> + for crate::client_server_contract::client_server_contract::FloatingPaneCoordinates +{ + fn from(coords: crate::data::FloatingPaneCoordinates) -> Self { + Self { + x: coords.x.map(|x| x.into()), + y: coords.y.map(|y| y.into()), + width: coords.width.map(|w| w.into()), + height: coords.height.map(|h| h.into()), + pinned: coords.pinned, + } + } +} + +// Reverse FloatingPaneCoordinates conversion +impl TryFrom<crate::client_server_contract::client_server_contract::FloatingPaneCoordinates> + for crate::data::FloatingPaneCoordinates +{ + type Error = anyhow::Error; + fn try_from( + coords: crate::client_server_contract::client_server_contract::FloatingPaneCoordinates, + ) -> Result<Self> { + Ok(Self { + x: coords.x.map(|x| x.try_into()).transpose()?, + y: coords.y.map(|y| y.try_into()).transpose()?, + width: coords.width.map(|w| w.try_into()).transpose()?, + height: coords.height.map(|h| h.try_into()).transpose()?, + pinned: coords.pinned, + }) + } +} + +// MouseEvent conversion +impl From<crate::input::mouse::MouseEvent> + for crate::client_server_contract::client_server_contract::MouseEvent +{ + fn from(event: crate::input::mouse::MouseEvent) -> Self { + use crate::client_server_contract::client_server_contract::{ + MouseEventType as ProtoMouseEventType, Position, + }; + + let position = Position { + line: event.position.line.0 as i32, + column: event.position.column.0 as u64, + }; + + let event_type = match event.event_type { + crate::input::mouse::MouseEventType::Press => ProtoMouseEventType::Press as i32, + crate::input::mouse::MouseEventType::Release => ProtoMouseEventType::Release as i32, + crate::input::mouse::MouseEventType::Motion => ProtoMouseEventType::Motion as i32, + }; + + Self { + event_type, + left: event.left, + right: event.right, + middle: event.middle, + wheel_up: event.wheel_up, + wheel_down: event.wheel_down, + shift: event.shift, + alt: event.alt, + ctrl: event.ctrl, + position: Some(position), + } + } +} + +// RunCommandAction conversion +impl From<crate::input::command::RunCommandAction> + for crate::client_server_contract::client_server_contract::RunCommandAction +{ + fn from(action: crate::input::command::RunCommandAction) -> Self { + Self { + command: action.command.to_string_lossy().to_string(), + args: action.args, + cwd: action.cwd.map(|p| p.to_string_lossy().to_string()), + direction: action.direction.map(|d| direction_to_proto_i32(d)), + hold_on_close: action.hold_on_close, + hold_on_start: action.hold_on_start, + originating_plugin: action.originating_plugin.map(|op| op.into()), + use_terminal_title: action.use_terminal_title, + } + } +} + +// OriginatingPlugin conversion +impl From<crate::data::OriginatingPlugin> + for crate::client_server_contract::client_server_contract::OriginatingPlugin +{ + fn from(orig: crate::data::OriginatingPlugin) -> Self { + use std::collections::HashMap; + let context: HashMap<String, String> = + orig.context.into_iter().map(|(k, v)| (k, v)).collect(); + + Self { + plugin_id: orig.plugin_id, + client_id: orig.client_id as u32, + context, + } + } +} + +// OriginatingPlugin reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::OriginatingPlugin> + for crate::data::OriginatingPlugin +{ + type Error = anyhow::Error; + + fn try_from( + orig: crate::client_server_contract::client_server_contract::OriginatingPlugin, + ) -> Result<Self> { + use std::collections::BTreeMap; + let context: BTreeMap<String, String> = orig.context.into_iter().collect(); + + Ok(Self { + plugin_id: orig.plugin_id, + client_id: orig.client_id as u16, + context, + }) + } +} + +// SplitDirection conversion helper +fn split_direction_to_proto_i32(direction: crate::input::layout::SplitDirection) -> i32 { + use crate::client_server_contract::client_server_contract::SplitDirection as ProtoSplitDirection; + match direction { + crate::input::layout::SplitDirection::Horizontal => ProtoSplitDirection::Horizontal as i32, + crate::input::layout::SplitDirection::Vertical => ProtoSplitDirection::Vertical as i32, + } +} + +// SplitSize conversion +impl From<crate::input::layout::SplitSize> + for crate::client_server_contract::client_server_contract::SplitSize +{ + fn from(size: crate::input::layout::SplitSize) -> Self { + use crate::client_server_contract::client_server_contract::split_size::SizeType; + match size { + crate::input::layout::SplitSize::Percent(p) => Self { + size_type: Some(SizeType::Percent(p as u32)), + }, + crate::input::layout::SplitSize::Fixed(f) => Self { + size_type: Some(SizeType::Fixed(f as u32)), + }, + } + } +} + +// PercentOrFixed conversion +impl From<crate::input::layout::PercentOrFixed> + for crate::client_server_contract::client_server_contract::PercentOrFixed +{ + fn from(size: crate::input::layout::PercentOrFixed) -> Self { + use crate::client_server_contract::client_server_contract::percent_or_fixed::SizeType; + match size { + crate::input::layout::PercentOrFixed::Percent(p) => Self { + size_type: Some(SizeType::Percent(p as u32)), + }, + crate::input::layout::PercentOrFixed::Fixed(f) => Self { + size_type: Some(SizeType::Fixed(f as u32)), + }, + } + } +} + +// Run conversion +impl From<crate::input::layout::Run> + for crate::client_server_contract::client_server_contract::Run +{ + fn from(run: crate::input::layout::Run) -> Self { + use crate::client_server_contract::client_server_contract::run::RunType; + match run { + crate::input::layout::Run::Command(cmd) => Self { + run_type: Some(RunType::Command( + crate::client_server_contract::client_server_contract::RunCommandAction { + command: cmd.command.to_string_lossy().to_string(), + args: cmd.args, + cwd: cmd.cwd.map(|p| p.to_string_lossy().to_string()), + direction: None, // RunCommand doesn't have direction field + hold_on_close: cmd.hold_on_close, + hold_on_start: cmd.hold_on_start, + originating_plugin: cmd.originating_plugin.map(|op| op.into()), + use_terminal_title: cmd.use_terminal_title, + }, + )), + }, + crate::input::layout::Run::Plugin(plugin) => Self { + run_type: Some(RunType::Plugin(plugin.into())), + }, + crate::input::layout::Run::EditFile(path, line_number, cwd) => Self { + run_type: Some(RunType::EditFile( + crate::client_server_contract::client_server_contract::RunEditFileAction { + file_path: path.to_string_lossy().to_string(), + line_number: line_number.map(|n| n as u32), + cwd: cwd.map(|p| p.to_string_lossy().to_string()), + }, + )), + }, + crate::input::layout::Run::Cwd(path) => Self { + run_type: Some(RunType::Cwd(path.to_string_lossy().to_string())), + }, + } + } +} + +// TiledPaneLayout conversion +impl From<crate::input::layout::TiledPaneLayout> + for crate::client_server_contract::client_server_contract::TiledPaneLayout +{ + fn from(layout: crate::input::layout::TiledPaneLayout) -> Self { + Self { + children_split_direction: split_direction_to_proto_i32(layout.children_split_direction), + name: layout.name, + children: layout.children.into_iter().map(|c| c.into()).collect(), + split_size: layout.split_size.map(|s| s.into()), + run: layout.run.map(|r| r.into()), + borderless: layout.borderless, + focus: layout.focus.map(|f| f.to_string()), + exclude_from_sync: layout.exclude_from_sync, + children_are_stacked: layout.children_are_stacked, + external_children_index: layout.external_children_index.map(|l| l as u32), + is_expanded_in_stack: layout.is_expanded_in_stack, + hide_floating_panes: layout.hide_floating_panes, + pane_initial_contents: layout.pane_initial_contents, + } + } +} + +impl From<crate::input::layout::FloatingPaneLayout> + for crate::client_server_contract::client_server_contract::FloatingPaneLayout +{ + fn from(layout: crate::input::layout::FloatingPaneLayout) -> Self { + Self { + name: layout.name, + height: layout.height.map(|h| h.into()), + width: layout.width.map(|w| w.into()), + x: layout.x.map(|x| x.into()), + y: layout.y.map(|y| y.into()), + pinned: layout.pinned, + run: layout.run.map(|r| r.into()), + focus: layout.focus, + already_running: layout.already_running, + pane_initial_contents: layout.pane_initial_contents, + logical_position: layout.logical_position.map(|l| l as u32), + } + } +} + +impl From<crate::input::layout::SwapTiledLayout> + for crate::client_server_contract::client_server_contract::SwapTiledLayout +{ + fn from(layout: crate::input::layout::SwapTiledLayout) -> Self { + use crate::client_server_contract::client_server_contract::LayoutConstraintTiledPair; + + let constraint_map = layout + .0 + .into_iter() + .map(|(constraint, tiled_layout)| LayoutConstraintTiledPair { + constraint: Some(constraint.into()), + layout: Some(tiled_layout.into()), + }) + .collect(); + + Self { + constraint_map, + name: layout.1, + } + } +} + +impl From<crate::input::layout::SwapFloatingLayout> + for crate::client_server_contract::client_server_contract::SwapFloatingLayout +{ + fn from(layout: crate::input::layout::SwapFloatingLayout) -> Self { + use crate::client_server_contract::client_server_contract::LayoutConstraintFloatingPair; + + let constraint_map = layout + .0 + .into_iter() + .map( + |(constraint, floating_layouts)| LayoutConstraintFloatingPair { + constraint: Some(constraint.into()), + layouts: floating_layouts.into_iter().map(|l| l.into()).collect(), + }, + ) + .collect(); + + Self { + constraint_map, + name: layout.1, + } + } +} + +// PluginUserConfiguration conversion +impl From<crate::input::layout::PluginUserConfiguration> + for crate::client_server_contract::client_server_contract::PluginUserConfiguration +{ + fn from(config: crate::input::layout::PluginUserConfiguration) -> Self { + Self { + configuration: config.inner().clone().into_iter().collect(), // Convert BTreeMap to HashMap + } + } +} + +// LayoutConstraint conversion +impl From<crate::input::layout::LayoutConstraint> + for crate::client_server_contract::client_server_contract::LayoutConstraintWithValue +{ + fn from(constraint: crate::input::layout::LayoutConstraint) -> Self { + use crate::client_server_contract::client_server_contract::LayoutConstraint as ProtoLayoutConstraint; + match constraint { + crate::input::layout::LayoutConstraint::MaxPanes(n) => Self { + constraint_type: ProtoLayoutConstraint::MaxPanes as i32, + value: Some(n as u32), + }, + crate::input::layout::LayoutConstraint::MinPanes(n) => Self { + constraint_type: ProtoLayoutConstraint::MinPanes as i32, + value: Some(n as u32), + }, + crate::input::layout::LayoutConstraint::ExactPanes(n) => Self { + constraint_type: ProtoLayoutConstraint::ExactPanes as i32, + value: Some(n as u32), + }, + crate::input::layout::LayoutConstraint::NoConstraint => Self { + constraint_type: ProtoLayoutConstraint::NoConstraint as i32, + value: None, + }, + } + } +} + +// RunPlugin conversion +impl From<crate::input::layout::RunPlugin> + for crate::client_server_contract::client_server_contract::RunPlugin +{ + fn from(plugin: crate::input::layout::RunPlugin) -> Self { + Self { + allow_exec_host_cmd: plugin._allow_exec_host_cmd, + location: Some(plugin.location.into()), + configuration: Some(plugin.configuration.into()), + initial_cwd: plugin.initial_cwd.map(|p| p.display().to_string()), + } + } +} + +// PluginAlias conversion +impl From<crate::input::layout::PluginAlias> + for crate::client_server_contract::client_server_contract::PluginAlias +{ + fn from(plugin: crate::input::layout::PluginAlias) -> Self { + Self { + name: plugin.name, + configuration: plugin.configuration.map(|c| c.into()), + initial_cwd: plugin.initial_cwd.map(|i| i.display().to_string()), + run_plugin: plugin.run_plugin.map(|r| r.into()), + } + } +} + +// RunPluginLocation conversion +impl From<crate::input::layout::RunPluginLocation> + for crate::client_server_contract::client_server_contract::RunPluginLocationData +{ + fn from(location: crate::input::layout::RunPluginLocation) -> Self { + use crate::client_server_contract::client_server_contract::{ + run_plugin_location_data::LocationData, RunPluginLocation as ProtoRunPluginLocation, + }; + match location { + crate::input::layout::RunPluginLocation::File(path) => Self { + location_type: ProtoRunPluginLocation::File as i32, + location_data: Some(LocationData::FilePath(path.to_string_lossy().to_string())), + }, + crate::input::layout::RunPluginLocation::Zellij(tag) => Self { + location_type: ProtoRunPluginLocation::Zellij as i32, + location_data: Some(LocationData::ZellijTag( + crate::client_server_contract::client_server_contract::PluginTag { + tag: tag.to_string(), + }, + )), + }, + crate::input::layout::RunPluginLocation::Remote(url) => Self { + location_type: ProtoRunPluginLocation::Remote as i32, + location_data: Some(LocationData::RemoteUrl(url)), + }, + } + } +} + +// RunPluginOrAlias conversion +impl From<crate::input::layout::RunPluginOrAlias> + for crate::client_server_contract::client_server_contract::RunPluginOrAlias +{ + fn from(plugin: crate::input::layout::RunPluginOrAlias) -> Self { + use crate::client_server_contract::client_server_contract::run_plugin_or_alias::PluginType; + match plugin { + crate::input::layout::RunPluginOrAlias::RunPlugin(run_plugin) => Self { + plugin_type: Some(PluginType::Plugin(run_plugin.into())), + }, + crate::input::layout::RunPluginOrAlias::Alias(alias) => Self { + plugin_type: Some(PluginType::Alias(alias.into())), + }, + } + } +} + +// Run reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::Run> + for crate::input::layout::Run +{ + type Error = anyhow::Error; + + fn try_from(run: crate::client_server_contract::client_server_contract::Run) -> Result<Self> { + use crate::client_server_contract::client_server_contract::run::RunType; + + let run_type = run + .run_type + .ok_or_else(|| anyhow!("Run missing run_type"))?; + match run_type { + RunType::Command(cmd) => Ok(crate::input::layout::Run::Command( + crate::input::command::RunCommand { + command: std::path::PathBuf::from(cmd.command), + args: cmd.args, + cwd: cmd.cwd.map(std::path::PathBuf::from), + hold_on_close: cmd.hold_on_close, + hold_on_start: cmd.hold_on_start, + originating_plugin: cmd + .originating_plugin + .map(|op| op.try_into()) + .transpose()?, + use_terminal_title: cmd.use_terminal_title, + }, + )), + RunType::EditFile(edit) => Ok(crate::input::layout::Run::EditFile( + std::path::PathBuf::from(edit.file_path), + edit.line_number.map(|n| n as usize), + edit.cwd.map(std::path::PathBuf::from), + )), + RunType::Cwd(cwd_str) => Ok(crate::input::layout::Run::Cwd(std::path::PathBuf::from( + cwd_str, + ))), + RunType::Plugin(plugin) => Ok(crate::input::layout::Run::Plugin(plugin.try_into()?)), + } + } +} + +// PercentOrFixed reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::PercentOrFixed> + for crate::input::layout::PercentOrFixed +{ + type Error = anyhow::Error; + + fn try_from( + value: crate::client_server_contract::client_server_contract::PercentOrFixed, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::percent_or_fixed::SizeType; + + let size_type = value + .size_type + .ok_or_else(|| anyhow!("PercentOrFixed missing size_type"))?; + match size_type { + SizeType::Percent(percent) => Ok(crate::input::layout::PercentOrFixed::Percent( + percent as usize, + )), + SizeType::Fixed(fixed) => { + Ok(crate::input::layout::PercentOrFixed::Fixed(fixed as usize)) + }, + } + } +} + +// ===== REVERSE CONVERSIONS ===== + +// MouseEvent reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::MouseEvent> + for crate::input::mouse::MouseEvent +{ + type Error = anyhow::Error; + + fn try_from( + event: crate::client_server_contract::client_server_contract::MouseEvent, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::MouseEventType as ProtoMouseEventType; + + let event_type = match event.event_type { + x if x == ProtoMouseEventType::Press as i32 => { + crate::input::mouse::MouseEventType::Press + }, + x if x == ProtoMouseEventType::Release as i32 => { + crate::input::mouse::MouseEventType::Release + }, + x if x == ProtoMouseEventType::Motion as i32 => { + crate::input::mouse::MouseEventType::Motion + }, + _ => return Err(anyhow!("Invalid MouseEventType: {}", event.event_type)), + }; + + let position = event + .position + .ok_or_else(|| anyhow!("MouseEvent missing position"))? + .try_into()?; + + Ok(crate::input::mouse::MouseEvent { + event_type, + left: event.left, + right: event.right, + middle: event.middle, + wheel_up: event.wheel_up, + wheel_down: event.wheel_down, + shift: event.shift, + alt: event.alt, + ctrl: event.ctrl, + position, + }) + } +} + +// RunCommandAction reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::RunCommandAction> + for crate::input::command::RunCommandAction +{ + type Error = anyhow::Error; + + fn try_from( + action: crate::client_server_contract::client_server_contract::RunCommandAction, + ) -> Result<Self> { + Ok(crate::input::command::RunCommandAction { + command: std::path::PathBuf::from(action.command), + args: action.args, + cwd: action.cwd.map(std::path::PathBuf::from), + direction: action.direction.map(proto_i32_to_direction).transpose()?, + hold_on_close: action.hold_on_close, + hold_on_start: action.hold_on_start, + originating_plugin: action + .originating_plugin + .map(|op| op.try_into()) + .transpose()?, + use_terminal_title: action.use_terminal_title, + }) + } +} + +// TiledPaneLayout reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::TiledPaneLayout> + for crate::input::layout::TiledPaneLayout +{ + type Error = anyhow::Error; + + fn try_from( + layout: crate::client_server_contract::client_server_contract::TiledPaneLayout, + ) -> Result<Self> { + use crate::input::layout::{SplitDirection, SplitSize, TiledPaneLayout}; + + let children_split_direction = match layout.children_split_direction { + x if x + == crate::client_server_contract::client_server_contract::SplitDirection::Horizontal + as i32 => + { + SplitDirection::Horizontal + }, + x if x + == crate::client_server_contract::client_server_contract::SplitDirection::Vertical + as i32 => + { + SplitDirection::Vertical + }, + _ => SplitDirection::Horizontal, // default + }; + + let children: Result<Vec<_>> = layout.children.into_iter().map(|c| c.try_into()).collect(); + let run = layout.run.map(|r| r.try_into()).transpose()?; + + let split_size = layout.split_size.and_then(|size| { + use crate::client_server_contract::client_server_contract::split_size::SizeType; + match size.size_type { + Some(SizeType::Percent(percent)) => Some(SplitSize::Percent(percent as usize)), + Some(SizeType::Fixed(fixed)) => Some(SplitSize::Fixed(fixed as usize)), + None => None, + } + }); + + Ok(TiledPaneLayout { + children_split_direction, + name: layout.name, + children: children?, + split_size, + run, + borderless: layout.borderless, + focus: layout.focus.map(|f| f == "true"), // Convert string to bool + external_children_index: layout.external_children_index.map(|l| l as usize), + children_are_stacked: layout.children_are_stacked, + is_expanded_in_stack: layout.is_expanded_in_stack, + exclude_from_sync: layout.exclude_from_sync, + run_instructions_to_ignore: vec![], // not represented in protobuf + hide_floating_panes: layout.hide_floating_panes, + pane_initial_contents: layout.pane_initial_contents, + }) + } +} + +// FloatingPaneLayout reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::FloatingPaneLayout> + for crate::input::layout::FloatingPaneLayout +{ + type Error = anyhow::Error; + + fn try_from( + layout: crate::client_server_contract::client_server_contract::FloatingPaneLayout, + ) -> Result<Self> { + let run = layout.run.map(|r| r.try_into()).transpose()?; + let height = layout.height.map(|h| h.try_into()).transpose()?; + let width = layout.width.map(|w| w.try_into()).transpose()?; + let x = layout.x.map(|x| x.try_into()).transpose()?; + let y = layout.y.map(|y| y.try_into()).transpose()?; + + Ok(crate::input::layout::FloatingPaneLayout { + name: layout.name, + height, + width, + x, + y, + pinned: layout.pinned, + run, + focus: layout.focus, + already_running: layout.already_running, + pane_initial_contents: layout.pane_initial_contents, + logical_position: layout.logical_position.map(|p| p as usize), + }) + } +} + +// SwapTiledLayout reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::SwapTiledLayout> + for crate::input::layout::SwapTiledLayout +{ + type Error = anyhow::Error; + + fn try_from( + layout: crate::client_server_contract::client_server_contract::SwapTiledLayout, + ) -> Result<Self> { + let constraint_map: Result<BTreeMap<_, _>> = layout + .constraint_map + .into_iter() + .map(|pair| { + Ok(( + pair.constraint + .ok_or_else(|| anyhow!("Missing constraint"))? + .try_into()?, + pair.layout + .ok_or_else(|| anyhow!("Missing layout"))? + .try_into()?, + )) + }) + .collect(); + Ok((constraint_map?, layout.name)) + } +} + +// SwapFloatingLayout reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::SwapFloatingLayout> + for crate::input::layout::SwapFloatingLayout +{ + type Error = anyhow::Error; + + fn try_from( + layout: crate::client_server_contract::client_server_contract::SwapFloatingLayout, + ) -> Result<Self> { + let constraint_map: Result<BTreeMap<_, _>> = layout + .constraint_map + .into_iter() + .map(|pair| { + let floating_layouts: Result<Vec<_>> = + pair.layouts.into_iter().map(|l| l.try_into()).collect(); + Ok(( + pair.constraint + .ok_or_else(|| anyhow!("Missing constraint"))? + .try_into()?, + floating_layouts?, + )) + }) + .collect(); + + Ok((constraint_map?, layout.name)) + } +} + +// PluginUserConfiguration reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::PluginUserConfiguration> + for crate::input::layout::PluginUserConfiguration +{ + type Error = anyhow::Error; + + fn try_from( + config: crate::client_server_contract::client_server_contract::PluginUserConfiguration, + ) -> Result<Self> { + let btree_map: BTreeMap<String, String> = config.configuration.into_iter().collect(); + Ok(crate::input::layout::PluginUserConfiguration::new( + btree_map, + )) + } +} + +// LayoutConstraint reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::LayoutConstraintWithValue> + for crate::input::layout::LayoutConstraint +{ + type Error = anyhow::Error; + + fn try_from( + constraint: crate::client_server_contract::client_server_contract::LayoutConstraintWithValue, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::LayoutConstraint as ProtoLayoutConstraint; + match constraint.constraint_type { + x if x == ProtoLayoutConstraint::MaxPanes as i32 => { + let value = constraint + .value + .ok_or_else(|| anyhow!("MaxPanes constraint missing value"))? + as usize; + Ok(crate::input::layout::LayoutConstraint::MaxPanes(value)) + }, + x if x == ProtoLayoutConstraint::MinPanes as i32 => { + let value = constraint + .value + .ok_or_else(|| anyhow!("MinPanes constraint missing value"))? + as usize; + Ok(crate::input::layout::LayoutConstraint::MinPanes(value)) + }, + x if x == ProtoLayoutConstraint::ExactPanes as i32 => { + let value = constraint + .value + .ok_or_else(|| anyhow!("ExactPanes constraint missing value"))? + as usize; + Ok(crate::input::layout::LayoutConstraint::ExactPanes(value)) + }, + x if x == ProtoLayoutConstraint::NoConstraint as i32 => { + Ok(crate::input::layout::LayoutConstraint::NoConstraint) + }, + _ => Err(anyhow!( + "Invalid LayoutConstraint type: {}", + constraint.constraint_type + )), + } + } +} + +// RunPlugin reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::RunPlugin> + for crate::input::layout::RunPlugin +{ + type Error = anyhow::Error; + + fn try_from( + plugin: crate::client_server_contract::client_server_contract::RunPlugin, + ) -> Result<Self> { + let location = plugin + .location + .ok_or_else(|| anyhow!("RunPlugin missing location"))? + .try_into()?; + let configuration = plugin + .configuration + .ok_or_else(|| anyhow!("RunPlugin missing configuration"))? + .try_into()?; + let initial_cwd = plugin.initial_cwd.map(std::path::PathBuf::from); + + Ok(crate::input::layout::RunPlugin { + _allow_exec_host_cmd: plugin.allow_exec_host_cmd, + location, + configuration, + initial_cwd, + }) + } +} + +// PluginAlias reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::PluginAlias> + for crate::input::layout::PluginAlias +{ + type Error = anyhow::Error; + + fn try_from( + plugin_alias: crate::client_server_contract::client_server_contract::PluginAlias, + ) -> Result<Self> { + let run_plugin = plugin_alias.run_plugin.and_then(|r| r.try_into().ok()); + let configuration = plugin_alias.configuration.and_then(|c| c.try_into().ok()); + let initial_cwd = plugin_alias.initial_cwd.map(std::path::PathBuf::from); + Ok(crate::input::layout::PluginAlias { + name: plugin_alias.name, + configuration, + initial_cwd, + run_plugin, + }) + } +} + +// RunPluginLocation reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::RunPluginLocationData> + for crate::input::layout::RunPluginLocation +{ + type Error = anyhow::Error; + + fn try_from( + location: crate::client_server_contract::client_server_contract::RunPluginLocationData, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::{ + run_plugin_location_data::LocationData, RunPluginLocation as ProtoRunPluginLocation, + }; + + let location_data = location + .location_data + .ok_or_else(|| anyhow!("RunPluginLocationData missing location_data"))?; + match location.location_type { + x if x == ProtoRunPluginLocation::File as i32 => { + if let LocationData::FilePath(path) = location_data { + Ok(crate::input::layout::RunPluginLocation::File( + std::path::PathBuf::from(path), + )) + } else { + Err(anyhow!("File location type but wrong data variant")) + } + }, + x if x == ProtoRunPluginLocation::Zellij as i32 => { + if let LocationData::ZellijTag(tag) = location_data { + Ok(crate::input::layout::RunPluginLocation::Zellij( + crate::data::PluginTag::new(tag.tag), + )) + } else { + Err(anyhow!("Zellij location type but wrong data variant")) + } + }, + x if x == ProtoRunPluginLocation::Remote as i32 => { + if let LocationData::RemoteUrl(url) = location_data { + Ok(crate::input::layout::RunPluginLocation::Remote(url)) + } else { + Err(anyhow!("Remote location type but wrong data variant")) + } + }, + _ => Err(anyhow!( + "Invalid RunPluginLocation type: {}", + location.location_type + )), + } + } +} + +// RunPluginOrAlias reverse conversion +impl TryFrom<crate::client_server_contract::client_server_contract::RunPluginOrAlias> + for crate::input::layout::RunPluginOrAlias +{ + type Error = anyhow::Error; + + fn try_from( + plugin: crate::client_server_contract::client_server_contract::RunPluginOrAlias, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::run_plugin_or_alias::PluginType; + + let plugin_type = plugin + .plugin_type + .ok_or_else(|| anyhow!("RunPluginOrAlias missing plugin_type"))?; + match plugin_type { + PluginType::Plugin(run_plugin) => Ok( + crate::input::layout::RunPluginOrAlias::RunPlugin(run_plugin.try_into()?), + ), + PluginType::Alias(plugin_alias) => Ok(crate::input::layout::RunPluginOrAlias::Alias( + plugin_alias.try_into()?, + )), + } + } +} diff --git a/zellij-utils/src/ipc/tests/mod.rs b/zellij-utils/src/ipc/tests/mod.rs new file mode 100644 index 00000000..b6883b96 --- /dev/null +++ b/zellij-utils/src/ipc/tests/mod.rs @@ -0,0 +1,2 @@ +mod roundtrip_tests; +mod test_framework; diff --git a/zellij-utils/src/ipc/tests/roundtrip_tests.rs b/zellij-utils/src/ipc/tests/roundtrip_tests.rs new file mode 100644 index 00000000..a2585181 --- /dev/null +++ b/zellij-utils/src/ipc/tests/roundtrip_tests.rs @@ -0,0 +1,2797 @@ +use super::test_framework::*; +use crate::data::{ + BareKey, ConnectToSession, Direction, FloatingPaneCoordinates, InputMode, KeyModifier, + KeyWithModifier, LayoutInfo, OriginatingPlugin, PaneId, PluginTag, Resize, WebSharing, +}; +use crate::input::actions::{Action, SearchDirection, SearchOption}; +use crate::input::cli_assets::CliAssets; +use crate::input::command::{OpenFilePayload, RunCommand, RunCommandAction}; +use crate::input::layout::{ + FloatingPaneLayout, LayoutConstraint, PercentOrFixed, PluginAlias, PluginUserConfiguration, + Run, RunPlugin, RunPluginLocation, RunPluginOrAlias, SplitDirection, SplitSize, + TiledPaneLayout, +}; +use crate::input::mouse::{MouseEvent, MouseEventType}; +use crate::input::options::{Clipboard, OnForceClose, Options}; +use crate::ipc::{ + ClientToServerMsg, ColorRegister, ExitReason, PaneReference, PixelDimensions, ServerToClientMsg, +}; +use crate::pane_size::{Size, SizeInPixels}; +use crate::position::Position; +use std::collections::{BTreeMap, BTreeSet}; +use std::path::PathBuf; + +#[test] +fn server_client_contract() { + // here we test all possible values of each of the nested types in the server/client contract + // in the context of its message. + // + // we do a "roundtrip" test, meaning we take each message, encode it to protobuf bytes and + // decode it back to its rust type and then assert its equality with the original type to make + // sure they are identical and did not lose any information + test_client_messages(); + test_server_messages(); +} + +fn test_client_messages() { + let empty_context = BTreeMap::new(); + let mut demo_context = BTreeMap::new(); + demo_context.insert("demo_key1".to_owned(), "demo_value1".to_owned()); + demo_context.insert("demo_key2".to_owned(), "demo_value2".to_owned()); + demo_context.insert("demo_key3".to_owned(), "demo_value3".to_owned()); + let mut swap_tiled_layouts_1 = BTreeMap::new(); + swap_tiled_layouts_1.insert( + LayoutConstraint::MaxPanes(1), + TiledPaneLayout { + name: Some("max_panes_1".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_1.insert( + LayoutConstraint::MinPanes(2), + TiledPaneLayout { + name: Some("min_panes_2".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_1.insert( + LayoutConstraint::ExactPanes(3), + TiledPaneLayout { + name: Some("exact_panes_2".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_1.insert( + LayoutConstraint::NoConstraint, + TiledPaneLayout { + name: Some("no_constraint".to_owned()), + ..Default::default() + }, + ); + let swap_tiled_layouts_1 = ( + swap_tiled_layouts_1, + Some("swap_tiled_layouts_1".to_owned()), + ); + let mut swap_tiled_layouts_2 = BTreeMap::new(); + swap_tiled_layouts_2.insert( + LayoutConstraint::MaxPanes(1), + TiledPaneLayout { + name: Some("max_panes_1".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_2.insert( + LayoutConstraint::MinPanes(2), + TiledPaneLayout { + name: Some("min_panes_2".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_2.insert( + LayoutConstraint::ExactPanes(3), + TiledPaneLayout { + name: Some("exact_panes_2".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_2.insert( + LayoutConstraint::NoConstraint, + TiledPaneLayout { + name: Some("no_constraint".to_owned()), + ..Default::default() + }, + ); + let swap_tiled_layouts_2 = ( + swap_tiled_layouts_2, + Some("swap_tiled_layouts_2".to_owned()), + ); + let mut swap_tiled_layouts_3 = BTreeMap::new(); + swap_tiled_layouts_3.insert( + LayoutConstraint::MaxPanes(1), + TiledPaneLayout { + name: Some("max_panes_1".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_3.insert( + LayoutConstraint::MinPanes(2), + TiledPaneLayout { + name: Some("min_panes_2".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_3.insert( + LayoutConstraint::ExactPanes(3), + TiledPaneLayout { + name: Some("exact_panes_2".to_owned()), + ..Default::default() + }, + ); + swap_tiled_layouts_3.insert( + LayoutConstraint::NoConstraint, + TiledPaneLayout { + name: Some("no_constraint".to_owned()), + ..Default::default() + }, + ); + let swap_tiled_layouts_3 = (swap_tiled_layouts_3, None); + + let mut swap_floating_layouts_1 = BTreeMap::new(); + swap_floating_layouts_1.insert( + LayoutConstraint::MaxPanes(1), + vec![ + FloatingPaneLayout { + name: Some("max_panes_1".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("max_panes_1_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_1.insert( + LayoutConstraint::MinPanes(2), + vec![ + FloatingPaneLayout { + name: Some("min_panes_2".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("min_panes_2_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_1.insert( + LayoutConstraint::ExactPanes(3), + vec![ + FloatingPaneLayout { + name: Some("exact_panes_2".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("exact_panes_2_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_1.insert( + LayoutConstraint::NoConstraint, + vec![ + FloatingPaneLayout { + name: Some("no_constraint".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("no_constraint_1".to_owned()), + ..Default::default() + }, + ], + ); + let swap_floating_layouts_1 = ( + swap_floating_layouts_1, + Some("swap_floating_layouts_1".to_owned()), + ); + let mut swap_floating_layouts_2 = BTreeMap::new(); + swap_floating_layouts_2.insert( + LayoutConstraint::MaxPanes(1), + vec![ + FloatingPaneLayout { + name: Some("max_panes_1".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("max_panes_1_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_2.insert( + LayoutConstraint::MinPanes(2), + vec![ + FloatingPaneLayout { + name: Some("min_panes_2".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("min_panes_2_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_2.insert( + LayoutConstraint::ExactPanes(3), + vec![ + FloatingPaneLayout { + name: Some("exact_panes_2".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("exact_panes_2_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_2.insert( + LayoutConstraint::NoConstraint, + vec![ + FloatingPaneLayout { + name: Some("no_constraint".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("no_constraint_1".to_owned()), + ..Default::default() + }, + ], + ); + let swap_floating_layouts_2 = ( + swap_floating_layouts_2, + Some("swap_floating_layouts_2".to_owned()), + ); + let mut swap_floating_layouts_3 = BTreeMap::new(); + swap_floating_layouts_3.insert( + LayoutConstraint::MaxPanes(1), + vec![ + FloatingPaneLayout { + name: Some("max_panes_1".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("max_panes_1_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_3.insert( + LayoutConstraint::MinPanes(2), + vec![ + FloatingPaneLayout { + name: Some("min_panes_2".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("min_panes_2_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_3.insert( + LayoutConstraint::ExactPanes(3), + vec![ + FloatingPaneLayout { + name: Some("exact_panes_2".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("exact_panes_2_1".to_owned()), + ..Default::default() + }, + ], + ); + swap_floating_layouts_3.insert( + LayoutConstraint::NoConstraint, + vec![ + FloatingPaneLayout { + name: Some("no_constraint".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("no_constraint_1".to_owned()), + ..Default::default() + }, + ], + ); + let swap_floating_layouts_3 = (swap_floating_layouts_3, None); + let mut demo_modifiers_1 = BTreeSet::new(); + let mut demo_modifiers_2 = BTreeSet::new(); + let mut demo_modifiers_3 = BTreeSet::new(); + let mut demo_modifiers_4 = BTreeSet::new(); + demo_modifiers_1.insert(KeyModifier::Ctrl); + demo_modifiers_2.insert(KeyModifier::Ctrl); + demo_modifiers_3.insert(KeyModifier::Ctrl); + demo_modifiers_4.insert(KeyModifier::Ctrl); + demo_modifiers_2.insert(KeyModifier::Alt); + demo_modifiers_3.insert(KeyModifier::Alt); + demo_modifiers_4.insert(KeyModifier::Alt); + demo_modifiers_3.insert(KeyModifier::Shift); + demo_modifiers_4.insert(KeyModifier::Shift); + demo_modifiers_4.insert(KeyModifier::Super); + + test_client_roundtrip!(ClientToServerMsg::DetachSession { client_ids: vec![] }); + test_client_roundtrip!(ClientToServerMsg::DetachSession { + client_ids: vec![1], + }); + test_client_roundtrip!(ClientToServerMsg::DetachSession { + client_ids: vec![1, 2, 999], + }); + test_client_roundtrip!(ClientToServerMsg::TerminalPixelDimensions { + pixel_dimensions: PixelDimensions { + text_area_size: None, + character_cell_size: None, + }, + }); + test_client_roundtrip!(ClientToServerMsg::TerminalPixelDimensions { + pixel_dimensions: PixelDimensions { + text_area_size: Some(SizeInPixels { + width: 800, + height: 600 + }), + character_cell_size: Some(SizeInPixels { + width: 10, + height: 20 + }), + }, + }); + test_client_roundtrip!(ClientToServerMsg::BackgroundColor { + color: "red".to_string(), + }); + test_client_roundtrip!(ClientToServerMsg::BackgroundColor { + color: "#FF0000".to_string(), + }); + test_client_roundtrip!(ClientToServerMsg::BackgroundColor { + color: "".to_string(), + }); + test_client_roundtrip!(ClientToServerMsg::ForegroundColor { + color: "blue".to_string(), + }); + test_client_roundtrip!(ClientToServerMsg::ColorRegisters { + color_registers: vec![], + }); + test_client_roundtrip!(ClientToServerMsg::ColorRegisters { + color_registers: vec![ + ColorRegister { + index: 0, + color: "black".to_string() + }, + ColorRegister { + index: 1, + color: "red".to_string() + }, + ColorRegister { + index: 255, + color: "#FFFFFF".to_string() + }, + ], + }); + test_client_roundtrip!(ClientToServerMsg::TerminalResize { + new_size: Size { cols: 80, rows: 24 }, + }); + test_client_roundtrip!(ClientToServerMsg::TerminalResize { + new_size: Size { + cols: 200, + rows: 50 + }, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets::default(), + is_web_client: false, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets::default(), + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + config_file_path: Some(PathBuf::from("/path/to/config/file.kdl")), + config_dir: Some(PathBuf::from("/path/to/config/dir")), + should_ignore_config: true, + configuration_options: None, + layout: None, + terminal_window_size: Size { rows: 80, cols: 42 }, + data_dir: Some(PathBuf::from("/path/to/data/dir")), + is_debug: true, + max_panes: Some(4), + force_run_layout_commands: true, + cwd: Some(PathBuf::from("/path/to/cwd")), + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + config_file_path: Some(PathBuf::from("/path/to/config/file.kdl")), + config_dir: Some(PathBuf::from("/path/to/config/dir")), + should_ignore_config: true, + configuration_options: Some(Options::default()), + layout: None, + terminal_window_size: Size { rows: 80, cols: 42 }, + data_dir: Some(PathBuf::from("/path/to/data/dir")), + is_debug: true, + max_panes: Some(4), + force_run_layout_commands: true, + cwd: Some(PathBuf::from("/path/to/cwd")), + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + config_file_path: Some(PathBuf::from("/path/to/config/file.kdl")), + config_dir: Some(PathBuf::from("/path/to/config/dir")), + should_ignore_config: true, + configuration_options: Some(Options { + simplified_ui: Some(true), + theme: Some("theme".to_owned()), + default_mode: Some(InputMode::Normal), + default_shell: Some(PathBuf::from("default_shell")), + default_cwd: Some(PathBuf::from("default_cwd")), + default_layout: Some(PathBuf::from("default_layout")), + layout_dir: Some(PathBuf::from("layout_dir")), + theme_dir: Some(PathBuf::from("theme_dir")), + mouse_mode: Some(true), + pane_frames: Some(true), + mirror_session: Some(true), + on_force_close: Some(OnForceClose::Quit), + scroll_buffer_size: Some(100000), + copy_command: Some("copy_command".to_owned()), + copy_clipboard: Some(Clipboard::System), + copy_on_select: Some(true), + scrollback_editor: Some(PathBuf::from("scrollback_editor")), + session_name: Some("session_name".to_owned()), + attach_to_session: Some(true), + auto_layout: Some(true), + session_serialization: Some(true), + serialize_pane_viewport: Some(true), + scrollback_lines_to_serialize: Some(10000), + styled_underlines: Some(true), + serialization_interval: Some(1), + disable_session_metadata: Some(true), + support_kitty_keyboard_protocol: Some(true), + web_server: Some(true), + web_sharing: Some(WebSharing::On), + stacked_resize: Some(true), + show_startup_tips: Some(true), + show_release_notes: Some(true), + advanced_mouse_actions: Some(true), + web_server_ip: Some("1.1.1.1".parse().unwrap()), + web_server_port: Some(8080), + web_server_cert: Some(PathBuf::from("web_server_cert")), + web_server_key: Some(PathBuf::from("web_server_key")), + enforce_https_for_localhost: Some(true), + post_command_discovery_hook: Some("post_command_discovery_hook".to_owned()), + }), + layout: None, + terminal_window_size: Size { rows: 80, cols: 42 }, + data_dir: Some(PathBuf::from("/path/to/data/dir")), + is_debug: true, + max_panes: Some(4), + force_run_layout_commands: true, + cwd: Some(PathBuf::from("/path/to/cwd")), + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Normal), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Locked), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Resize), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Pane), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Tab), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Scroll), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::EnterSearch), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Search), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::RenameTab), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::RenamePane), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Session), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Move), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Prompt), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + default_mode: Some(InputMode::Tmux), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + on_force_close: Some(OnForceClose::Detach), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + copy_clipboard: Some(Clipboard::Primary), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + web_sharing: Some(WebSharing::Off), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::FirstClientConnected { + cli_assets: CliAssets { + configuration_options: Some(Options { + web_sharing: Some(WebSharing::Disabled), + ..Default::default() + }), + ..Default::default() + }, + is_web_client: true, + }); + test_client_roundtrip!(ClientToServerMsg::AttachClient { + // cli_assets tested extensively ijn FirstClientConnected, we can skip it here + cli_assets: CliAssets::default(), + tab_position_to_focus: None, + pane_to_focus: None, + is_web_client: false, + }); + test_client_roundtrip!(ClientToServerMsg::AttachClient { + cli_assets: CliAssets::default(), + tab_position_to_focus: Some(0), + pane_to_focus: None, + is_web_client: false, + }); + test_client_roundtrip!(ClientToServerMsg::AttachClient { + cli_assets: CliAssets::default(), + tab_position_to_focus: None, + pane_to_focus: Some(PaneReference { + pane_id: 0, + is_plugin: false, + }), + is_web_client: false, + }); + test_client_roundtrip!(ClientToServerMsg::AttachClient { + cli_assets: CliAssets::default(), + tab_position_to_focus: None, + pane_to_focus: Some(PaneReference { + pane_id: 100, + is_plugin: true, + }), + is_web_client: true, + }); + // TODO: Action + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Quit, + terminal_id: None, + client_id: None, + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Quit, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Write { + key_with_modifier: None, + bytes: vec![], + is_kitty_keyboard_protocol: false, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Write { + // KeyWithModifier is tested extensively in the Key ClientToServerMsg + key_with_modifier: Some(KeyWithModifier::new(BareKey::Char('a'))), + bytes: "a".as_bytes().to_vec(), + is_kitty_keyboard_protocol: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::WriteChars { + chars: "my chars".to_owned(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SwitchToMode { + // InputMode is tested extensively in the Options conversion tests above + input_mode: InputMode::Locked, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SwitchModeForAllClients { + // InputMode is tested extensively in the Options conversion tests above + input_mode: InputMode::Locked, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Resize { + resize: Resize::Increase, + direction: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Resize { + resize: Resize::Decrease, + direction: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Left), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Right), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Up), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Resize { + resize: Resize::Decrease, + direction: Some(Direction::Down), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::FocusNextPane, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::FocusPreviousPane, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SwitchFocus, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MoveFocus { + // Direction is tested extensively elsewhere + direction: Direction::Up, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MoveFocusOrTab { + direction: Direction::Up, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MovePane { direction: None }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MovePane { + direction: Some(Direction::Up), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MovePaneBackwards, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ClearScreen, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::DumpScreen { + file_path: "/path/to/file".to_owned(), + include_scrollback: false, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::DumpScreen { + file_path: "/path/to/file".to_owned(), + include_scrollback: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::DumpLayout, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditScrollback, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ScrollUp, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ScrollUpAt { + position: Position::new(0, 0), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ScrollUpAt { + position: Position::new(-10, 0), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ScrollDown, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ScrollDownAt { + position: Position::new(0, 0), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ScrollToBottom, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ScrollToTop, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::PageScrollUp, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::PageScrollDown, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::HalfPageScrollUp, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::HalfPageScrollDown, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ToggleFocusFullscreen, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::TogglePaneFrames, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ToggleActiveSyncTab, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewPane { + direction: Some(Direction::Right), + pane_name: Some("pane_name".to_owned()), + start_suppressed: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: None, + cwd: None, + originating_plugin: None, + }, + direction: None, + floating: false, + in_place: false, + start_suppressed: false, + coordinates: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: Some(1), + cwd: Some(PathBuf::from("/my/cwd")), + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: empty_context.clone(), + }) + }, + direction: None, + floating: false, + in_place: false, + start_suppressed: false, + coordinates: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: Some(1), + cwd: Some(PathBuf::from("/my/cwd")), + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: demo_context.clone(), + }) + }, + direction: None, + floating: false, + in_place: false, + start_suppressed: false, + coordinates: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: Some(1), + cwd: Some(PathBuf::from("/my/cwd")), + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: demo_context.clone(), + }) + }, + direction: Some(Direction::Right), + floating: true, + in_place: true, + start_suppressed: true, + coordinates: FloatingPaneCoordinates::new(None, None, None, None, None), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: Some(1), + cwd: Some(PathBuf::from("/my/cwd")), + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: demo_context.clone(), + }) + }, + direction: Some(Direction::Right), + floating: true, + in_place: true, + start_suppressed: true, + coordinates: FloatingPaneCoordinates::new( + Some("100%".to_owned()), + None, + None, + None, + None + ), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: Some(1), + cwd: Some(PathBuf::from("/my/cwd")), + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: demo_context.clone(), + }) + }, + direction: Some(Direction::Right), + floating: true, + in_place: true, + start_suppressed: true, + coordinates: FloatingPaneCoordinates::new( + Some("10".to_owned()), + None, + None, + None, + None + ), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: Some(1), + cwd: Some(PathBuf::from("/my/cwd")), + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: demo_context.clone(), + }) + }, + direction: Some(Direction::Right), + floating: true, + in_place: true, + start_suppressed: true, + coordinates: FloatingPaneCoordinates::new( + Some("10".to_owned()), + Some("50%".to_owned()), + Some("10".to_owned()), + Some("20".to_owned()), + Some(true) + ), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::EditFile { + payload: OpenFilePayload { + path: PathBuf::from("/file/path"), + line_number: Some(1), + cwd: Some(PathBuf::from("/my/cwd")), + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: demo_context.clone(), + }) + }, + direction: Some(Direction::Right), + floating: true, + in_place: true, + start_suppressed: true, + coordinates: FloatingPaneCoordinates::new(None, None, None, None, Some(false)), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewFloatingPane { + command: None, + pane_name: None, + coordinates: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewFloatingPane { + command: Some(RunCommandAction { + command: PathBuf::from("/path/to/command"), + args: vec![], + cwd: None, + direction: None, + hold_on_close: false, + hold_on_start: false, + originating_plugin: None, + use_terminal_title: false, + }), + pane_name: Some("my_pane_name".to_owned()), + coordinates: FloatingPaneCoordinates::new( + Some("10".to_owned()), + None, + None, + None, + None + ) + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewFloatingPane { + command: Some(RunCommandAction { + command: PathBuf::from("/path/to/command"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + cwd: Some(PathBuf::from("/path/to/cwd")), + direction: Some(Direction::Right), + hold_on_close: true, + hold_on_start: true, + originating_plugin: Some(OriginatingPlugin { + plugin_id: 1, + client_id: 2, + context: demo_context.clone(), + }), + use_terminal_title: false, + }), + pane_name: Some("my_pane_name".to_owned()), + coordinates: FloatingPaneCoordinates::new( + Some("10".to_owned()), + None, + None, + None, + None + ) + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTiledPane { + command: None, + direction: None, + pane_name: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTiledPane { + command: Some(RunCommandAction { + command: PathBuf::from("/path/to/command"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + cwd: Some(PathBuf::from("/path/to/cwd")), + direction: Some(Direction::Right), + hold_on_close: true, + hold_on_start: true, + originating_plugin: Some(OriginatingPlugin { + plugin_id: 1, + client_id: 2, + context: demo_context.clone(), + }), + use_terminal_title: false, + }), + direction: Some(Direction::Right), + pane_name: Some("my_pane_name".to_owned()), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewInPlacePane { + command: Some(RunCommandAction { + command: PathBuf::from("/path/to/command"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + cwd: Some(PathBuf::from("/path/to/cwd")), + direction: Some(Direction::Right), + hold_on_close: true, + hold_on_start: true, + originating_plugin: Some(OriginatingPlugin { + plugin_id: 1, + client_id: 2, + context: demo_context.clone(), + }), + use_terminal_title: false, + }), + pane_name: Some("my_pane_name".to_owned()), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewInPlacePane { + command: None, + pane_name: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewStackedPane { + command: Some(RunCommandAction { + command: PathBuf::from("/path/to/command"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + cwd: Some(PathBuf::from("/path/to/cwd")), + direction: Some(Direction::Right), + hold_on_close: true, + hold_on_start: true, + originating_plugin: Some(OriginatingPlugin { + plugin_id: 1, + client_id: 2, + context: demo_context.clone(), + }), + use_terminal_title: false, + }), + pane_name: Some("my_pane_name".to_owned()), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewStackedPane { + command: None, + pane_name: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::TogglePaneEmbedOrFloating, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ToggleFloatingPanes, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::CloseFocus, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::PaneNameInput { + input: "name input".as_bytes().to_vec(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::UndoRenamePane, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout::default()), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + children_split_direction: SplitDirection::Vertical, + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + children_split_direction: SplitDirection::Horizontal, + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + children_split_direction: SplitDirection::Horizontal, + name: Some("tiled_layout_name".to_owned()), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + children: vec![ + TiledPaneLayout { + name: Some("first_item_in_vec".to_owned()), + ..Default::default() + }, + TiledPaneLayout { + name: Some("second_item_in_vec".to_owned()), + ..Default::default() + }, + TiledPaneLayout { + name: Some("third_item_in_vec".to_owned()), + ..Default::default() + }, + ], + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + split_size: Some(SplitSize::Fixed(1)), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + split_size: Some(SplitSize::Percent(50)), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin( + RunPlugin::default() + ))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + _allow_exec_host_cmd: true, + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + location: RunPluginLocation::File(PathBuf::from("/my/plugin/location")), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + location: RunPluginLocation::Zellij(PluginTag::new("my_plugin_tag")), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + location: RunPluginLocation::Remote("my_remote_url".to_owned()), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + configuration: PluginUserConfiguration::new(demo_context.clone()), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + configuration: PluginUserConfiguration::new(demo_context.clone()), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + configuration: PluginUserConfiguration::new(empty_context.clone()), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::RunPlugin(RunPlugin { + initial_cwd: Some(PathBuf::from("/initial/cwd")), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::Alias(PluginAlias::default()))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Plugin(RunPluginOrAlias::Alias(PluginAlias { + name: "alias name".to_owned(), + configuration: Some(PluginUserConfiguration::new(demo_context.clone())), + initial_cwd: Some(PathBuf::from("initial_cwd")), + run_plugin: Some(RunPlugin::default()), + ..Default::default() + }))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Command(RunCommand { + command: PathBuf::from("/path/to/command"), + args: vec![], + cwd: None, + hold_on_close: false, + hold_on_start: false, + originating_plugin: None, + use_terminal_title: true, + })), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Command(RunCommand { + command: PathBuf::from("/path/to/command"), + args: vec!["arg1".to_owned(), "arg2".to_owned(), "arg3".to_owned()], + cwd: Some(PathBuf::from("/path/to/cwd")), + hold_on_close: true, + hold_on_start: true, + originating_plugin: Some(OriginatingPlugin { + plugin_id: 11, + client_id: 22, + context: empty_context.clone(), + }), + use_terminal_title: true, + })), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::EditFile(PathBuf::from("/path/to/file"), None, None)), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::EditFile( + PathBuf::from("/path/to/file"), + Some(10), + Some(PathBuf::from("/path")) + )), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: Some(TiledPaneLayout { + run: Some(Run::Cwd(PathBuf::from("/path/to/cwd"))), + ..Default::default() + }), + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: None, + floating_layouts: vec![ + FloatingPaneLayout { + name: Some("first floating layout".to_owned()), + ..Default::default() + }, + FloatingPaneLayout { + name: Some("third floating layout".to_owned()), + height: Some(PercentOrFixed::Percent(10)), + width: Some(PercentOrFixed::Fixed(20)), + x: Some(PercentOrFixed::Percent(30)), + y: Some(PercentOrFixed::Percent(40)), + pinned: Some(true), + run: Some(Run::Cwd(PathBuf::from("/path/to/cwd"))), + focus: Some(true), + already_running: true, + pane_initial_contents: Some("pane_initial_contents".to_owned()), + logical_position: Some(15), + }, + FloatingPaneLayout { + name: Some("third floating layout".to_owned()), + ..Default::default() + }, + FloatingPaneLayout::default(), + ], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: Some(vec![ + swap_tiled_layouts_1.clone(), + swap_tiled_layouts_2.clone(), + swap_tiled_layouts_3.clone() + ]), + swap_floating_layouts: Some(vec![ + swap_floating_layouts_1, + swap_floating_layouts_2, + swap_floating_layouts_3 + ]), + tab_name: None, + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: Some("tab_name".to_owned()), + should_change_focus_to_new_tab: false, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: Some(PathBuf::from("relative/path/to/cwd")), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NoOp, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::GoToNextTab, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::GoToPreviousTab, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::CloseTab, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::GoToTab { index: 0 }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::GoToTabName { + name: "tab_name".to_owned(), + create: false, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::GoToTabName { + name: "tab_name".to_owned(), + create: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ToggleTab, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::TabNameInput { + input: "my cool tab_name".as_bytes().to_vec(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::UndoRenameTab, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MoveTab { + direction: Direction::Right, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Run { + // RunCommandAction serialization roundtrip is tested extensively upwards of here + command: RunCommandAction { + command: PathBuf::from("/path/to/command"), + args: vec![], + cwd: None, + direction: None, + hold_on_close: false, + hold_on_start: false, + originating_plugin: None, + use_terminal_title: false, + }, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Detach, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::LaunchOrFocusPlugin { + // RunPluginOrAlias serialization roundtrip is tested extensively upwards + plugin: RunPluginOrAlias::RunPlugin(RunPlugin::default()), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: true, + skip_cache: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::LaunchOrFocusPlugin { + // RunPluginOrAlias serialization roundtrip is tested extensively upwards + plugin: RunPluginOrAlias::Alias(PluginAlias::default()), + should_float: false, + move_to_focused_tab: false, + should_open_in_place: false, + skip_cache: false, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::LaunchPlugin { + // RunPluginOrAlias serialization roundtrip is tested extensively upwards + plugin: RunPluginOrAlias::RunPlugin(RunPlugin::default()), + should_float: true, + should_open_in_place: true, + skip_cache: true, + cwd: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::LaunchPlugin { + // RunPluginOrAlias serialization roundtrip is tested extensively upwards + plugin: RunPluginOrAlias::Alias(PluginAlias::default()), + should_float: false, + should_open_in_place: false, + skip_cache: false, + cwd: Some(PathBuf::from("/path/to/cwd")), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MouseEvent { + event: MouseEvent { + event_type: MouseEventType::Motion, + left: true, + right: true, + middle: true, + wheel_up: true, + wheel_down: true, + shift: true, + alt: true, + ctrl: true, + position: Position::new(-10, 0), + } + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MouseEvent { + event: MouseEvent { + event_type: MouseEventType::Press, + left: true, + right: true, + middle: true, + wheel_up: true, + wheel_down: true, + shift: true, + alt: true, + ctrl: true, + position: Position::new(-10, 0), + } + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::MouseEvent { + event: MouseEvent { + event_type: MouseEventType::Release, + left: true, + right: true, + middle: true, + wheel_up: true, + wheel_down: true, + shift: true, + alt: true, + ctrl: true, + position: Position::new(10, 0), + } + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Copy, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Confirm, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Deny, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SkipConfirm { + action: Box::new(Action::Quit) + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SearchInput { + input: "my_search_input".as_bytes().to_vec(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Search { + direction: SearchDirection::Up, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::Search { + direction: SearchDirection::Down, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SearchToggleOption { + option: SearchOption::CaseSensitivity, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SearchToggleOption { + option: SearchOption::WholeWord, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::SearchToggleOption { + option: SearchOption::Wrap, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ToggleMouseMode, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::PreviousSwapLayout, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NextSwapLayout, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::QueryTabNames, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewTiledPluginPane { + plugin: RunPluginOrAlias::Alias(PluginAlias::default()), + pane_name: Some("my_pane_name".to_owned()), + skip_cache: false, + cwd: Some(PathBuf::from("relative/path/to/cwd")), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewFloatingPluginPane { + plugin: RunPluginOrAlias::RunPlugin(RunPlugin::default()), + pane_name: Some("my_pane_name".to_owned()), + skip_cache: true, + cwd: Some(PathBuf::from("relative/path/to/cwd")), + coordinates: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewFloatingPluginPane { + plugin: RunPluginOrAlias::Alias(PluginAlias::default()), + pane_name: Some("my_pane_name".to_owned()), + skip_cache: true, + cwd: Some(PathBuf::from("relative/path/to/cwd")), + coordinates: FloatingPaneCoordinates::new( + Some("10".to_owned()), + Some("10%".to_owned()), + None, + None, + Some(true) + ), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::NewInPlacePluginPane { + plugin: RunPluginOrAlias::Alias(PluginAlias::default()), + pane_name: Some("my_pane_name".to_owned()), + skip_cache: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::StartOrReloadPlugin { + plugin: RunPluginOrAlias::Alias(PluginAlias::default()), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::CloseTerminalPane { pane_id: 11 }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ClosePluginPane { pane_id: 12 }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::FocusTerminalPaneWithId { + pane_id: 12, + should_float_if_hidden: false, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::FocusTerminalPaneWithId { + pane_id: 12, + should_float_if_hidden: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::FocusPluginPaneWithId { + pane_id: 12, + should_float_if_hidden: false, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::FocusPluginPaneWithId { + pane_id: 12, + should_float_if_hidden: true, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::RenameTerminalPane { + pane_id: 12, + name: "terminal_pane_new_name".as_bytes().to_vec(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::RenamePluginPane { + pane_id: 12, + name: "plugin_pane_new_name".as_bytes().to_vec(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::RenameTab { + tab_index: 11, + name: "tab_new_name".as_bytes().to_vec(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::BreakPane, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::BreakPaneRight, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::BreakPaneLeft, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::RenameSession { + name: "new_session_name".to_owned(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::CliPipe { + pipe_id: "pipe_id_name".to_owned(), + name: None, + payload: None, + args: None, + plugin: None, + configuration: None, + launch_new: false, + skip_cache: false, + floating: None, + in_place: None, + cwd: None, + pane_title: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::CliPipe { + pipe_id: "pipe_id_name".to_owned(), + name: Some("pipe_name".to_owned()), + payload: Some("pipe_payload".to_owned()), + args: Some(demo_context.clone()), + plugin: Some("zellij:status-bare".to_owned()), + configuration: Some(demo_context.to_owned()), + launch_new: true, + skip_cache: true, + floating: Some(true), + in_place: Some(false), + cwd: Some(PathBuf::from("/path/to/cwd")), + pane_title: Some("pane_title".to_owned()), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::KeybindPipe { + plugin_id: None, + name: None, + payload: None, + args: None, + plugin: None, + configuration: None, + launch_new: false, + skip_cache: false, + floating: None, + in_place: None, + cwd: None, + pane_title: None, + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::KeybindPipe { + plugin_id: Some(112), + name: Some("pipe_name".to_owned()), + payload: Some("pipe_payload".to_owned()), + args: Some(demo_context.clone()), + plugin: Some("zellij:status-bare".to_owned()), + configuration: Some(demo_context.to_owned()), + launch_new: true, + skip_cache: true, + floating: Some(true), + in_place: Some(false), + cwd: Some(PathBuf::from("/path/to/cwd")), + pane_title: Some("pane_title".to_owned()), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ListClients, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::TogglePanePinned, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::StackPanes { pane_ids: vec![] }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::StackPanes { + pane_ids: vec![ + PaneId::Terminal(0), + PaneId::Plugin(1), + PaneId::Terminal(2), + PaneId::Plugin(3) + ], + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ChangeFloatingPaneCoordinates { + pane_id: PaneId::Terminal(0), + coordinates: FloatingPaneCoordinates::new( + None, + None, + None, + Some("10%".to_owned()), + Some(false) + ) + .unwrap(), + }, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::TogglePaneInGroup, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Action { + action: Action::ToggleGroupMarking, + terminal_id: Some(1), + client_id: Some(100), + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::PageDown, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::PageDown, + key_modifiers: demo_modifiers_1, + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::PageDown, + key_modifiers: demo_modifiers_2, + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::PageDown, + key_modifiers: demo_modifiers_3, + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::PageDown, + key_modifiers: demo_modifiers_4, + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::PageUp, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Down, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Up, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Right, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Home, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::End, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Backspace, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Delete, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Insert, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Tab, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Esc, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Enter, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::CapsLock, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::ScrollLock, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::NumLock, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::PrintScreen, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Pause, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Menu, + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(1), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(2), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(3), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(4), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(5), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(6), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(7), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(8), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(9), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(10), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(11), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::F(12), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::Key { + key: KeyWithModifier { + bare_key: BareKey::Char('a'), + key_modifiers: BTreeSet::new(), + }, + raw_bytes: "raw_bytes".as_bytes().to_vec(), + is_kitty_keyboard_protocol: false, + }); + test_client_roundtrip!(ClientToServerMsg::ClientExited); + test_client_roundtrip!(ClientToServerMsg::KillSession); + test_client_roundtrip!(ClientToServerMsg::ConnStatus); + test_client_roundtrip!(ClientToServerMsg::WebServerStarted { + base_url: "http://localhost:8080".to_string(), + }); + test_client_roundtrip!(ClientToServerMsg::FailedToStartWebServer { + error: "Port already in use".to_string(), + }); +} + +fn test_server_messages() { + test_server_roundtrip!(ServerToClientMsg::Render { + content: "Hello, World!".to_string(), + }); + test_server_roundtrip!(ServerToClientMsg::Render { + content: "".to_string(), + }); + test_server_roundtrip!(ServerToClientMsg::Render { + content: "x".repeat(10000), + }); + test_server_roundtrip!(ServerToClientMsg::UnblockInputThread); + test_server_roundtrip!(ServerToClientMsg::Connected); + test_server_roundtrip!(ServerToClientMsg::QueryTerminalSize); + test_server_roundtrip!(ServerToClientMsg::StartWebServer); + test_server_roundtrip!(ServerToClientMsg::ConfigFileUpdated); + test_server_roundtrip!(ServerToClientMsg::RenamedSession { + name: "my-session".to_string(), + }); + test_server_roundtrip!(ServerToClientMsg::UnblockCliPipeInput { + pipe_name: "stdout".to_string(), + }); + test_server_roundtrip!(ServerToClientMsg::CliPipeOutput { + pipe_name: "stderr".to_string(), + output: "Error occurred\n".to_string(), + }); + test_server_roundtrip!(ServerToClientMsg::Exit { + exit_reason: ExitReason::Normal, + }); + test_server_roundtrip!(ServerToClientMsg::Exit { + exit_reason: ExitReason::Error("Something went wrong".to_string()), + }); + test_server_roundtrip!(ServerToClientMsg::Exit { + exit_reason: ExitReason::NormalDetached, + }); + test_server_roundtrip!(ServerToClientMsg::Exit { + exit_reason: ExitReason::ForceDetached, + }); + test_server_roundtrip!(ServerToClientMsg::Exit { + exit_reason: ExitReason::CannotAttach, + }); + test_server_roundtrip!(ServerToClientMsg::Exit { + exit_reason: ExitReason::Disconnect, + }); + test_server_roundtrip!(ServerToClientMsg::Exit { + exit_reason: ExitReason::WebClientsForbidden, + }); + test_server_roundtrip!(ServerToClientMsg::Log { lines: vec![] }); + test_server_roundtrip!(ServerToClientMsg::Log { + lines: vec![ + "Starting server...".to_string(), + "Server ready on port 8080".to_string(), + "Accepting connections".to_string(), + ], + }); + test_server_roundtrip!(ServerToClientMsg::LogError { lines: vec![] }); + test_server_roundtrip!(ServerToClientMsg::LogError { + lines: vec![ + "ERROR: Failed to bind socket".to_string(), + "ERROR: Retrying in 5 seconds".to_string(), + ], + }); + test_server_roundtrip!(ServerToClientMsg::SwitchSession { + connect_to_session: ConnectToSession::default(), + }); + test_server_roundtrip!(ServerToClientMsg::SwitchSession { + connect_to_session: ConnectToSession { + name: Some("new_session_name".to_owned()), + tab_position: Some(5), + pane_id: Some((5, true)), + layout: Some(LayoutInfo::BuiltIn("compact".to_owned())), + cwd: Some(PathBuf::from("/path/to/cwd")), + } + }); + test_server_roundtrip!(ServerToClientMsg::SwitchSession { + connect_to_session: ConnectToSession { + name: Some("new_session_name".to_owned()), + tab_position: Some(5), + pane_id: Some((5, true)), + layout: Some(LayoutInfo::File("/path/to/my/file.kdl".to_owned())), + cwd: Some(PathBuf::from("/path/to/cwd")), + } + }); + test_server_roundtrip!(ServerToClientMsg::SwitchSession { + connect_to_session: ConnectToSession { + name: Some("new_session_name".to_owned()), + tab_position: Some(5), + pane_id: Some((5, true)), + layout: Some(LayoutInfo::Url("https://example.com/layout.kdl".to_owned())), + cwd: Some(PathBuf::from("/path/to/cwd")), + } + }); + test_server_roundtrip!(ServerToClientMsg::SwitchSession { + connect_to_session: ConnectToSession { + name: Some("new_session_name".to_owned()), + tab_position: Some(5), + pane_id: Some((5, true)), + layout: Some(LayoutInfo::Stringified( + "layout { pane; pane; pane; }".to_owned() + )), + cwd: Some(PathBuf::from("/path/to/cwd")), + } + }); +} diff --git a/zellij-utils/src/ipc/tests/test_framework.rs b/zellij-utils/src/ipc/tests/test_framework.rs new file mode 100644 index 00000000..8c6c024a --- /dev/null +++ b/zellij-utils/src/ipc/tests/test_framework.rs @@ -0,0 +1,27 @@ +/// Macro for testing round-trip conversion for ClientToServerMsg variants +macro_rules! test_client_roundtrip { + ($msg:expr) => {{ + let original: crate::ipc::ClientToServerMsg = $msg; + let proto: crate::client_server_contract::client_server_contract::ClientToServerMsg = + original.clone().into(); + let roundtrip: crate::ipc::ClientToServerMsg = proto + .try_into() + .expect("Failed to convert back from protobuf"); + assert_eq!(original, roundtrip); + }}; +} + +/// Macro for testing round-trip conversion for ServerToClientMsg variants +macro_rules! test_server_roundtrip { + ($msg:expr) => {{ + let original: crate::ipc::ServerToClientMsg = $msg; + let proto: crate::client_server_contract::client_server_contract::ServerToClientMsg = + original.clone().into(); + let roundtrip: crate::ipc::ServerToClientMsg = proto + .try_into() + .expect("Failed to convert back from protobuf"); + assert_eq!(original, roundtrip); + }}; +} + +pub(crate) use {test_client_roundtrip, test_server_roundtrip}; diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index 7ac9af09..ad541a48 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -414,10 +414,14 @@ impl Action { action_node: &KdlNode, ) -> Result<Self, ConfigError> { match action_name { - "Write" => Ok(Action::Write(None, bytes, false)), - "PaneNameInput" => Ok(Action::PaneNameInput(bytes)), - "TabNameInput" => Ok(Action::TabNameInput(bytes)), - "SearchInput" => Ok(Action::SearchInput(bytes)), + "Write" => Ok(Action::Write { + key_with_modifier: None, + bytes, + is_kitty_keyboard_protocol: false, + }), + "PaneNameInput" => Ok(Action::PaneNameInput { input: bytes }), + "TabNameInput" => Ok(Action::TabNameInput { input: bytes }), + "SearchInput" => Ok(Action::SearchInput { input: bytes }), "GoToTab" => { let tab_index = *bytes.get(0).ok_or_else(|| { ConfigError::new_kdl_error( @@ -426,7 +430,7 @@ impl Action { action_node.span().len(), ) })? as u32; - Ok(Action::GoToTab(tab_index)) + Ok(Action::GoToTab { index: tab_index }) }, _ => Err(ConfigError::new_kdl_error( "Failed to parse action".into(), @@ -441,9 +445,9 @@ impl Action { action_node: &KdlNode, ) -> Result<Self, ConfigError> { match action_name { - "WriteChars" => Ok(Action::WriteChars(string)), + "WriteChars" => Ok(Action::WriteChars { chars: string }), "SwitchToMode" => match InputMode::from_str(string.as_str()) { - Ok(input_mode) => Ok(Action::SwitchToMode(input_mode)), + Ok(input_mode) => Ok(Action::SwitchToMode { input_mode }), Err(_e) => { return Err(ConfigError::new_kdl_error( format!("Unknown InputMode '{}'", string), @@ -474,7 +478,7 @@ impl Action { } } let resize = resize.unwrap_or(Resize::Increase); - Ok(Action::Resize(resize, direction)) + Ok(Action::Resize { resize, direction }) }, "MoveFocus" => { let direction = Direction::from_str(string.as_str()).map_err(|_| { @@ -484,7 +488,7 @@ impl Action { action_node.span().len(), ) })?; - Ok(Action::MoveFocus(direction)) + Ok(Action::MoveFocus { direction }) }, "MoveFocusOrTab" => { let direction = Direction::from_str(string.as_str()).map_err(|_| { @@ -494,7 +498,7 @@ impl Action { action_node.span().len(), ) })?; - Ok(Action::MoveFocusOrTab(direction)) + Ok(Action::MoveFocusOrTab { direction }) }, "MoveTab" => { let direction = Direction::from_str(string.as_str()).map_err(|_| { @@ -511,12 +515,12 @@ impl Action { action_node.span().len(), )) } else { - Ok(Action::MoveTab(direction)) + Ok(Action::MoveTab { direction }) } }, "MovePane" => { if string.is_empty() { - return Ok(Action::MovePane(None)); + return Ok(Action::MovePane { direction: None }); } else { let direction = Direction::from_str(string.as_str()).map_err(|_| { ConfigError::new_kdl_error( @@ -525,17 +529,29 @@ impl Action { action_node.span().len(), ) })?; - Ok(Action::MovePane(Some(direction))) + Ok(Action::MovePane { + direction: Some(direction), + }) } }, "MovePaneBackwards" => Ok(Action::MovePaneBackwards), - "DumpScreen" => Ok(Action::DumpScreen(string, false)), + "DumpScreen" => Ok(Action::DumpScreen { + file_path: string, + include_scrollback: false, + }), "DumpLayout" => Ok(Action::DumpLayout), "NewPane" => { if string.is_empty() { - return Ok(Action::NewPane(None, None, false)); + return Ok(Action::NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }); } else if string == "stacked" { - return Ok(Action::NewStackedPane(None, None)); + return Ok(Action::NewStackedPane { + command: None, + pane_name: None, + }); } else { let direction = Direction::from_str(string.as_str()).map_err(|_| { ConfigError::new_kdl_error( @@ -544,7 +560,11 @@ impl Action { action_node.span().len(), ) })?; - Ok(Action::NewPane(Some(direction), None, false)) + Ok(Action::NewPane { + direction: Some(direction), + pane_name: None, + start_suppressed: false, + }) } }, "SearchToggleOption" => { @@ -555,7 +575,9 @@ impl Action { action_node.span().len(), ) })?; - Ok(Action::SearchToggleOption(toggle_option)) + Ok(Action::SearchToggleOption { + option: toggle_option, + }) }, "Search" => { let search_direction = @@ -566,9 +588,11 @@ impl Action { action_node.span().len(), ) })?; - Ok(Action::Search(search_direction)) + Ok(Action::Search { + direction: search_direction, + }) }, - "RenameSession" => Ok(Action::RenameSession(string)), + "RenameSession" => Ok(Action::RenameSession { name: string }), _ => Err(ConfigError::new_kdl_error( format!("Unsupported action: {}", action_name), action_node.span().offset(), @@ -579,24 +603,31 @@ impl Action { pub fn to_kdl(&self) -> Option<KdlNode> { match self { Action::Quit => Some(KdlNode::new("Quit")), - Action::Write(_key, bytes, _is_kitty) => { + Action::Write { + key_with_modifier: _key, + bytes, + is_kitty_keyboard_protocol: _is_kitty, + } => { let mut node = KdlNode::new("Write"); for byte in bytes { node.push(KdlValue::Base10(*byte as i64)); } Some(node) }, - Action::WriteChars(string) => { + Action::WriteChars { chars: string } => { let mut node = KdlNode::new("WriteChars"); node.push(string.clone()); Some(node) }, - Action::SwitchToMode(input_mode) => { + Action::SwitchToMode { input_mode } => { let mut node = KdlNode::new("SwitchToMode"); node.push(format!("{:?}", input_mode).to_lowercase()); Some(node) }, - Action::Resize(resize, resize_direction) => { + Action::Resize { + resize, + direction: resize_direction, + } => { let mut node = KdlNode::new("Resize"); let resize = match resize { Resize::Increase => "Increase", @@ -618,7 +649,7 @@ impl Action { Action::FocusNextPane => Some(KdlNode::new("FocusNextPane")), Action::FocusPreviousPane => Some(KdlNode::new("FocusPreviousPane")), Action::SwitchFocus => Some(KdlNode::new("SwitchFocus")), - Action::MoveFocus(direction) => { + Action::MoveFocus { direction } => { let mut node = KdlNode::new("MoveFocus"); let direction = match direction { Direction::Left => "left", @@ -629,7 +660,7 @@ impl Action { node.push(direction); Some(node) }, - Action::MoveFocusOrTab(direction) => { + Action::MoveFocusOrTab { direction } => { let mut node = KdlNode::new("MoveFocusOrTab"); let direction = match direction { Direction::Left => "left", @@ -640,7 +671,7 @@ impl Action { node.push(direction); Some(node) }, - Action::MovePane(direction) => { + Action::MovePane { direction } => { let mut node = KdlNode::new("MovePane"); if let Some(direction) = direction { let direction = match direction { @@ -654,7 +685,10 @@ impl Action { Some(node) }, Action::MovePaneBackwards => Some(KdlNode::new("MovePaneBackwards")), - Action::DumpScreen(file, _) => { + Action::DumpScreen { + file_path: file, + include_scrollback: _, + } => { let mut node = KdlNode::new("DumpScreen"); node.push(file.clone()); Some(node) @@ -672,7 +706,11 @@ impl Action { Action::ToggleFocusFullscreen => Some(KdlNode::new("ToggleFocusFullscreen")), Action::TogglePaneFrames => Some(KdlNode::new("TogglePaneFrames")), Action::ToggleActiveSyncTab => Some(KdlNode::new("ToggleActiveSyncTab")), - Action::NewPane(direction, _, _) => { + Action::NewPane { + direction, + pane_name: _, + start_suppressed: _, + } => { let mut node = KdlNode::new("NewPane"); if let Some(direction) = direction { let direction = match direction { @@ -688,7 +726,7 @@ impl Action { Action::TogglePaneEmbedOrFloating => Some(KdlNode::new("TogglePaneEmbedOrFloating")), Action::ToggleFloatingPanes => Some(KdlNode::new("ToggleFloatingPanes")), Action::CloseFocus => Some(KdlNode::new("CloseFocus")), - Action::PaneNameInput(bytes) => { + Action::PaneNameInput { input: bytes } => { let mut node = KdlNode::new("PaneNameInput"); for byte in bytes { node.push(KdlValue::Base10(*byte as i64)); @@ -696,7 +734,15 @@ impl Action { Some(node) }, Action::UndoRenamePane => Some(KdlNode::new("UndoRenamePane")), - Action::NewTab(_, _, _, _, name, should_change_focus_to_new_tab, cwd) => { + Action::NewTab { + tiled_layout: _, + floating_layouts: _, + swap_tiled_layouts: _, + swap_floating_layouts: _, + tab_name: name, + should_change_focus_to_new_tab, + cwd, + } => { let mut node = KdlNode::new("NewTab"); let mut children = KdlDocument::new(); if let Some(name) = name { @@ -725,13 +771,13 @@ impl Action { Action::GoToNextTab => Some(KdlNode::new("GoToNextTab")), Action::GoToPreviousTab => Some(KdlNode::new("GoToPreviousTab")), Action::CloseTab => Some(KdlNode::new("CloseTab")), - Action::GoToTab(index) => { + Action::GoToTab { index } => { let mut node = KdlNode::new("GoToTab"); node.push(KdlValue::Base10(*index as i64)); Some(node) }, Action::ToggleTab => Some(KdlNode::new("ToggleTab")), - Action::TabNameInput(bytes) => { + Action::TabNameInput { input: bytes } => { let mut node = KdlNode::new("TabNameInput"); for byte in bytes { node.push(KdlValue::Base10(*byte as i64)); @@ -739,7 +785,7 @@ impl Action { Some(node) }, Action::UndoRenameTab => Some(KdlNode::new("UndoRenameTab")), - Action::MoveTab(direction) => { + Action::MoveTab { direction } => { let mut node = KdlNode::new("MoveTab"); let direction = match direction { Direction::Left => "left", @@ -750,7 +796,11 @@ impl Action { node.push(direction); Some(node) }, - Action::NewTiledPane(direction, run_command_action, name) => { + Action::NewTiledPane { + direction, + command: run_command_action, + pane_name: name, + } => { let mut node = KdlNode::new("Run"); let mut node_children = KdlDocument::new(); if let Some(run_command_action) = run_command_action { @@ -795,7 +845,11 @@ impl Action { } Some(node) }, - Action::NewFloatingPane(run_command_action, name, floating_pane_coordinates) => { + Action::NewFloatingPane { + command: run_command_action, + pane_name: name, + coordinates: floating_pane_coordinates, + } => { let mut node = KdlNode::new("Run"); let mut node_children = KdlDocument::new(); let mut floating_pane = KdlNode::new("floating"); @@ -882,7 +936,10 @@ impl Action { } Some(node) }, - Action::NewInPlacePane(run_command_action, name) => { + Action::NewInPlacePane { + command: run_command_action, + pane_name: name, + } => { let mut node = KdlNode::new("Run"); let mut node_children = KdlDocument::new(); if let Some(run_command_action) = run_command_action { @@ -919,7 +976,10 @@ impl Action { } Some(node) }, - Action::NewStackedPane(run_command_action, name) => match run_command_action { + Action::NewStackedPane { + command: run_command_action, + pane_name: name, + } => match run_command_action { Some(run_command_action) => { let mut node = KdlNode::new("Run"); let mut node_children = KdlDocument::new(); @@ -962,13 +1022,13 @@ impl Action { }, }, Action::Detach => Some(KdlNode::new("Detach")), - Action::LaunchOrFocusPlugin( - run_plugin_or_alias, + Action::LaunchOrFocusPlugin { + plugin: run_plugin_or_alias, should_float, move_to_focused_tab, should_open_in_place, - skip_plugin_cache, - ) => { + skip_cache: skip_plugin_cache, + } => { let mut node = KdlNode::new("LaunchOrFocusPlugin"); let mut node_children = KdlDocument::new(); let location = run_plugin_or_alias.location_string(); @@ -1005,13 +1065,13 @@ impl Action { } Some(node) }, - Action::LaunchPlugin( - run_plugin_or_alias, + Action::LaunchPlugin { + plugin: run_plugin_or_alias, should_float, should_open_in_place, - skip_plugin_cache, + skip_cache: skip_plugin_cache, cwd, - ) => { + } => { let mut node = KdlNode::new("LaunchPlugin"); let mut node_children = KdlDocument::new(); let location = run_plugin_or_alias.location_string(); @@ -1053,14 +1113,16 @@ impl Action { Some(node) }, Action::Copy => Some(KdlNode::new("Copy")), - Action::SearchInput(bytes) => { + Action::SearchInput { input: bytes } => { let mut node = KdlNode::new("SearchInput"); for byte in bytes { node.push(KdlValue::Base10(*byte as i64)); } Some(node) }, - Action::Search(search_direction) => { + Action::Search { + direction: search_direction, + } => { let mut node = KdlNode::new("Search"); let direction = match search_direction { SearchDirection::Down => "down", @@ -1069,7 +1131,9 @@ impl Action { node.push(direction); Some(node) }, - Action::SearchToggleOption(search_toggle_option) => { + Action::SearchToggleOption { + option: search_toggle_option, + } => { let mut node = KdlNode::new("SearchToggleOption"); node.push(format!("{:?}", search_toggle_option)); Some(node) @@ -1478,7 +1542,15 @@ impl TryFrom<(&KdlNode, &Options)> for Action { "NewTab" => { let command_metadata = action_children.iter().next(); if command_metadata.is_none() { - return Ok(Action::NewTab(None, vec![], None, None, None, true, None)); + return Ok(Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }); } let current_dir = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); @@ -1539,28 +1611,28 @@ impl TryFrom<(&KdlNode, &Options)> for Action { let name = tab_name.or(name); let should_change_focus_to_new_tab = layout.focus.unwrap_or(true); - Ok(Action::NewTab( - Some(layout), - floating_panes_layout, + Ok(Action::NewTab { + tiled_layout: Some(layout), + floating_layouts: floating_panes_layout, swap_tiled_layouts, swap_floating_layouts, - name, + tab_name: name, should_change_focus_to_new_tab, cwd, - )) + }) } else { let (layout, floating_panes_layout) = layout.new_tab(); let should_change_focus_to_new_tab = layout.focus.unwrap_or(true); - Ok(Action::NewTab( - Some(layout), - floating_panes_layout, + Ok(Action::NewTab { + tiled_layout: Some(layout), + floating_layouts: floating_panes_layout, swap_tiled_layouts, swap_floating_layouts, - name, + tab_name: name, should_change_focus_to_new_tab, cwd, - )) + }) } }, "GoToTab" => parse_kdl_action_u8_arguments!(action_name, action_arguments, kdl_action), @@ -1636,21 +1708,27 @@ impl TryFrom<(&KdlNode, &Options)> for Action { let pinned = command_metadata.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "pinned")); if floating { - Ok(Action::NewFloatingPane( - Some(run_command_action), - name, - FloatingPaneCoordinates::new(x, y, width, height, pinned), - )) + Ok(Action::NewFloatingPane { + command: Some(run_command_action), + pane_name: name, + coordinates: FloatingPaneCoordinates::new(x, y, width, height, pinned), + }) } else if in_place { - Ok(Action::NewInPlacePane(Some(run_command_action), name)) + Ok(Action::NewInPlacePane { + command: Some(run_command_action), + pane_name: name, + }) } else if stacked { - Ok(Action::NewStackedPane(Some(run_command_action), name)) + Ok(Action::NewStackedPane { + command: Some(run_command_action), + pane_name: name, + }) } else { - Ok(Action::NewTiledPane( + Ok(Action::NewTiledPane { direction, - Some(run_command_action), - name, - )) + command: Some(run_command_action), + pane_name: name, + }) } }, "LaunchOrFocusPlugin" => { @@ -1696,13 +1774,13 @@ impl TryFrom<(&KdlNode, &Options)> for Action { ) })? .with_initial_cwd(initial_cwd); - Ok(Action::LaunchOrFocusPlugin( - run_plugin_or_alias, + Ok(Action::LaunchOrFocusPlugin { + plugin: run_plugin_or_alias, should_float, move_to_focused_tab, should_open_in_place, - skip_plugin_cache, - )) + skip_cache: skip_plugin_cache, + }) }, "LaunchPlugin" => { let arguments = action_arguments.iter().copied(); @@ -1741,14 +1819,14 @@ impl TryFrom<(&KdlNode, &Options)> for Action { kdl_action.span().len(), ) })?; - Ok(Action::LaunchPlugin( - run_plugin_or_alias, + Ok(Action::LaunchPlugin { + plugin: run_plugin_or_alias, should_float, should_open_in_place, - skip_plugin_cache, - None, // we explicitly do not send the current dir here so that it will be - // filled from the active pane == better UX - )) + skip_cache: skip_plugin_cache, + cwd: None, // we explicitly do not send the current dir here so that it will be + // filled from the active pane == better UX + }) }, "PreviousSwapLayout" => Ok(Action::PreviousSwapLayout), "NextSwapLayout" => Ok(Action::NextSwapLayout), diff --git a/zellij-utils/src/lib.rs b/zellij-utils/src/lib.rs index be2e0459..6ee98558 100644 --- a/zellij-utils/src/lib.rs +++ b/zellij-utils/src/lib.rs @@ -1,4 +1,5 @@ pub mod cli; +pub mod client_server_contract; pub mod consts; pub mod data; pub mod envs; @@ -30,6 +31,8 @@ pub mod sessions; pub mod web_authentication_tokens; #[cfg(all(not(target_family = "wasm"), feature = "web_server_capability"))] pub mod web_server_commands; +#[cfg(all(not(target_family = "wasm"), feature = "web_server_capability"))] +pub mod web_server_contract; // TODO(hartan): Remove this re-export for the next minor release. pub use ::prost; diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs index 3aaa6ee1..2b48ffe1 100644 --- a/zellij-utils/src/plugin_api/action.rs +++ b/zellij-utils/src/plugin_api/action.rs @@ -38,14 +38,18 @@ impl TryFrom<ProtobufAction> for Action { None => Ok(Action::Quit), }, Some(ProtobufActionName::Write) => match protobuf_action.optional_payload { - Some(OptionalPayload::WritePayload(write_payload)) => { - Ok(Action::Write(None, write_payload.bytes_to_write, false)) - }, + Some(OptionalPayload::WritePayload(write_payload)) => Ok(Action::Write { + key_with_modifier: None, + bytes: write_payload.bytes_to_write, + is_kitty_keyboard_protocol: false, + }), _ => Err("Wrong payload for Action::Write"), }, Some(ProtobufActionName::WriteChars) => match protobuf_action.optional_payload { Some(OptionalPayload::WriteCharsPayload(write_chars_payload)) => { - Ok(Action::WriteChars(write_chars_payload.chars)) + Ok(Action::WriteChars { + chars: write_chars_payload.chars, + }) }, _ => Err("Wrong payload for Action::WriteChars"), }, @@ -55,7 +59,7 @@ impl TryFrom<ProtobufAction> for Action { ProtobufInputMode::from_i32(switch_to_mode_payload.input_mode) .ok_or("Malformed input mode for SwitchToMode Action")? .try_into()?; - Ok(Action::SwitchToMode(input_mode)) + Ok(Action::SwitchToMode { input_mode }) }, _ => Err("Wrong payload for Action::SwitchToModePayload"), }, @@ -68,7 +72,7 @@ impl TryFrom<ProtobufAction> for Action { ProtobufInputMode::from_i32(switch_to_mode_payload.input_mode) .ok_or("Malformed input mode for SwitchToMode Action")? .try_into()?; - Ok(Action::SwitchModeForAllClients(input_mode)) + Ok(Action::SwitchModeForAllClients { input_mode }) }, _ => Err("Wrong payload for Action::SwitchModeForAllClients"), } @@ -76,10 +80,10 @@ impl TryFrom<ProtobufAction> for Action { Some(ProtobufActionName::Resize) => match protobuf_action.optional_payload { Some(OptionalPayload::ResizePayload(resize_payload)) => { let resize_strategy: ResizeStrategy = resize_payload.try_into()?; - Ok(Action::Resize( - resize_strategy.resize, - resize_strategy.direction, - )) + Ok(Action::Resize { + resize: resize_strategy.resize, + direction: resize_strategy.direction, + }) }, _ => Err("Wrong payload for Action::Resize"), }, @@ -101,7 +105,7 @@ impl TryFrom<ProtobufAction> for Action { ProtobufResizeDirection::from_i32(move_focus_payload) .ok_or("Malformed resize direction for Action::MoveFocus")? .try_into()?; - Ok(Action::MoveFocus(direction)) + Ok(Action::MoveFocus { direction }) }, _ => Err("Wrong payload for Action::MoveFocus"), }, @@ -111,7 +115,7 @@ impl TryFrom<ProtobufAction> for Action { ProtobufResizeDirection::from_i32(move_focus_or_tab_payload) .ok_or("Malformed resize direction for Action::MoveFocusOrTab")? .try_into()?; - Ok(Action::MoveFocusOrTab(direction)) + Ok(Action::MoveFocusOrTab { direction }) }, _ => Err("Wrong payload for Action::MoveFocusOrTab"), }, @@ -121,7 +125,7 @@ impl TryFrom<ProtobufAction> for Action { .direction .and_then(|d| ProtobufResizeDirection::from_i32(d)) .and_then(|d| d.try_into().ok()); - Ok(Action::MovePane(direction)) + Ok(Action::MovePane { direction }) }, _ => Err("Wrong payload for Action::MovePane"), }, @@ -137,7 +141,10 @@ impl TryFrom<ProtobufAction> for Action { Some(OptionalPayload::DumpScreenPayload(payload)) => { let file_path = payload.file_path; let include_scrollback = payload.include_scrollback; - Ok(Action::DumpScreen(file_path, include_scrollback)) + Ok(Action::DumpScreen { + file_path, + include_scrollback, + }) }, _ => Err("Wrong payload for Action::DumpScreen"), }, @@ -159,7 +166,7 @@ impl TryFrom<ProtobufAction> for Action { .position .ok_or("ScrollUpAtPayload must have a position")? .try_into()?; - Ok(Action::ScrollUpAt(position)) + Ok(Action::ScrollUpAt { position }) }, _ => Err("Wrong payload for Action::ScrollUpAt"), }, @@ -169,7 +176,7 @@ impl TryFrom<ProtobufAction> for Action { .position .ok_or("ScrollDownAtPayload must have a position")? .try_into()?; - Ok(Action::ScrollDownAt(position)) + Ok(Action::ScrollDownAt { position }) }, _ => Err("Wrong payload for Action::ScrollDownAt"), }, @@ -222,7 +229,11 @@ impl TryFrom<ProtobufAction> for Action { .and_then(|d| ProtobufResizeDirection::from_i32(d)) .and_then(|d| d.try_into().ok()); let pane_name = payload.pane_name; - Ok(Action::NewPane(direction, pane_name, false)) + Ok(Action::NewPane { + direction, + pane_name, + start_suppressed: false, + }) }, _ => Err("Wrong payload for Action::NewPane"), }, @@ -237,14 +248,14 @@ impl TryFrom<ProtobufAction> for Action { .and_then(|d| d.try_into().ok()); let should_float = payload.should_float; let should_be_in_place = false; - Ok(Action::EditFile( - OpenFilePayload::new(file_to_edit, line_number, cwd), + Ok(Action::EditFile { + payload: OpenFilePayload::new(file_to_edit, line_number, cwd), direction, - should_float, - should_be_in_place, - false, - None, - )) + floating: should_float, + in_place: should_be_in_place, + start_suppressed: false, + coordinates: None, + }) }, _ => Err("Wrong payload for Action::NewPane"), }, @@ -253,13 +264,17 @@ impl TryFrom<ProtobufAction> for Action { if let Some(payload) = payload.command { let pane_name = payload.pane_name.clone(); let run_command_action: RunCommandAction = payload.try_into()?; - Ok(Action::NewFloatingPane( - Some(run_command_action), + Ok(Action::NewFloatingPane { + command: Some(run_command_action), pane_name, - None, - )) + coordinates: None, + }) } else { - Ok(Action::NewFloatingPane(None, None, None)) + Ok(Action::NewFloatingPane { + command: None, + pane_name: None, + coordinates: None, + }) } }, _ => Err("Wrong payload for Action::NewFloatingPane"), @@ -273,13 +288,17 @@ impl TryFrom<ProtobufAction> for Action { if let Some(payload) = payload.command { let pane_name = payload.pane_name.clone(); let run_command_action: RunCommandAction = payload.try_into()?; - Ok(Action::NewTiledPane( + Ok(Action::NewTiledPane { direction, - Some(run_command_action), + command: Some(run_command_action), pane_name, - )) + }) } else { - Ok(Action::NewTiledPane(direction, None, None)) + Ok(Action::NewTiledPane { + direction, + command: None, + pane_name: None, + }) } }, _ => Err("Wrong payload for Action::NewTiledPane"), @@ -302,7 +321,7 @@ impl TryFrom<ProtobufAction> for Action { }, Some(ProtobufActionName::PaneNameInput) => match protobuf_action.optional_payload { Some(OptionalPayload::PaneNameInputPayload(bytes)) => { - Ok(Action::PaneNameInput(bytes)) + Ok(Action::PaneNameInput { input: bytes }) }, _ => Err("Wrong payload for Action::PaneNameInput"), }, @@ -315,7 +334,15 @@ impl TryFrom<ProtobufAction> for Action { Some(_) => Err("NewTab should not have a payload"), None => { // we do not serialize the layouts of this action - Ok(Action::NewTab(None, vec![], None, None, None, true, None)) + Ok(Action::NewTab { + tiled_layout: None, + floating_layouts: vec![], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }) }, } }, @@ -336,14 +363,17 @@ impl TryFrom<ProtobufAction> for Action { None => Ok(Action::CloseTab), }, Some(ProtobufActionName::GoToTab) => match protobuf_action.optional_payload { - Some(OptionalPayload::GoToTabPayload(index)) => Ok(Action::GoToTab(index)), + Some(OptionalPayload::GoToTabPayload(index)) => Ok(Action::GoToTab { index }), _ => Err("Wrong payload for Action::GoToTab"), }, Some(ProtobufActionName::GoToTabName) => match protobuf_action.optional_payload { Some(OptionalPayload::GoToTabNamePayload(payload)) => { let tab_name = payload.tab_name; let create = payload.create; - Ok(Action::GoToTabName(tab_name, create)) + Ok(Action::GoToTabName { + name: tab_name, + create, + }) }, _ => Err("Wrong payload for Action::GoToTabName"), }, @@ -353,7 +383,7 @@ impl TryFrom<ProtobufAction> for Action { }, Some(ProtobufActionName::TabNameInput) => match protobuf_action.optional_payload { Some(OptionalPayload::TabNameInputPayload(bytes)) => { - Ok(Action::TabNameInput(bytes)) + Ok(Action::TabNameInput { input: bytes }) }, _ => Err("Wrong payload for Action::TabNameInput"), }, @@ -366,14 +396,16 @@ impl TryFrom<ProtobufAction> for Action { let direction: Direction = ProtobufMoveTabDirection::from_i32(move_tab_payload) .ok_or("Malformed move tab direction for Action::MoveTab")? .try_into()?; - Ok(Action::MoveTab(direction)) + Ok(Action::MoveTab { direction }) }, _ => Err("Wrong payload for Action::MoveTab"), }, Some(ProtobufActionName::Run) => match protobuf_action.optional_payload { Some(OptionalPayload::RunPayload(run_command_action)) => { let run_command_action = run_command_action.try_into()?; - Ok(Action::Run(run_command_action)) + Ok(Action::Run { + command: run_command_action, + }) }, _ => Err("Wrong payload for Action::Run"), }, @@ -384,27 +416,27 @@ impl TryFrom<ProtobufAction> for Action { Some(ProtobufActionName::LeftClick) => match protobuf_action.optional_payload { Some(OptionalPayload::LeftClickPayload(payload)) => { let position = payload.try_into()?; - Ok(Action::MouseEvent(MouseEvent::new_left_press_event( - position, - ))) + Ok(Action::MouseEvent { + event: MouseEvent::new_left_press_event(position), + }) }, _ => Err("Wrong payload for Action::LeftClick"), }, Some(ProtobufActionName::RightClick) => match protobuf_action.optional_payload { Some(OptionalPayload::RightClickPayload(payload)) => { let position = payload.try_into()?; - Ok(Action::MouseEvent(MouseEvent::new_right_press_event( - position, - ))) + Ok(Action::MouseEvent { + event: MouseEvent::new_right_press_event(position), + }) }, _ => Err("Wrong payload for Action::RightClick"), }, Some(ProtobufActionName::MiddleClick) => match protobuf_action.optional_payload { Some(OptionalPayload::MiddleClickPayload(payload)) => { let position = payload.try_into()?; - Ok(Action::MouseEvent(MouseEvent::new_middle_press_event( - position, - ))) + Ok(Action::MouseEvent { + event: MouseEvent::new_middle_press_event(position), + }) }, _ => Err("Wrong payload for Action::MiddleClick"), }, @@ -426,13 +458,13 @@ impl TryFrom<ProtobufAction> for Action { let move_to_focused_tab = payload.move_to_focused_tab; let should_open_in_place = payload.should_open_in_place; let skip_plugin_cache = payload.skip_plugin_cache; - Ok(Action::LaunchOrFocusPlugin( - run_plugin_or_alias, + Ok(Action::LaunchOrFocusPlugin { + plugin: run_plugin_or_alias, should_float, move_to_focused_tab, should_open_in_place, - skip_plugin_cache, - )) + skip_cache: skip_plugin_cache, + }) }, _ => Err("Wrong payload for Action::LaunchOrFocusPlugin"), } @@ -455,31 +487,31 @@ impl TryFrom<ProtobufAction> for Action { // this action let should_open_in_place = payload.should_open_in_place; let skip_plugin_cache = payload.skip_plugin_cache; - Ok(Action::LaunchPlugin( - run_plugin_or_alias, + Ok(Action::LaunchPlugin { + plugin: run_plugin_or_alias, should_float, should_open_in_place, - skip_plugin_cache, - None, - )) + skip_cache: skip_plugin_cache, + cwd: None, + }) }, _ => Err("Wrong payload for Action::LaunchOrFocusPlugin"), }, Some(ProtobufActionName::LeftMouseRelease) => match protobuf_action.optional_payload { Some(OptionalPayload::LeftMouseReleasePayload(payload)) => { let position = payload.try_into()?; - Ok(Action::MouseEvent(MouseEvent::new_left_release_event( - position, - ))) + Ok(Action::MouseEvent { + event: MouseEvent::new_left_release_event(position), + }) }, _ => Err("Wrong payload for Action::LeftMouseRelease"), }, Some(ProtobufActionName::RightMouseRelease) => match protobuf_action.optional_payload { Some(OptionalPayload::RightMouseReleasePayload(payload)) => { let position = payload.try_into()?; - Ok(Action::MouseEvent(MouseEvent::new_right_release_event( - position, - ))) + Ok(Action::MouseEvent { + event: MouseEvent::new_right_release_event(position), + }) }, _ => Err("Wrong payload for Action::RightMouseRelease"), }, @@ -487,9 +519,9 @@ impl TryFrom<ProtobufAction> for Action { match protobuf_action.optional_payload { Some(OptionalPayload::MiddleMouseReleasePayload(payload)) => { let position = payload.try_into()?; - Ok(Action::MouseEvent(MouseEvent::new_middle_release_event( - position, - ))) + Ok(Action::MouseEvent { + event: MouseEvent::new_middle_release_event(position), + }) }, _ => Err("Wrong payload for Action::MiddleMouseRelease"), } @@ -497,32 +529,32 @@ impl TryFrom<ProtobufAction> for Action { Some(ProtobufActionName::MouseEvent) => match protobuf_action.optional_payload { Some(OptionalPayload::MouseEventPayload(payload)) => { let event = payload.try_into()?; - Ok(Action::MouseEvent(event)) + Ok(Action::MouseEvent { event }) }, _ => Err("Wrong payload for Action::MouseEvent"), }, Some(ProtobufActionName::SearchInput) => match protobuf_action.optional_payload { Some(OptionalPayload::SearchInputPayload(payload)) => { - Ok(Action::SearchInput(payload)) + Ok(Action::SearchInput { input: payload }) }, _ => Err("Wrong payload for Action::SearchInput"), }, Some(ProtobufActionName::Search) => match protobuf_action.optional_payload { - Some(OptionalPayload::SearchPayload(search_direction)) => Ok(Action::Search( - ProtobufSearchDirection::from_i32(search_direction) + Some(OptionalPayload::SearchPayload(search_direction)) => Ok(Action::Search { + direction: ProtobufSearchDirection::from_i32(search_direction) .ok_or("Malformed payload for Action::Search")? .try_into()?, - )), + }), _ => Err("Wrong payload for Action::Search"), }, Some(ProtobufActionName::SearchToggleOption) => { match protobuf_action.optional_payload { Some(OptionalPayload::SearchToggleOptionPayload(search_option)) => { - Ok(Action::SearchToggleOption( - ProtobufSearchOption::from_i32(search_option) + Ok(Action::SearchToggleOption { + option: ProtobufSearchOption::from_i32(search_option) .ok_or("Malformed payload for Action::SearchToggleOption")? .try_into()?, - )) + }) }, _ => Err("Wrong payload for Action::SearchToggleOption"), } @@ -559,12 +591,12 @@ impl TryFrom<ProtobufAction> for Action { }); let pane_name = payload.pane_name; let skip_plugin_cache = payload.skip_plugin_cache; - Ok(Action::NewTiledPluginPane( - run_plugin, + Ok(Action::NewTiledPluginPane { + plugin: run_plugin, pane_name, - skip_plugin_cache, - None, - )) + skip_cache: skip_plugin_cache, + cwd: None, + }) }, _ => Err("Wrong payload for Action::NewTiledPluginPane"), } @@ -583,13 +615,13 @@ impl TryFrom<ProtobufAction> for Action { }); let pane_name = payload.pane_name; let skip_plugin_cache = payload.skip_plugin_cache; - Ok(Action::NewFloatingPluginPane( - run_plugin, + Ok(Action::NewFloatingPluginPane { + plugin: run_plugin, pane_name, - skip_plugin_cache, - None, - None, - )) + skip_cache: skip_plugin_cache, + cwd: None, + coordinates: None, + }) }, _ => Err("Wrong payload for Action::MiddleClick"), } @@ -601,20 +633,22 @@ impl TryFrom<ProtobufAction> for Action { RunPluginOrAlias::from_url(&payload.as_str(), &None, None, None) .map_err(|_| "Malformed LaunchOrFocusPlugin payload")?; - Ok(Action::StartOrReloadPlugin(run_plugin_or_alias)) + Ok(Action::StartOrReloadPlugin { + plugin: run_plugin_or_alias, + }) }, _ => Err("Wrong payload for Action::StartOrReloadPlugin"), } }, Some(ProtobufActionName::CloseTerminalPane) => match protobuf_action.optional_payload { Some(OptionalPayload::CloseTerminalPanePayload(payload)) => { - Ok(Action::CloseTerminalPane(payload)) + Ok(Action::CloseTerminalPane { pane_id: payload }) }, _ => Err("Wrong payload for Action::CloseTerminalPane"), }, Some(ProtobufActionName::ClosePluginPane) => match protobuf_action.optional_payload { Some(OptionalPayload::ClosePluginPanePayload(payload)) => { - Ok(Action::ClosePluginPane(payload)) + Ok(Action::ClosePluginPane { pane_id: payload }) }, _ => Err("Wrong payload for Action::ClosePluginPane"), }, @@ -623,10 +657,10 @@ impl TryFrom<ProtobufAction> for Action { Some(OptionalPayload::FocusTerminalPaneWithIdPayload(payload)) => { let terminal_pane_id = payload.pane_id; let should_float_if_hidden = payload.should_float; - Ok(Action::FocusTerminalPaneWithId( - terminal_pane_id, + Ok(Action::FocusTerminalPaneWithId { + pane_id: terminal_pane_id, should_float_if_hidden, - )) + }) }, _ => Err("Wrong payload for Action::FocusTerminalPaneWithId"), } @@ -636,10 +670,10 @@ impl TryFrom<ProtobufAction> for Action { Some(OptionalPayload::FocusPluginPaneWithIdPayload(payload)) => { let plugin_pane_id = payload.pane_id; let should_float_if_hidden = payload.should_float; - Ok(Action::FocusPluginPaneWithId( - plugin_pane_id, + Ok(Action::FocusPluginPaneWithId { + pane_id: plugin_pane_id, should_float_if_hidden, - )) + }) }, _ => Err("Wrong payload for Action::FocusPluginPaneWithId"), } @@ -649,7 +683,10 @@ impl TryFrom<ProtobufAction> for Action { Some(OptionalPayload::RenameTerminalPanePayload(payload)) => { let terminal_pane_id = payload.id; let new_pane_name = payload.name; - Ok(Action::RenameTerminalPane(terminal_pane_id, new_pane_name)) + Ok(Action::RenameTerminalPane { + pane_id: terminal_pane_id, + name: new_pane_name, + }) }, _ => Err("Wrong payload for Action::RenameTerminalPane"), } @@ -658,7 +695,10 @@ impl TryFrom<ProtobufAction> for Action { Some(OptionalPayload::RenamePluginPanePayload(payload)) => { let plugin_pane_id = payload.id; let new_pane_name = payload.name; - Ok(Action::RenamePluginPane(plugin_pane_id, new_pane_name)) + Ok(Action::RenamePluginPane { + pane_id: plugin_pane_id, + name: new_pane_name, + }) }, _ => Err("Wrong payload for Action::RenamePluginPane"), }, @@ -666,7 +706,10 @@ impl TryFrom<ProtobufAction> for Action { Some(OptionalPayload::RenameTabPayload(payload)) => { let tab_index = payload.id; let new_tab_name = payload.name; - Ok(Action::RenameTab(tab_index, new_tab_name)) + Ok(Action::RenameTab { + tab_index, + name: new_tab_name, + }) }, _ => Err("Wrong payload for Action::RenameTab"), }, @@ -684,7 +727,7 @@ impl TryFrom<ProtobufAction> for Action { }, Some(ProtobufActionName::RenameSession) => match protobuf_action.optional_payload { Some(OptionalPayload::RenameSessionPayload(name)) => { - Ok(Action::RenameSession(name)) + Ok(Action::RenameSession { name }) }, _ => Err("Wrong payload for Action::RenameSession"), }, @@ -722,7 +765,10 @@ impl TryFrom<ProtobufAction> for Action { }, Some(ProtobufActionName::NewStackedPane) => match protobuf_action.optional_payload { Some(_) => Err("NewStackedPane should not have a payload"), - None => Ok(Action::NewStackedPane(None, None)), + None => Ok(Action::NewStackedPane { + command: None, + pane_name: None, + }), }, _ => Err("Unknown Action"), } @@ -737,19 +783,25 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::Quit as i32, optional_payload: None, }), - Action::Write(_, bytes, _) => Ok(ProtobufAction { + Action::Write { + key_with_modifier: _, + bytes, + is_kitty_keyboard_protocol: _, + } => Ok(ProtobufAction { name: ProtobufActionName::Write as i32, optional_payload: Some(OptionalPayload::WritePayload(WritePayload { bytes_to_write: bytes, })), }), - Action::WriteChars(chars_to_write) => Ok(ProtobufAction { + Action::WriteChars { + chars: chars_to_write, + } => Ok(ProtobufAction { name: ProtobufActionName::WriteChars as i32, optional_payload: Some(OptionalPayload::WriteCharsPayload(WriteCharsPayload { chars: chars_to_write, })), }), - Action::SwitchToMode(input_mode) => { + Action::SwitchToMode { input_mode } => { let input_mode: ProtobufInputMode = input_mode.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::SwitchToMode as i32, @@ -760,7 +812,7 @@ impl TryFrom<Action> for ProtobufAction { )), }) }, - Action::SwitchModeForAllClients(input_mode) => { + Action::SwitchModeForAllClients { input_mode } => { let input_mode: ProtobufInputMode = input_mode.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::SwitchModeForAllClients as i32, @@ -771,7 +823,7 @@ impl TryFrom<Action> for ProtobufAction { )), }) }, - Action::Resize(resize, direction) => { + Action::Resize { resize, direction } => { let mut resize: ProtobufResize = resize.try_into()?; resize.direction = direction.and_then(|d| { let resize_direction: ProtobufResizeDirection = d.try_into().ok()?; @@ -794,14 +846,14 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::SwitchFocus as i32, optional_payload: None, }), - Action::MoveFocus(direction) => { + Action::MoveFocus { direction } => { let direction: ProtobufResizeDirection = direction.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::MoveFocus as i32, optional_payload: Some(OptionalPayload::MoveFocusPayload(direction as i32)), }) }, - Action::MoveFocusOrTab(direction) => { + Action::MoveFocusOrTab { direction } => { let direction: ProtobufResizeDirection = direction.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::MoveFocusOrTab as i32, @@ -810,7 +862,7 @@ impl TryFrom<Action> for ProtobufAction { )), }) }, - Action::MovePane(direction) => { + Action::MovePane { direction } => { let direction = direction.and_then(|direction| { let protobuf_direction: ProtobufResizeDirection = direction.try_into().ok()?; Some(protobuf_direction as i32) @@ -830,7 +882,10 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::ClearScreen as i32, optional_payload: None, }), - Action::DumpScreen(file_path, include_scrollback) => Ok(ProtobufAction { + Action::DumpScreen { + file_path, + include_scrollback, + } => Ok(ProtobufAction { name: ProtobufActionName::DumpScreen as i32, optional_payload: Some(OptionalPayload::DumpScreenPayload(DumpScreenPayload { file_path, @@ -845,7 +900,7 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::ScrollUp as i32, optional_payload: None, }), - Action::ScrollUpAt(position) => { + Action::ScrollUpAt { position } => { let position: ProtobufPosition = position.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::ScrollUpAt as i32, @@ -858,7 +913,7 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::ScrollDown as i32, optional_payload: None, }), - Action::ScrollDownAt(position) => { + Action::ScrollDownAt { position } => { let position: ProtobufPosition = position.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::ScrollDownAt as i32, @@ -903,7 +958,11 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::ToggleActiveSyncTab as i32, optional_payload: None, }), - Action::NewPane(direction, new_pane_name, _start_suppressed) => { + Action::NewPane { + direction, + pane_name: new_pane_name, + start_suppressed: _start_suppressed, + } => { let direction = direction.and_then(|direction| { let protobuf_direction: ProtobufResizeDirection = direction.try_into().ok()?; Some(protobuf_direction as i32) @@ -916,14 +975,14 @@ impl TryFrom<Action> for ProtobufAction { })), }) }, - Action::EditFile( - open_file_payload, + Action::EditFile { + payload: open_file_payload, direction, - should_float, - _should_be_in_place, - _floating_pane_coordinates, - _start_suppressed, - ) => { + floating: should_float, + in_place: _should_be_in_place, + start_suppressed: _start_suppressed, + coordinates: _floating_pane_coordinates, + } => { let file_to_edit = open_file_payload.path.display().to_string(); let cwd = open_file_payload.cwd.map(|cwd| cwd.display().to_string()); let direction: Option<i32> = direction @@ -941,7 +1000,11 @@ impl TryFrom<Action> for ProtobufAction { })), }) }, - Action::NewFloatingPane(run_command_action, pane_name, _coordinates) => { + Action::NewFloatingPane { + command: run_command_action, + pane_name, + coordinates: _coordinates, + } => { let command = run_command_action.and_then(|r| { let mut protobuf_run_command_action: ProtobufRunCommandAction = r.try_into().ok()?; @@ -955,7 +1018,11 @@ impl TryFrom<Action> for ProtobufAction { )), }) }, - Action::NewTiledPane(direction, run_command_action, pane_name) => { + Action::NewTiledPane { + direction, + command: run_command_action, + pane_name, + } => { let direction = direction.and_then(|direction| { let protobuf_direction: ProtobufResizeDirection = direction.try_into().ok()?; Some(protobuf_direction as i32) @@ -986,7 +1053,7 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::CloseFocus as i32, optional_payload: None, }), - Action::PaneNameInput(bytes) => Ok(ProtobufAction { + Action::PaneNameInput { input: bytes } => Ok(ProtobufAction { name: ProtobufActionName::PaneNameInput as i32, optional_payload: Some(OptionalPayload::PaneNameInputPayload(bytes)), }), @@ -994,7 +1061,15 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::UndoRenamePane as i32, optional_payload: None, }), - Action::NewTab(..) => { + Action::NewTab { + tiled_layout: _, + floating_layouts: _, + swap_tiled_layouts: _, + swap_floating_layouts: _, + tab_name: _, + should_change_focus_to_new_tab: _, + cwd: _, + } => { // we do not serialize the various newtab payloads Ok(ProtobufAction { name: ProtobufActionName::NewTab as i32, @@ -1013,11 +1088,14 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::CloseTab as i32, optional_payload: None, }), - Action::GoToTab(tab_index) => Ok(ProtobufAction { + Action::GoToTab { index: tab_index } => Ok(ProtobufAction { name: ProtobufActionName::GoToTab as i32, optional_payload: Some(OptionalPayload::GoToTabPayload(tab_index)), }), - Action::GoToTabName(tab_name, create) => Ok(ProtobufAction { + Action::GoToTabName { + name: tab_name, + create, + } => Ok(ProtobufAction { name: ProtobufActionName::GoToTabName as i32, optional_payload: Some(OptionalPayload::GoToTabNamePayload(GoToTabNamePayload { tab_name, @@ -1028,7 +1106,7 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::ToggleTab as i32, optional_payload: None, }), - Action::TabNameInput(bytes) => Ok(ProtobufAction { + Action::TabNameInput { input: bytes } => Ok(ProtobufAction { name: ProtobufActionName::TabNameInput as i32, optional_payload: Some(OptionalPayload::TabNameInputPayload(bytes)), }), @@ -1036,14 +1114,16 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::UndoRenameTab as i32, optional_payload: None, }), - Action::MoveTab(direction) => { + Action::MoveTab { direction } => { let direction: ProtobufMoveTabDirection = direction.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::MoveTab as i32, optional_payload: Some(OptionalPayload::MoveTabPayload(direction as i32)), }) }, - Action::Run(run_command_action) => { + Action::Run { + command: run_command_action, + } => { let run_command_action: ProtobufRunCommandAction = run_command_action.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::Run as i32, @@ -1054,13 +1134,13 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::Detach as i32, optional_payload: None, }), - Action::LaunchOrFocusPlugin( - run_plugin_or_alias, + Action::LaunchOrFocusPlugin { + plugin: run_plugin_or_alias, should_float, move_to_focused_tab, should_open_in_place, - skip_plugin_cache, - ) => { + skip_cache: skip_plugin_cache, + } => { let configuration = run_plugin_or_alias.get_configuration().unwrap_or_default(); Ok(ProtobufAction { name: ProtobufActionName::LaunchOrFocusPlugin as i32, @@ -1076,13 +1156,13 @@ impl TryFrom<Action> for ProtobufAction { )), }) }, - Action::LaunchPlugin( - run_plugin_or_alias, + Action::LaunchPlugin { + plugin: run_plugin_or_alias, should_float, should_open_in_place, - skip_plugin_cache, - _cwd, - ) => { + skip_cache: skip_plugin_cache, + cwd: _cwd, + } => { let configuration = run_plugin_or_alias.get_configuration().unwrap_or_default(); Ok(ProtobufAction { name: ProtobufActionName::LaunchPlugin as i32, @@ -1098,25 +1178,29 @@ impl TryFrom<Action> for ProtobufAction { )), }) }, - Action::MouseEvent(event) => { + Action::MouseEvent { event } => { let payload: ProtobufMouseEventPayload = event.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::MouseEvent as i32, optional_payload: Some(OptionalPayload::MouseEventPayload(payload)), }) }, - Action::SearchInput(bytes) => Ok(ProtobufAction { + Action::SearchInput { input: bytes } => Ok(ProtobufAction { name: ProtobufActionName::SearchInput as i32, optional_payload: Some(OptionalPayload::SearchInputPayload(bytes)), }), - Action::Search(search_direction) => { + Action::Search { + direction: search_direction, + } => { let search_direction: ProtobufSearchDirection = search_direction.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::Search as i32, optional_payload: Some(OptionalPayload::SearchPayload(search_direction as i32)), }) }, - Action::SearchToggleOption(search_option) => { + Action::SearchToggleOption { + option: search_option, + } => { let search_option: ProtobufSearchOption = search_option.try_into()?; Ok(ProtobufAction { name: ProtobufActionName::SearchToggleOption as i32, @@ -1141,25 +1225,28 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::QueryTabNames as i32, optional_payload: None, }), - Action::NewTiledPluginPane(run_plugin, pane_name, skip_plugin_cache, _cwd) => { - Ok(ProtobufAction { - name: ProtobufActionName::NewTiledPluginPane as i32, - optional_payload: Some(OptionalPayload::NewTiledPluginPanePayload( - NewPluginPanePayload { - plugin_url: run_plugin.location_string(), - pane_name, - skip_plugin_cache, - }, - )), - }) - }, - Action::NewFloatingPluginPane( - run_plugin, + Action::NewTiledPluginPane { + plugin: run_plugin, pane_name, - skip_plugin_cache, - _cwd, - _coordinates, - ) => Ok(ProtobufAction { + skip_cache: skip_plugin_cache, + cwd: _cwd, + } => Ok(ProtobufAction { + name: ProtobufActionName::NewTiledPluginPane as i32, + optional_payload: Some(OptionalPayload::NewTiledPluginPanePayload( + NewPluginPanePayload { + plugin_url: run_plugin.location_string(), + pane_name, + skip_plugin_cache, + }, + )), + }), + Action::NewFloatingPluginPane { + plugin: run_plugin, + pane_name, + skip_cache: skip_plugin_cache, + cwd: _cwd, + coordinates: _coordinates, + } => Ok(ProtobufAction { name: ProtobufActionName::NewFloatingPluginPane as i32, optional_payload: Some(OptionalPayload::NewFloatingPluginPanePayload( NewPluginPanePayload { @@ -1169,57 +1256,72 @@ impl TryFrom<Action> for ProtobufAction { }, )), }), - Action::StartOrReloadPlugin(run_plugin) => Ok(ProtobufAction { + Action::StartOrReloadPlugin { plugin: run_plugin } => Ok(ProtobufAction { name: ProtobufActionName::StartOrReloadPlugin as i32, optional_payload: Some(OptionalPayload::StartOrReloadPluginPayload( run_plugin.location_string(), )), }), - Action::CloseTerminalPane(terminal_pane_id) => Ok(ProtobufAction { + Action::CloseTerminalPane { + pane_id: terminal_pane_id, + } => Ok(ProtobufAction { name: ProtobufActionName::CloseTerminalPane as i32, optional_payload: Some(OptionalPayload::CloseTerminalPanePayload(terminal_pane_id)), }), - Action::ClosePluginPane(plugin_pane_id) => Ok(ProtobufAction { + Action::ClosePluginPane { + pane_id: plugin_pane_id, + } => Ok(ProtobufAction { name: ProtobufActionName::ClosePluginPane as i32, optional_payload: Some(OptionalPayload::ClosePluginPanePayload(plugin_pane_id)), }), - Action::FocusTerminalPaneWithId(terminal_pane_id, should_float_if_hidden) => { - Ok(ProtobufAction { - name: ProtobufActionName::FocusTerminalPaneWithId as i32, - optional_payload: Some(OptionalPayload::FocusTerminalPaneWithIdPayload( - PaneIdAndShouldFloat { - pane_id: terminal_pane_id, - should_float: should_float_if_hidden, - }, - )), - }) - }, - Action::FocusPluginPaneWithId(plugin_pane_id, should_float_if_hidden) => { - Ok(ProtobufAction { - name: ProtobufActionName::FocusPluginPaneWithId as i32, - optional_payload: Some(OptionalPayload::FocusPluginPaneWithIdPayload( - PaneIdAndShouldFloat { - pane_id: plugin_pane_id, - should_float: should_float_if_hidden, - }, - )), - }) - }, - Action::RenameTerminalPane(terminal_pane_id, new_name) => Ok(ProtobufAction { + Action::FocusTerminalPaneWithId { + pane_id: terminal_pane_id, + should_float_if_hidden, + } => Ok(ProtobufAction { + name: ProtobufActionName::FocusTerminalPaneWithId as i32, + optional_payload: Some(OptionalPayload::FocusTerminalPaneWithIdPayload( + PaneIdAndShouldFloat { + pane_id: terminal_pane_id, + should_float: should_float_if_hidden, + }, + )), + }), + Action::FocusPluginPaneWithId { + pane_id: plugin_pane_id, + should_float_if_hidden, + } => Ok(ProtobufAction { + name: ProtobufActionName::FocusPluginPaneWithId as i32, + optional_payload: Some(OptionalPayload::FocusPluginPaneWithIdPayload( + PaneIdAndShouldFloat { + pane_id: plugin_pane_id, + should_float: should_float_if_hidden, + }, + )), + }), + Action::RenameTerminalPane { + pane_id: terminal_pane_id, + name: new_name, + } => Ok(ProtobufAction { name: ProtobufActionName::RenameTerminalPane as i32, optional_payload: Some(OptionalPayload::RenameTerminalPanePayload(IdAndName { name: new_name, id: terminal_pane_id, })), }), - Action::RenamePluginPane(plugin_pane_id, new_name) => Ok(ProtobufAction { + Action::RenamePluginPane { + pane_id: plugin_pane_id, + name: new_name, + } => Ok(ProtobufAction { name: ProtobufActionName::RenamePluginPane as i32, optional_payload: Some(OptionalPayload::RenamePluginPanePayload(IdAndName { name: new_name, id: plugin_pane_id, })), }), - Action::RenameTab(tab_index, new_name) => Ok(ProtobufAction { + Action::RenameTab { + tab_index, + name: new_name, + } => Ok(ProtobufAction { name: ProtobufActionName::RenameTab as i32, optional_payload: Some(OptionalPayload::RenameTabPayload(IdAndName { name: new_name, @@ -1238,7 +1340,7 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::BreakPaneLeft as i32, optional_payload: None, }), - Action::RenameSession(session_name) => Ok(ProtobufAction { + Action::RenameSession { name: session_name } => Ok(ProtobufAction { name: ProtobufActionName::RenameSession as i32, optional_payload: Some(OptionalPayload::RenameSessionPayload(session_name)), }), @@ -1258,22 +1360,35 @@ impl TryFrom<Action> for ProtobufAction { name: ProtobufActionName::ToggleGroupMarking as i32, optional_payload: None, }), - Action::NewStackedPane(..) => Ok(ProtobufAction { + Action::NewStackedPane { + command: _, + pane_name: _, + } => Ok(ProtobufAction { name: ProtobufActionName::NewStackedPane as i32, optional_payload: None, }), Action::NoOp | Action::Confirm - | Action::NewInPlacePane(..) - | Action::NewInPlacePluginPane(..) + | Action::NewInPlacePane { + command: _, + pane_name: _, + } + | Action::NewInPlacePluginPane { + plugin: _, + pane_name: _, + skip_cache: _, + } | Action::Deny | Action::Copy | Action::DumpLayout | Action::CliPipe { .. } | Action::ListClients - | Action::StackPanes(..) - | Action::ChangeFloatingPaneCoordinates(..) - | Action::SkipConfirm(..) => Err("Unsupported action"), + | Action::StackPanes { pane_ids: _ } + | Action::ChangeFloatingPaneCoordinates { + pane_id: _, + coordinates: _, + } + | Action::SkipConfirm { action: _ } => Err("Unsupported action"), } } } diff --git a/zellij-utils/src/plugin_api/event.rs b/zellij-utils/src/plugin_api/event.rs index e363b86c..fe8822e4 100644 --- a/zellij-utils/src/plugin_api/event.rs +++ b/zellij-utils/src/plugin_api/event.rs @@ -1583,14 +1583,18 @@ fn serialize_mode_update_event_with_non_default_values() { InputMode::Locked, vec![( KeyWithModifier::new(BareKey::Char('b')).with_alt_modifier(), - vec![Action::SwitchToMode(InputMode::Normal)], + vec![Action::SwitchToMode { + input_mode: InputMode::Normal, + }], )], ), ( InputMode::Tab, vec![( KeyWithModifier::new(BareKey::Up).with_alt_modifier(), - vec![Action::SwitchToMode(InputMode::Pane)], + vec![Action::SwitchToMode { + input_mode: InputMode::Pane, + }], )], ), ( @@ -1599,13 +1603,21 @@ fn serialize_mode_update_event_with_non_default_values() { ( KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), vec![ - Action::SwitchToMode(InputMode::Tmux), - Action::Write(None, vec![10], false), + Action::SwitchToMode { + input_mode: InputMode::Tmux, + }, + Action::Write { + key_with_modifier: None, + bytes: vec![10], + is_kitty_keyboard_protocol: false, + }, ], ), ( KeyWithModifier::new(BareKey::Char('a')), - vec![Action::WriteChars("foo".to_owned())], + vec![Action::WriteChars { + chars: "foo".to_owned(), + }], ), ], ), diff --git a/zellij-utils/src/sessions.rs b/zellij-utils/src/sessions.rs index 1e914f35..b72be064 100644 --- a/zellij-utils/src/sessions.rs +++ b/zellij-utils/src/sessions.rs @@ -141,10 +141,11 @@ fn assert_socket(name: &str) -> bool { let path = &*ZELLIJ_SOCK_DIR.join(name); match LocalSocketStream::connect(path) { Ok(stream) => { - let mut sender = IpcSenderWithContext::new(stream); - let _ = sender.send(ClientToServerMsg::ConnStatus); + let mut sender: IpcSenderWithContext<ClientToServerMsg> = + IpcSenderWithContext::new(stream); + let _ = sender.send_client_msg(ClientToServerMsg::ConnStatus); let mut receiver: IpcReceiverWithContext<ServerToClientMsg> = sender.get_receiver(); - match receiver.recv() { + match receiver.recv_server_msg() { Some((ServerToClientMsg::Connected, _)) => true, None | Some((_, _)) => false, } @@ -242,7 +243,8 @@ pub fn kill_session(name: &str) { let path = &*ZELLIJ_SOCK_DIR.join(name); match LocalSocketStream::connect(path) { Ok(stream) => { - let _ = IpcSenderWithContext::new(stream).send(ClientToServerMsg::KillSession); + let _ = IpcSenderWithContext::<ClientToServerMsg>::new(stream) + .send_client_msg(ClientToServerMsg::KillSession); }, Err(e) => { eprintln!("Error occurred: {:?}", e); @@ -255,8 +257,8 @@ pub fn delete_session(name: &str, force: bool) { if force { let path = &*ZELLIJ_SOCK_DIR.join(name); let _ = LocalSocketStream::connect(path).map(|stream| { - IpcSenderWithContext::new(stream) - .send(ClientToServerMsg::KillSession) + IpcSenderWithContext::<ClientToServerMsg>::new(stream) + .send_client_msg(ClientToServerMsg::KillSession) .ok(); }); } diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap index 94e77a61..e01b7410 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap @@ -11,9 +11,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -21,9 +21,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -31,9 +31,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -41,9 +41,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -53,10 +53,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -66,10 +66,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -79,10 +79,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -112,9 +112,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -134,9 +134,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -146,9 +146,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -158,9 +158,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -170,9 +170,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -182,9 +182,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -194,9 +194,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -206,9 +206,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -218,9 +218,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -230,11 +230,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -244,9 +244,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -256,9 +256,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -268,9 +268,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -311,9 +311,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -323,9 +323,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], }, Locked: { @@ -337,9 +337,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Resize: { @@ -347,12 +347,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -360,20 +360,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -381,20 +381,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -402,20 +402,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -423,9 +423,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -433,10 +433,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -446,10 +446,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -457,10 +457,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -470,10 +470,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -481,10 +481,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -494,10 +494,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -505,12 +505,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -518,12 +518,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -531,12 +531,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -544,12 +544,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -579,9 +579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -601,9 +601,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -611,12 +611,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -626,9 +626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -638,9 +638,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -650,9 +650,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -660,12 +660,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -675,9 +675,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -685,12 +685,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -700,9 +700,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -710,12 +710,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -725,9 +725,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -737,9 +737,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -749,11 +749,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -763,9 +763,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -775,9 +775,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -787,9 +787,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -830,9 +830,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -842,25 +842,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Pane: { @@ -868,9 +868,9 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Left, @@ -878,17 +878,17 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Down, @@ -896,17 +896,17 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Up, @@ -914,17 +914,17 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Right, @@ -932,9 +932,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -944,10 +944,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -957,10 +957,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -970,10 +970,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1003,9 +1003,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1013,14 +1013,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenamePane, - ), - PaneNameInput( - [ + SwitchToMode { + input_mode: RenamePane, + }, + PaneNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1028,16 +1028,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1046,9 +1046,9 @@ Config { key_modifiers: {}, }: [ TogglePaneEmbedOrFloating, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1057,9 +1057,9 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1079,9 +1079,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1089,9 +1089,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1101,9 +1101,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1113,9 +1113,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1124,9 +1124,9 @@ Config { key_modifiers: {}, }: [ TogglePanePinned, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1136,9 +1136,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1146,9 +1146,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1158,9 +1158,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1168,9 +1168,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1180,9 +1180,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1190,9 +1190,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1202,9 +1202,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1212,14 +1212,14 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - None, - None, - false, - ), - SwitchToMode( - Normal, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1229,9 +1229,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1241,11 +1241,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1255,9 +1255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1267,9 +1267,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1287,9 +1287,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1328,16 +1328,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1345,13 +1345,13 @@ Config { ), key_modifiers: {}, }: [ - NewStackedPane( - None, - None, - ), - SwitchToMode( - Normal, - ), + NewStackedPane { + command: None, + pane_name: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1361,9 +1361,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1373,9 +1373,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -1384,9 +1384,9 @@ Config { key_modifiers: {}, }: [ ToggleFloatingPanes, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1395,9 +1395,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1406,25 +1406,25 @@ Config { key_modifiers: {}, }: [ TogglePaneFrames, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tab: { @@ -1440,9 +1440,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -1456,9 +1456,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -1472,9 +1472,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -1488,9 +1488,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1500,10 +1500,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1513,10 +1513,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1524,12 +1524,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 1, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 1, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1537,12 +1537,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 2, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 2, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1550,12 +1550,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 3, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 3, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1563,12 +1563,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 4, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 4, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1576,12 +1576,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 5, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 5, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1589,12 +1589,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 6, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 6, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1602,12 +1602,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 7, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 7, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1615,12 +1615,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 8, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 8, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1628,12 +1628,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 9, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 9, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1643,10 +1643,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1655,9 +1655,9 @@ Config { key_modifiers: {}, }: [ BreakPaneLeft, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1676,9 +1676,9 @@ Config { key_modifiers: {}, }: [ BreakPaneRight, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1697,9 +1697,9 @@ Config { key_modifiers: {}, }: [ BreakPane, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1709,9 +1709,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1731,9 +1731,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1751,9 +1751,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1763,9 +1763,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1775,9 +1775,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1795,9 +1795,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1815,9 +1815,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1835,9 +1835,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1845,18 +1845,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1866,9 +1866,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1878,11 +1878,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1892,9 +1892,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1904,9 +1904,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1916,9 +1916,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -1957,14 +1957,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), - TabNameInput( - [ + SwitchToMode { + input_mode: RenameTab, + }, + TabNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1973,9 +1973,9 @@ Config { key_modifiers: {}, }: [ ToggleActiveSyncTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1985,9 +1985,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1997,9 +1997,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2008,9 +2008,9 @@ Config { key_modifiers: {}, }: [ CloseTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Tab, @@ -2022,17 +2022,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Scroll: { @@ -2060,9 +2060,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2076,9 +2076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2092,9 +2092,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2108,9 +2108,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2120,10 +2120,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2133,10 +2133,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2146,10 +2146,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2190,9 +2190,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2209,9 +2209,9 @@ Config { key_modifiers: {}, }: [ EditScrollback, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2241,9 +2241,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2261,9 +2261,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2273,9 +2273,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2285,9 +2285,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2305,9 +2305,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2325,9 +2325,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2345,9 +2345,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2357,9 +2357,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2369,11 +2369,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2383,9 +2383,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2395,9 +2395,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2407,9 +2407,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2448,14 +2448,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - EnterSearch, - ), - SearchInput( - [ + SwitchToMode { + input_mode: EnterSearch, + }, + SearchInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -2465,9 +2465,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2477,9 +2477,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -2493,17 +2493,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, EnterSearch: { @@ -2513,9 +2513,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2523,9 +2523,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2533,9 +2533,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2543,9 +2543,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2555,10 +2555,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2568,10 +2568,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2581,10 +2581,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2614,9 +2614,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -2626,9 +2626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2648,9 +2648,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2660,9 +2660,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2672,9 +2672,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2684,9 +2684,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2696,9 +2696,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2708,9 +2708,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2720,9 +2720,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2732,9 +2732,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2744,11 +2744,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2758,9 +2758,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2770,9 +2770,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2782,9 +2782,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2825,9 +2825,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2837,25 +2837,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Search, - ), + SwitchToMode { + input_mode: Search, + }, ], }, Search: { @@ -2883,9 +2883,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2899,9 +2899,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2915,9 +2915,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2931,9 +2931,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2943,10 +2943,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2956,10 +2956,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2969,10 +2969,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3010,9 +3010,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - CaseSensitivity, - ), + SearchToggleOption { + option: CaseSensitivity, + }, ], KeyWithModifier { bare_key: Char( @@ -3023,9 +3023,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3063,9 +3063,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3083,9 +3083,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3095,9 +3095,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3107,9 +3107,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3127,9 +3127,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3147,9 +3147,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3167,9 +3167,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3177,9 +3177,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Down, - ), + Search { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3189,9 +3189,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3201,11 +3201,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3213,9 +3213,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - WholeWord, - ), + SearchToggleOption { + option: WholeWord, + }, ], KeyWithModifier { bare_key: Char( @@ -3225,9 +3225,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3237,9 +3237,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3247,9 +3247,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Up, - ), + Search { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3259,9 +3259,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3302,9 +3302,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3314,9 +3314,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -3332,25 +3332,25 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - Wrap, - ), + SearchToggleOption { + option: Wrap, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenameTab: { @@ -3360,9 +3360,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3370,9 +3370,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3380,9 +3380,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3390,9 +3390,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3402,10 +3402,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3415,10 +3415,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3428,10 +3428,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3461,9 +3461,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3473,9 +3473,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3495,9 +3495,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3507,9 +3507,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3519,9 +3519,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3531,9 +3531,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3543,9 +3543,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3555,9 +3555,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3567,9 +3567,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3579,9 +3579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3591,11 +3591,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3605,9 +3605,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3617,9 +3617,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3629,9 +3629,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3672,9 +3672,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -3684,26 +3684,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenameTab, - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenamePane: { @@ -3713,9 +3713,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3723,9 +3723,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3733,9 +3733,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3743,9 +3743,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3755,10 +3755,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3768,10 +3768,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3781,10 +3781,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3814,9 +3814,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3826,9 +3826,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3848,9 +3848,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3860,9 +3860,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3872,9 +3872,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3884,9 +3884,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3896,9 +3896,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3908,9 +3908,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3920,9 +3920,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3932,9 +3932,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3944,11 +3944,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3958,9 +3958,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3970,9 +3970,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3982,9 +3982,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4025,9 +4025,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4037,26 +4037,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenamePane, - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Session: { @@ -4066,9 +4066,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -4076,9 +4076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -4086,9 +4086,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -4096,9 +4096,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4108,10 +4108,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4121,10 +4121,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4134,10 +4134,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4165,8 +4165,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4180,14 +4180,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4197,9 +4197,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4207,8 +4207,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "configuration", configuration: Some( @@ -4220,14 +4220,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4255,9 +4255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4267,9 +4267,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -4279,9 +4279,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4291,9 +4291,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4303,9 +4303,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4315,9 +4315,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4327,9 +4327,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4339,9 +4339,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4351,11 +4351,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4365,9 +4365,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4377,9 +4377,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4387,8 +4387,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "plugin-manager", configuration: Some( @@ -4400,14 +4400,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4417,9 +4417,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4458,8 +4458,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4473,14 +4473,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4490,9 +4490,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4502,9 +4502,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -4512,8 +4512,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "session-manager", configuration: Some( @@ -4525,30 +4525,30 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Move: { @@ -4556,11 +4556,11 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -4568,19 +4568,19 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -4588,19 +4588,19 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -4608,19 +4608,19 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -4628,9 +4628,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4640,10 +4640,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4653,10 +4653,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4666,10 +4666,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4699,9 +4699,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4721,9 +4721,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4731,11 +4731,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4745,9 +4745,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4757,9 +4757,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4769,9 +4769,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4779,11 +4779,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4793,9 +4793,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4803,11 +4803,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4817,9 +4817,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4827,11 +4827,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4841,9 +4841,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4851,9 +4851,9 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4863,9 +4863,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4875,11 +4875,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4889,9 +4889,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -4901,9 +4901,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4921,9 +4921,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4964,9 +4964,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4976,33 +4976,33 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Tab, key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Prompt: { @@ -5012,9 +5012,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -5022,9 +5022,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -5032,9 +5032,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -5042,9 +5042,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5054,10 +5054,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5067,10 +5067,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5080,10 +5080,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5113,9 +5113,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -5135,9 +5135,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5147,9 +5147,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5159,9 +5159,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5171,9 +5171,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5183,9 +5183,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5195,9 +5195,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5207,9 +5207,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5219,9 +5219,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5231,11 +5231,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5245,9 +5245,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5257,9 +5257,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5269,9 +5269,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5312,9 +5312,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5324,25 +5324,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tmux: { @@ -5350,12 +5350,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Left, @@ -5363,20 +5363,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Down, @@ -5384,20 +5384,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Up, @@ -5405,20 +5405,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Right, @@ -5426,9 +5426,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5444,16 +5444,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5461,16 +5461,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5480,10 +5480,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5491,9 +5491,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), + SwitchToMode { + input_mode: RenameTab, + }, ], KeyWithModifier { bare_key: Char( @@ -5503,10 +5503,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5516,10 +5516,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5527,9 +5527,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5559,16 +5559,16 @@ Config { Ctrl, }, }: [ - Write( - None, - [ + Write { + key_with_modifier: None, + bytes: [ 2, ], - false, - ), - SwitchToMode( - Normal, - ), + is_kitty_keyboard_protocol: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5576,18 +5576,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5615,9 +5615,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5625,12 +5625,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5640,9 +5640,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5652,9 +5652,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5664,9 +5664,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5674,12 +5674,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5689,9 +5689,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5699,12 +5699,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5714,9 +5714,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5724,12 +5724,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5739,9 +5739,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5750,9 +5750,9 @@ Config { key_modifiers: {}, }: [ GoToNextTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5762,9 +5762,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5774,11 +5774,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5796,9 +5796,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5808,9 +5808,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5819,9 +5819,9 @@ Config { key_modifiers: {}, }: [ GoToPreviousTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5831,9 +5831,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5874,9 +5874,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5886,9 +5886,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -5897,9 +5897,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5908,25 +5908,25 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, }, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap index e02c7eea..9c280d9c 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap @@ -11,9 +11,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -21,9 +21,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -31,9 +31,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -41,9 +41,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -53,10 +53,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -66,10 +66,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -79,10 +79,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -112,9 +112,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -134,9 +134,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -146,9 +146,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -158,9 +158,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -170,9 +170,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -182,9 +182,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -194,9 +194,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -206,9 +206,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -218,9 +218,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -230,11 +230,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -244,9 +244,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -256,9 +256,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -268,9 +268,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -311,9 +311,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -323,9 +323,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], }, Locked: { @@ -337,9 +337,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Resize: { @@ -347,12 +347,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -360,20 +360,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -381,20 +381,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -402,20 +402,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -423,9 +423,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -433,10 +433,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -446,10 +446,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -457,10 +457,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -470,10 +470,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -481,10 +481,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -494,10 +494,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -505,12 +505,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -518,12 +518,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -531,12 +531,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -544,12 +544,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -579,9 +579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -601,9 +601,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -611,12 +611,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -626,9 +626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -638,9 +638,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -650,9 +650,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -660,12 +660,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -675,9 +675,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -685,12 +685,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -700,9 +700,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -710,12 +710,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -725,9 +725,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -737,9 +737,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -749,11 +749,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -763,9 +763,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -775,9 +775,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -787,9 +787,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -830,9 +830,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -842,25 +842,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Pane: { @@ -868,9 +868,9 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Left, @@ -878,17 +878,17 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Down, @@ -896,17 +896,17 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Up, @@ -914,17 +914,17 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Right, @@ -932,9 +932,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -944,10 +944,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -957,10 +957,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -970,10 +970,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1003,9 +1003,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1013,14 +1013,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenamePane, - ), - PaneNameInput( - [ + SwitchToMode { + input_mode: RenamePane, + }, + PaneNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1028,16 +1028,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1046,9 +1046,9 @@ Config { key_modifiers: {}, }: [ TogglePaneEmbedOrFloating, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1057,9 +1057,9 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1079,9 +1079,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1089,9 +1089,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1101,9 +1101,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1113,9 +1113,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1124,9 +1124,9 @@ Config { key_modifiers: {}, }: [ TogglePanePinned, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1136,9 +1136,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1146,9 +1146,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1158,9 +1158,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1168,9 +1168,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1180,9 +1180,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1190,9 +1190,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1202,9 +1202,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1212,14 +1212,14 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - None, - None, - false, - ), - SwitchToMode( - Normal, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1229,9 +1229,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1241,11 +1241,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1255,9 +1255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1267,9 +1267,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1287,9 +1287,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1328,16 +1328,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1345,13 +1345,13 @@ Config { ), key_modifiers: {}, }: [ - NewStackedPane( - None, - None, - ), - SwitchToMode( - Normal, - ), + NewStackedPane { + command: None, + pane_name: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1361,9 +1361,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1373,9 +1373,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -1384,9 +1384,9 @@ Config { key_modifiers: {}, }: [ ToggleFloatingPanes, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1395,9 +1395,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1406,25 +1406,25 @@ Config { key_modifiers: {}, }: [ TogglePaneFrames, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tab: { @@ -1440,9 +1440,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -1456,9 +1456,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -1472,9 +1472,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -1488,9 +1488,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1500,10 +1500,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1513,10 +1513,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1524,12 +1524,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 1, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 1, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1537,12 +1537,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 2, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 2, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1550,12 +1550,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 3, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 3, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1563,12 +1563,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 4, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 4, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1576,12 +1576,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 5, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 5, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1589,12 +1589,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 6, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 6, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1602,12 +1602,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 7, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 7, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1615,12 +1615,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 8, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 8, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1628,12 +1628,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 9, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 9, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1643,10 +1643,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1655,9 +1655,9 @@ Config { key_modifiers: {}, }: [ BreakPaneLeft, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1676,9 +1676,9 @@ Config { key_modifiers: {}, }: [ BreakPaneRight, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1697,9 +1697,9 @@ Config { key_modifiers: {}, }: [ BreakPane, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1709,9 +1709,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1731,9 +1731,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1751,9 +1751,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1763,9 +1763,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1775,9 +1775,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1795,9 +1795,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1815,9 +1815,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1835,9 +1835,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1845,18 +1845,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1866,9 +1866,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1878,11 +1878,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1892,9 +1892,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1904,9 +1904,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1916,9 +1916,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -1957,14 +1957,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), - TabNameInput( - [ + SwitchToMode { + input_mode: RenameTab, + }, + TabNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1973,9 +1973,9 @@ Config { key_modifiers: {}, }: [ ToggleActiveSyncTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1985,9 +1985,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1997,9 +1997,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2008,9 +2008,9 @@ Config { key_modifiers: {}, }: [ CloseTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Tab, @@ -2022,17 +2022,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Scroll: { @@ -2060,9 +2060,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2076,9 +2076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2092,9 +2092,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2108,9 +2108,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2120,10 +2120,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2133,10 +2133,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2146,10 +2146,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2190,9 +2190,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2209,9 +2209,9 @@ Config { key_modifiers: {}, }: [ EditScrollback, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2241,9 +2241,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2261,9 +2261,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2273,9 +2273,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2285,9 +2285,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2305,9 +2305,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2325,9 +2325,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2345,9 +2345,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2357,9 +2357,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2369,11 +2369,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2383,9 +2383,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2395,9 +2395,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2407,9 +2407,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2448,14 +2448,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - EnterSearch, - ), - SearchInput( - [ + SwitchToMode { + input_mode: EnterSearch, + }, + SearchInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -2465,9 +2465,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2477,9 +2477,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -2493,17 +2493,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, EnterSearch: { @@ -2513,9 +2513,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2523,9 +2523,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2533,9 +2533,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2543,9 +2543,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2555,10 +2555,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2568,10 +2568,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2581,10 +2581,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2614,9 +2614,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -2626,9 +2626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2648,9 +2648,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2660,9 +2660,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2672,9 +2672,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2684,9 +2684,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2696,9 +2696,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2708,9 +2708,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2720,9 +2720,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2732,9 +2732,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2744,11 +2744,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2758,9 +2758,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2770,9 +2770,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2782,9 +2782,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2825,9 +2825,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2837,25 +2837,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Search, - ), + SwitchToMode { + input_mode: Search, + }, ], }, Search: { @@ -2883,9 +2883,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2899,9 +2899,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2915,9 +2915,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2931,9 +2931,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2943,10 +2943,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2956,10 +2956,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2969,10 +2969,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3010,9 +3010,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - CaseSensitivity, - ), + SearchToggleOption { + option: CaseSensitivity, + }, ], KeyWithModifier { bare_key: Char( @@ -3023,9 +3023,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3063,9 +3063,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3083,9 +3083,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3095,9 +3095,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3107,9 +3107,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3127,9 +3127,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3147,9 +3147,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3167,9 +3167,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3177,9 +3177,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Down, - ), + Search { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3189,9 +3189,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3201,11 +3201,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3213,9 +3213,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - WholeWord, - ), + SearchToggleOption { + option: WholeWord, + }, ], KeyWithModifier { bare_key: Char( @@ -3225,9 +3225,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3237,9 +3237,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3247,9 +3247,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Up, - ), + Search { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3259,9 +3259,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3302,9 +3302,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3314,9 +3314,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -3332,25 +3332,25 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - Wrap, - ), + SearchToggleOption { + option: Wrap, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenameTab: { @@ -3360,9 +3360,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3370,9 +3370,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3380,9 +3380,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3390,9 +3390,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3402,10 +3402,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3415,10 +3415,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3428,10 +3428,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3461,9 +3461,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3473,9 +3473,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3495,9 +3495,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3507,9 +3507,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3519,9 +3519,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3531,9 +3531,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3543,9 +3543,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3555,9 +3555,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3567,9 +3567,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3579,9 +3579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3591,11 +3591,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3605,9 +3605,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3617,9 +3617,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3629,9 +3629,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3672,9 +3672,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -3684,26 +3684,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenameTab, - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenamePane: { @@ -3713,9 +3713,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3723,9 +3723,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3733,9 +3733,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3743,9 +3743,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3755,10 +3755,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3768,10 +3768,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3781,10 +3781,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3814,9 +3814,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3826,9 +3826,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3848,9 +3848,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3860,9 +3860,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3872,9 +3872,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3884,9 +3884,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3896,9 +3896,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3908,9 +3908,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3920,9 +3920,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3932,9 +3932,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3944,11 +3944,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3958,9 +3958,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3970,9 +3970,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3982,9 +3982,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4025,9 +4025,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4037,26 +4037,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenamePane, - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Session: { @@ -4066,9 +4066,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -4076,9 +4076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -4086,9 +4086,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -4096,9 +4096,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4108,10 +4108,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4121,10 +4121,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4134,10 +4134,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4165,8 +4165,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4180,14 +4180,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4197,9 +4197,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4207,8 +4207,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "configuration", configuration: Some( @@ -4220,14 +4220,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4255,9 +4255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4267,9 +4267,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -4279,9 +4279,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4291,9 +4291,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4303,9 +4303,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4315,9 +4315,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4327,9 +4327,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4339,9 +4339,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4351,11 +4351,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4365,9 +4365,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4377,9 +4377,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4387,8 +4387,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "plugin-manager", configuration: Some( @@ -4400,14 +4400,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4417,9 +4417,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4458,8 +4458,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4473,14 +4473,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4490,9 +4490,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4502,9 +4502,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -4512,8 +4512,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "session-manager", configuration: Some( @@ -4525,30 +4525,30 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Move: { @@ -4556,11 +4556,11 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -4568,19 +4568,19 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -4588,19 +4588,19 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -4608,19 +4608,19 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -4628,9 +4628,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4640,10 +4640,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4653,10 +4653,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4666,10 +4666,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4699,9 +4699,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4721,9 +4721,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4731,11 +4731,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4745,9 +4745,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4757,9 +4757,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4769,9 +4769,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4779,11 +4779,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4793,9 +4793,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4803,11 +4803,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4817,9 +4817,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4827,11 +4827,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4841,9 +4841,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4851,9 +4851,9 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4863,9 +4863,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4875,11 +4875,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4889,9 +4889,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -4901,9 +4901,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4921,9 +4921,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4964,9 +4964,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4976,33 +4976,33 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Tab, key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Prompt: { @@ -5012,9 +5012,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -5022,9 +5022,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -5032,9 +5032,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -5042,9 +5042,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5054,10 +5054,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5067,10 +5067,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5080,10 +5080,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5113,9 +5113,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -5135,9 +5135,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5147,9 +5147,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5159,9 +5159,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5171,9 +5171,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5183,9 +5183,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5195,9 +5195,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5207,9 +5207,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5219,9 +5219,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5231,11 +5231,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5245,9 +5245,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5257,9 +5257,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5269,9 +5269,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5312,9 +5312,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5324,25 +5324,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tmux: { @@ -5350,12 +5350,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Left, @@ -5363,20 +5363,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Down, @@ -5384,20 +5384,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Up, @@ -5405,20 +5405,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Right, @@ -5426,9 +5426,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5444,16 +5444,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5461,16 +5461,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5480,10 +5480,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5491,9 +5491,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), + SwitchToMode { + input_mode: RenameTab, + }, ], KeyWithModifier { bare_key: Char( @@ -5503,10 +5503,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5516,10 +5516,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5527,9 +5527,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5559,16 +5559,16 @@ Config { Ctrl, }, }: [ - Write( - None, - [ + Write { + key_with_modifier: None, + bytes: [ 2, ], - false, - ), - SwitchToMode( - Normal, - ), + is_kitty_keyboard_protocol: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5576,18 +5576,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5615,9 +5615,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5625,12 +5625,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5640,9 +5640,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5652,9 +5652,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5664,9 +5664,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5674,12 +5674,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5689,9 +5689,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5699,12 +5699,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5714,9 +5714,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5724,12 +5724,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5739,9 +5739,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5750,9 +5750,9 @@ Config { key_modifiers: {}, }: [ GoToNextTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5762,9 +5762,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5774,11 +5774,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5796,9 +5796,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5808,9 +5808,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5819,9 +5819,9 @@ Config { key_modifiers: {}, }: [ GoToPreviousTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5831,9 +5831,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5874,9 +5874,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5886,9 +5886,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -5897,9 +5897,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5908,25 +5908,25 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, }, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap index c19e3eea..773ae7e4 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap @@ -11,9 +11,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -23,9 +23,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -35,9 +35,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], }, Resize: { @@ -47,9 +47,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -59,9 +59,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], }, Scroll: { @@ -71,9 +71,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -83,9 +83,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], }, }, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap index 69b2d6b5..0406faa8 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap @@ -11,9 +11,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -21,9 +21,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -31,9 +31,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -41,9 +41,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -53,10 +53,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -66,10 +66,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -79,10 +79,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -112,9 +112,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -134,9 +134,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -146,9 +146,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -158,9 +158,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -170,9 +170,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -182,9 +182,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -194,9 +194,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -206,9 +206,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -218,9 +218,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -230,11 +230,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -244,9 +244,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -256,9 +256,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -268,9 +268,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -311,9 +311,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -323,9 +323,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], }, Locked: { @@ -337,9 +337,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Resize: { @@ -347,12 +347,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -360,20 +360,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -381,20 +381,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -402,20 +402,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -423,9 +423,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -433,10 +433,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -446,10 +446,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -457,10 +457,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -470,10 +470,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -481,10 +481,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -494,10 +494,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -505,12 +505,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -518,12 +518,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -531,12 +531,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -544,12 +544,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -579,9 +579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -601,9 +601,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -611,12 +611,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -626,9 +626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -638,9 +638,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -650,9 +650,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -660,12 +660,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -675,9 +675,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -685,12 +685,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -700,9 +700,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -710,12 +710,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -725,9 +725,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -737,9 +737,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -749,11 +749,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -763,9 +763,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -775,9 +775,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -787,9 +787,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -830,9 +830,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -842,25 +842,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Pane: { @@ -868,9 +868,9 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Left, @@ -878,17 +878,17 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Down, @@ -896,17 +896,17 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Up, @@ -914,17 +914,17 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Right, @@ -932,9 +932,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -944,10 +944,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -957,10 +957,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -970,10 +970,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1003,9 +1003,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1013,14 +1013,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenamePane, - ), - PaneNameInput( - [ + SwitchToMode { + input_mode: RenamePane, + }, + PaneNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1028,16 +1028,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1046,9 +1046,9 @@ Config { key_modifiers: {}, }: [ TogglePaneEmbedOrFloating, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1057,9 +1057,9 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1079,9 +1079,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1089,9 +1089,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1101,9 +1101,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1113,9 +1113,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1124,9 +1124,9 @@ Config { key_modifiers: {}, }: [ TogglePanePinned, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1136,9 +1136,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1146,9 +1146,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1158,9 +1158,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1168,9 +1168,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1180,9 +1180,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1190,9 +1190,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1202,9 +1202,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1212,14 +1212,14 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - None, - None, - false, - ), - SwitchToMode( - Normal, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1229,9 +1229,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1241,11 +1241,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1255,9 +1255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1267,9 +1267,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1287,9 +1287,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1328,16 +1328,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1345,13 +1345,13 @@ Config { ), key_modifiers: {}, }: [ - NewStackedPane( - None, - None, - ), - SwitchToMode( - Normal, - ), + NewStackedPane { + command: None, + pane_name: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1361,9 +1361,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1373,9 +1373,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -1384,9 +1384,9 @@ Config { key_modifiers: {}, }: [ ToggleFloatingPanes, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1395,9 +1395,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1406,25 +1406,25 @@ Config { key_modifiers: {}, }: [ TogglePaneFrames, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tab: { @@ -1440,9 +1440,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -1456,9 +1456,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -1472,9 +1472,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -1488,9 +1488,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1500,10 +1500,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1513,10 +1513,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1524,12 +1524,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 1, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 1, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1537,12 +1537,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 2, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 2, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1550,12 +1550,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 3, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 3, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1563,12 +1563,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 4, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 4, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1576,12 +1576,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 5, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 5, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1589,12 +1589,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 6, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 6, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1602,12 +1602,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 7, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 7, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1615,12 +1615,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 8, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 8, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1628,12 +1628,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 9, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 9, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1643,10 +1643,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1655,9 +1655,9 @@ Config { key_modifiers: {}, }: [ BreakPaneLeft, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1676,9 +1676,9 @@ Config { key_modifiers: {}, }: [ BreakPaneRight, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1697,9 +1697,9 @@ Config { key_modifiers: {}, }: [ BreakPane, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1709,9 +1709,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1731,9 +1731,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1751,9 +1751,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1763,9 +1763,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1775,9 +1775,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1795,9 +1795,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1815,9 +1815,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1835,9 +1835,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1845,18 +1845,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1866,9 +1866,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1878,11 +1878,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1892,9 +1892,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1904,9 +1904,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1916,9 +1916,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -1957,14 +1957,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), - TabNameInput( - [ + SwitchToMode { + input_mode: RenameTab, + }, + TabNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1973,9 +1973,9 @@ Config { key_modifiers: {}, }: [ ToggleActiveSyncTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1985,9 +1985,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1997,9 +1997,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2008,9 +2008,9 @@ Config { key_modifiers: {}, }: [ CloseTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Tab, @@ -2022,17 +2022,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Scroll: { @@ -2060,9 +2060,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2076,9 +2076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2092,9 +2092,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2108,9 +2108,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2120,10 +2120,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2133,10 +2133,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2146,10 +2146,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2190,9 +2190,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2209,9 +2209,9 @@ Config { key_modifiers: {}, }: [ EditScrollback, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2241,9 +2241,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2261,9 +2261,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2273,9 +2273,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2285,9 +2285,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2305,9 +2305,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2325,9 +2325,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2345,9 +2345,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2357,9 +2357,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2369,11 +2369,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2383,9 +2383,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2395,9 +2395,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2407,9 +2407,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2448,14 +2448,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - EnterSearch, - ), - SearchInput( - [ + SwitchToMode { + input_mode: EnterSearch, + }, + SearchInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -2465,9 +2465,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2477,9 +2477,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -2493,17 +2493,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, EnterSearch: { @@ -2513,9 +2513,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2523,9 +2523,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2533,9 +2533,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2543,9 +2543,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2555,10 +2555,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2568,10 +2568,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2581,10 +2581,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2614,9 +2614,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -2626,9 +2626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2648,9 +2648,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2660,9 +2660,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2672,9 +2672,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2684,9 +2684,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2696,9 +2696,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2708,9 +2708,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2720,9 +2720,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2732,9 +2732,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2744,11 +2744,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2758,9 +2758,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2770,9 +2770,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2782,9 +2782,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2825,9 +2825,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2837,25 +2837,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Search, - ), + SwitchToMode { + input_mode: Search, + }, ], }, Search: { @@ -2883,9 +2883,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2899,9 +2899,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2915,9 +2915,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2931,9 +2931,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2943,10 +2943,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2956,10 +2956,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2969,10 +2969,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3010,9 +3010,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - CaseSensitivity, - ), + SearchToggleOption { + option: CaseSensitivity, + }, ], KeyWithModifier { bare_key: Char( @@ -3023,9 +3023,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3063,9 +3063,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3083,9 +3083,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3095,9 +3095,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3107,9 +3107,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3127,9 +3127,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3147,9 +3147,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3167,9 +3167,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3177,9 +3177,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Down, - ), + Search { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3189,9 +3189,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3201,11 +3201,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3213,9 +3213,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - WholeWord, - ), + SearchToggleOption { + option: WholeWord, + }, ], KeyWithModifier { bare_key: Char( @@ -3225,9 +3225,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3237,9 +3237,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3247,9 +3247,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Up, - ), + Search { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3259,9 +3259,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3302,9 +3302,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3314,9 +3314,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -3332,25 +3332,25 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - Wrap, - ), + SearchToggleOption { + option: Wrap, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenameTab: { @@ -3360,9 +3360,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3370,9 +3370,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3380,9 +3380,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3390,9 +3390,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3402,10 +3402,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3415,10 +3415,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3428,10 +3428,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3461,9 +3461,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3473,9 +3473,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3495,9 +3495,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3507,9 +3507,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3519,9 +3519,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3531,9 +3531,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3543,9 +3543,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3555,9 +3555,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3567,9 +3567,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3579,9 +3579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3591,11 +3591,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3605,9 +3605,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3617,9 +3617,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3629,9 +3629,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3672,9 +3672,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -3684,26 +3684,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenameTab, - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenamePane: { @@ -3713,9 +3713,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3723,9 +3723,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3733,9 +3733,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3743,9 +3743,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3755,10 +3755,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3768,10 +3768,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3781,10 +3781,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3814,9 +3814,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3826,9 +3826,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3848,9 +3848,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3860,9 +3860,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3872,9 +3872,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3884,9 +3884,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3896,9 +3896,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3908,9 +3908,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3920,9 +3920,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3932,9 +3932,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3944,11 +3944,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3958,9 +3958,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3970,9 +3970,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3982,9 +3982,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4025,9 +4025,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4037,26 +4037,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenamePane, - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Session: { @@ -4066,9 +4066,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -4076,9 +4076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -4086,9 +4086,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -4096,9 +4096,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4108,10 +4108,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4121,10 +4121,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4134,10 +4134,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4165,8 +4165,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4180,14 +4180,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4197,9 +4197,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4207,8 +4207,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "configuration", configuration: Some( @@ -4220,14 +4220,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4255,9 +4255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4267,9 +4267,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -4279,9 +4279,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4291,9 +4291,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4303,9 +4303,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4315,9 +4315,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4327,9 +4327,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4339,9 +4339,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4351,11 +4351,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4365,9 +4365,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4377,9 +4377,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4387,8 +4387,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "plugin-manager", configuration: Some( @@ -4400,14 +4400,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4417,9 +4417,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4458,8 +4458,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4473,14 +4473,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4490,9 +4490,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4502,9 +4502,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -4512,8 +4512,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "session-manager", configuration: Some( @@ -4525,30 +4525,30 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Move: { @@ -4556,11 +4556,11 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -4568,19 +4568,19 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -4588,19 +4588,19 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -4608,19 +4608,19 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -4628,9 +4628,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4640,10 +4640,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4653,10 +4653,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4666,10 +4666,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4699,9 +4699,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4721,9 +4721,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4731,11 +4731,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4745,9 +4745,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4757,9 +4757,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4769,9 +4769,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4779,11 +4779,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4793,9 +4793,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4803,11 +4803,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4817,9 +4817,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4827,11 +4827,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4841,9 +4841,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4851,9 +4851,9 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4863,9 +4863,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4875,11 +4875,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4889,9 +4889,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -4901,9 +4901,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4921,9 +4921,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4964,9 +4964,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4976,33 +4976,33 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Tab, key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Prompt: { @@ -5012,9 +5012,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -5022,9 +5022,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -5032,9 +5032,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -5042,9 +5042,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5054,10 +5054,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5067,10 +5067,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5080,10 +5080,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5113,9 +5113,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -5135,9 +5135,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5147,9 +5147,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5159,9 +5159,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5171,9 +5171,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5183,9 +5183,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5195,9 +5195,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5207,9 +5207,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5219,9 +5219,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5231,11 +5231,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5245,9 +5245,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5257,9 +5257,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5269,9 +5269,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5312,9 +5312,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5324,25 +5324,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tmux: { @@ -5350,12 +5350,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Left, @@ -5363,20 +5363,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Down, @@ -5384,20 +5384,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Up, @@ -5405,20 +5405,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Right, @@ -5426,9 +5426,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5444,16 +5444,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5461,16 +5461,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5480,10 +5480,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5491,9 +5491,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), + SwitchToMode { + input_mode: RenameTab, + }, ], KeyWithModifier { bare_key: Char( @@ -5503,10 +5503,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5516,10 +5516,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5527,9 +5527,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5559,16 +5559,16 @@ Config { Ctrl, }, }: [ - Write( - None, - [ + Write { + key_with_modifier: None, + bytes: [ 2, ], - false, - ), - SwitchToMode( - Normal, - ), + is_kitty_keyboard_protocol: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5576,18 +5576,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5615,9 +5615,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5625,12 +5625,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5640,9 +5640,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5652,9 +5652,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5664,9 +5664,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5674,12 +5674,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5689,9 +5689,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5699,12 +5699,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5714,9 +5714,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5724,12 +5724,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5739,9 +5739,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5750,9 +5750,9 @@ Config { key_modifiers: {}, }: [ GoToNextTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5762,9 +5762,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5774,11 +5774,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5796,9 +5796,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5808,9 +5808,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5819,9 +5819,9 @@ Config { key_modifiers: {}, }: [ GoToPreviousTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5831,9 +5831,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5874,9 +5874,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5886,9 +5886,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -5897,9 +5897,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5908,25 +5908,25 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, }, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap index c4a4345b..ca2b7bae 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap @@ -11,9 +11,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -21,9 +21,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -31,9 +31,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -41,9 +41,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -53,10 +53,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -66,10 +66,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -79,10 +79,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -112,9 +112,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -134,9 +134,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -146,9 +146,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -158,9 +158,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -170,9 +170,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -182,9 +182,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -194,9 +194,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -206,9 +206,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -218,9 +218,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -230,11 +230,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -244,9 +244,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -256,9 +256,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -268,9 +268,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -311,9 +311,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -323,9 +323,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], }, Locked: { @@ -337,9 +337,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Resize: { @@ -347,12 +347,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -360,20 +360,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -381,20 +381,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -402,20 +402,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -423,9 +423,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -433,10 +433,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -446,10 +446,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -457,10 +457,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -470,10 +470,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -481,10 +481,10 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -494,10 +494,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -505,12 +505,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -518,12 +518,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -531,12 +531,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -544,12 +544,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Decrease, - Some( + Resize { + resize: Decrease, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -579,9 +579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -601,9 +601,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -611,12 +611,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -626,9 +626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -638,9 +638,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -650,9 +650,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -660,12 +660,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -675,9 +675,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -685,12 +685,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -700,9 +700,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -710,12 +710,12 @@ Config { ), key_modifiers: {}, }: [ - Resize( - Increase, - Some( + Resize { + resize: Increase, + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -725,9 +725,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -737,9 +737,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -749,11 +749,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -763,9 +763,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -775,9 +775,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -787,9 +787,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -830,9 +830,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -842,25 +842,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Pane: { @@ -868,9 +868,9 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Left, @@ -878,17 +878,17 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Down, @@ -896,17 +896,17 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Up, @@ -914,17 +914,17 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Right, @@ -932,9 +932,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -944,10 +944,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -957,10 +957,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -970,10 +970,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1003,9 +1003,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1013,14 +1013,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenamePane, - ), - PaneNameInput( - [ + SwitchToMode { + input_mode: RenamePane, + }, + PaneNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1028,16 +1028,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1046,9 +1046,9 @@ Config { key_modifiers: {}, }: [ TogglePaneEmbedOrFloating, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1057,9 +1057,9 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1079,9 +1079,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1089,9 +1089,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), + MoveFocus { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1101,9 +1101,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1113,9 +1113,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1124,9 +1124,9 @@ Config { key_modifiers: {}, }: [ TogglePanePinned, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1136,9 +1136,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1146,9 +1146,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1158,9 +1158,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1168,9 +1168,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1180,9 +1180,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1190,9 +1190,9 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), + MoveFocus { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1202,9 +1202,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1212,14 +1212,14 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - None, - None, - false, - ), - SwitchToMode( - Normal, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1229,9 +1229,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1241,11 +1241,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1255,9 +1255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1267,9 +1267,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1287,9 +1287,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1328,16 +1328,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1345,13 +1345,13 @@ Config { ), key_modifiers: {}, }: [ - NewStackedPane( - None, - None, - ), - SwitchToMode( - Normal, - ), + NewStackedPane { + command: None, + pane_name: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1361,9 +1361,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1373,9 +1373,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -1384,9 +1384,9 @@ Config { key_modifiers: {}, }: [ ToggleFloatingPanes, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1395,9 +1395,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1406,25 +1406,25 @@ Config { key_modifiers: {}, }: [ TogglePaneFrames, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tab: { @@ -1440,9 +1440,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -1456,9 +1456,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -1472,9 +1472,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -1488,9 +1488,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1500,10 +1500,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1513,10 +1513,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1524,12 +1524,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 1, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 1, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1537,12 +1537,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 2, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 2, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1550,12 +1550,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 3, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 3, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1563,12 +1563,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 4, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 4, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1576,12 +1576,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 5, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 5, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1589,12 +1589,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 6, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 6, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1602,12 +1602,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 7, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 7, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1615,12 +1615,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 8, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 8, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1628,12 +1628,12 @@ Config { ), key_modifiers: {}, }: [ - GoToTab( - 9, - ), - SwitchToMode( - Normal, - ), + GoToTab { + index: 9, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1643,10 +1643,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -1655,9 +1655,9 @@ Config { key_modifiers: {}, }: [ BreakPaneLeft, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1676,9 +1676,9 @@ Config { key_modifiers: {}, }: [ BreakPaneRight, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1697,9 +1697,9 @@ Config { key_modifiers: {}, }: [ BreakPane, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1709,9 +1709,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -1731,9 +1731,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -1751,9 +1751,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -1763,9 +1763,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1775,9 +1775,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -1795,9 +1795,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -1815,9 +1815,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -1835,9 +1835,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1845,18 +1845,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1866,9 +1866,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -1878,11 +1878,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -1892,9 +1892,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -1904,9 +1904,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -1916,9 +1916,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -1957,14 +1957,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), - TabNameInput( - [ + SwitchToMode { + input_mode: RenameTab, + }, + TabNameInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -1973,9 +1973,9 @@ Config { key_modifiers: {}, }: [ ToggleActiveSyncTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -1985,9 +1985,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -1997,9 +1997,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2008,9 +2008,9 @@ Config { key_modifiers: {}, }: [ CloseTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Tab, @@ -2022,17 +2022,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Scroll: { @@ -2060,9 +2060,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2076,9 +2076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2092,9 +2092,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2108,9 +2108,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2120,10 +2120,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2133,10 +2133,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2146,10 +2146,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2190,9 +2190,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2209,9 +2209,9 @@ Config { key_modifiers: {}, }: [ EditScrollback, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2241,9 +2241,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2261,9 +2261,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2273,9 +2273,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2285,9 +2285,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2305,9 +2305,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2325,9 +2325,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2345,9 +2345,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2357,9 +2357,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2369,11 +2369,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2383,9 +2383,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2395,9 +2395,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2407,9 +2407,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2448,14 +2448,14 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - EnterSearch, - ), - SearchInput( - [ + SwitchToMode { + input_mode: EnterSearch, + }, + SearchInput { + input: [ 0, ], - ), + }, ], KeyWithModifier { bare_key: Char( @@ -2465,9 +2465,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -2477,9 +2477,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -2493,17 +2493,17 @@ Config { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, EnterSearch: { @@ -2513,9 +2513,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2523,9 +2523,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2533,9 +2533,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2543,9 +2543,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2555,10 +2555,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2568,10 +2568,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2581,10 +2581,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2614,9 +2614,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -2626,9 +2626,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2648,9 +2648,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -2660,9 +2660,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -2672,9 +2672,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2684,9 +2684,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -2696,9 +2696,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -2708,9 +2708,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -2720,9 +2720,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2732,9 +2732,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -2744,11 +2744,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -2758,9 +2758,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -2770,9 +2770,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2782,9 +2782,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -2825,9 +2825,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -2837,25 +2837,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Search, - ), + SwitchToMode { + input_mode: Search, + }, ], }, Search: { @@ -2883,9 +2883,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -2899,9 +2899,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -2915,9 +2915,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -2931,9 +2931,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -2943,10 +2943,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2956,10 +2956,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -2969,10 +2969,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3010,9 +3010,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - CaseSensitivity, - ), + SearchToggleOption { + option: CaseSensitivity, + }, ], KeyWithModifier { bare_key: Char( @@ -3023,9 +3023,9 @@ Config { }, }: [ ScrollToBottom, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3063,9 +3063,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3083,9 +3083,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3095,9 +3095,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3107,9 +3107,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3127,9 +3127,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3147,9 +3147,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3167,9 +3167,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3177,9 +3177,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Down, - ), + Search { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3189,9 +3189,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3201,11 +3201,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3213,9 +3213,9 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - WholeWord, - ), + SearchToggleOption { + option: WholeWord, + }, ], KeyWithModifier { bare_key: Char( @@ -3225,9 +3225,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3237,9 +3237,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3247,9 +3247,9 @@ Config { ), key_modifiers: {}, }: [ - Search( - Up, - ), + Search { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3259,9 +3259,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3302,9 +3302,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3314,9 +3314,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -3332,25 +3332,25 @@ Config { ), key_modifiers: {}, }: [ - SearchToggleOption( - Wrap, - ), + SearchToggleOption { + option: Wrap, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenameTab: { @@ -3360,9 +3360,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3370,9 +3370,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3380,9 +3380,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3390,9 +3390,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3402,10 +3402,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3415,10 +3415,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3428,10 +3428,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3461,9 +3461,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3473,9 +3473,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3495,9 +3495,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3507,9 +3507,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3519,9 +3519,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3531,9 +3531,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3543,9 +3543,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3555,9 +3555,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3567,9 +3567,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3579,9 +3579,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3591,11 +3591,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3605,9 +3605,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3617,9 +3617,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3629,9 +3629,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -3672,9 +3672,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -3684,26 +3684,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenameTab, - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, RenamePane: { @@ -3713,9 +3713,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -3723,9 +3723,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -3733,9 +3733,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -3743,9 +3743,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3755,10 +3755,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3768,10 +3768,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3781,10 +3781,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -3814,9 +3814,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -3826,9 +3826,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -3848,9 +3848,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -3860,9 +3860,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -3872,9 +3872,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3884,9 +3884,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -3896,9 +3896,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -3908,9 +3908,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -3920,9 +3920,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3932,9 +3932,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -3944,11 +3944,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -3958,9 +3958,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -3970,9 +3970,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -3982,9 +3982,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4025,9 +4025,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4037,26 +4037,26 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ UndoRenamePane, - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Session: { @@ -4066,9 +4066,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -4076,9 +4076,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -4086,9 +4086,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -4096,9 +4096,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4108,10 +4108,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4121,10 +4121,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4134,10 +4134,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4165,8 +4165,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4180,14 +4180,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4197,9 +4197,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4207,8 +4207,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "configuration", configuration: Some( @@ -4220,14 +4220,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4255,9 +4255,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4267,9 +4267,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -4279,9 +4279,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4291,9 +4291,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4303,9 +4303,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4315,9 +4315,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4327,9 +4327,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4339,9 +4339,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4351,11 +4351,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4365,9 +4365,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4377,9 +4377,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4387,8 +4387,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "plugin-manager", configuration: Some( @@ -4400,14 +4400,14 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4417,9 +4417,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4458,8 +4458,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - RunPlugin( + LaunchOrFocusPlugin { + plugin: RunPlugin( RunPlugin { _allow_exec_host_cmd: false, location: Zellij( @@ -4473,14 +4473,14 @@ Config { initial_cwd: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4490,9 +4490,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4502,9 +4502,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -4512,8 +4512,8 @@ Config { ), key_modifiers: {}, }: [ - LaunchOrFocusPlugin( - Alias( + LaunchOrFocusPlugin { + plugin: Alias( PluginAlias { name: "session-manager", configuration: Some( @@ -4525,30 +4525,30 @@ Config { run_plugin: None, }, ), - true, - true, - false, - false, - ), - SwitchToMode( - Normal, - ), + should_float: true, + move_to_focused_tab: true, + should_open_in_place: false, + skip_cache: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Move: { @@ -4556,11 +4556,11 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Left, @@ -4568,19 +4568,19 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Down, @@ -4588,19 +4588,19 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Up, @@ -4608,19 +4608,19 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Right, @@ -4628,9 +4628,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4640,10 +4640,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4653,10 +4653,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4666,10 +4666,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4699,9 +4699,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -4721,9 +4721,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -4731,11 +4731,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Left, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4745,9 +4745,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -4757,9 +4757,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4769,9 +4769,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -4779,11 +4779,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Down, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4793,9 +4793,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -4803,11 +4803,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Up, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4817,9 +4817,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -4827,11 +4827,11 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - Some( + MovePane { + direction: Some( Right, ), - ), + }, ], KeyWithModifier { bare_key: Char( @@ -4841,9 +4841,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4851,9 +4851,9 @@ Config { ), key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -4863,9 +4863,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -4875,11 +4875,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -4889,9 +4889,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -4901,9 +4901,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -4921,9 +4921,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -4964,9 +4964,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -4976,33 +4976,33 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Tab, key_modifiers: {}, }: [ - MovePane( - None, - ), + MovePane { + direction: None, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Prompt: { @@ -5012,9 +5012,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, @@ -5022,9 +5022,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, @@ -5032,9 +5032,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, @@ -5042,9 +5042,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5054,10 +5054,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5067,10 +5067,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5080,10 +5080,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5113,9 +5113,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tmux, - ), + SwitchToMode { + input_mode: Tmux, + }, ], KeyWithModifier { bare_key: Char( @@ -5135,9 +5135,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5147,9 +5147,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5159,9 +5159,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5171,9 +5171,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5183,9 +5183,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5195,9 +5195,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5207,9 +5207,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5219,9 +5219,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5231,11 +5231,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5245,9 +5245,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5257,9 +5257,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5269,9 +5269,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5312,9 +5312,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5324,25 +5324,25 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, Tmux: { @@ -5350,12 +5350,12 @@ Config { bare_key: Left, key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Left, @@ -5363,20 +5363,20 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Down, key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Down, @@ -5384,20 +5384,20 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Up, key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Up, @@ -5405,20 +5405,20 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Right, key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Right, @@ -5426,9 +5426,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5444,16 +5444,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Down, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5461,16 +5461,16 @@ Config { ), key_modifiers: {}, }: [ - NewPane( - Some( + NewPane { + direction: Some( Right, ), - None, - false, - ), - SwitchToMode( - Normal, - ), + pane_name: None, + start_suppressed: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5480,10 +5480,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5491,9 +5491,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - RenameTab, - ), + SwitchToMode { + input_mode: RenameTab, + }, ], KeyWithModifier { bare_key: Char( @@ -5503,10 +5503,10 @@ Config { Alt, }, }: [ - Resize( - Decrease, - None, - ), + Resize { + resize: Decrease, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5516,10 +5516,10 @@ Config { Alt, }, }: [ - Resize( - Increase, - None, - ), + Resize { + resize: Increase, + direction: None, + }, ], KeyWithModifier { bare_key: Char( @@ -5527,9 +5527,9 @@ Config { ), key_modifiers: {}, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5559,16 +5559,16 @@ Config { Ctrl, }, }: [ - Write( - None, - [ + Write { + key_with_modifier: None, + bytes: [ 2, ], - false, - ), - SwitchToMode( - Normal, - ), + is_kitty_keyboard_protocol: false, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5576,18 +5576,18 @@ Config { ), key_modifiers: {}, }: [ - NewTab( - None, - [], - None, - None, - None, - true, - None, - ), - SwitchToMode( - Normal, - ), + NewTab { + tiled_layout: None, + floating_layouts: [], + swap_tiled_layouts: None, + swap_floating_layouts: None, + tab_name: None, + should_change_focus_to_new_tab: true, + cwd: None, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5615,9 +5615,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Locked, - ), + SwitchToMode { + input_mode: Locked, + }, ], KeyWithModifier { bare_key: Char( @@ -5625,12 +5625,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Left, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Left, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5640,9 +5640,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Move, - ), + SwitchToMode { + input_mode: Move, + }, ], KeyWithModifier { bare_key: Char( @@ -5652,9 +5652,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Left, - ), + MoveFocusOrTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5664,9 +5664,9 @@ Config { Alt, }, }: [ - MoveTab( - Left, - ), + MoveTab { + direction: Left, + }, ], KeyWithModifier { bare_key: Char( @@ -5674,12 +5674,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Down, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Down, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5689,9 +5689,9 @@ Config { Alt, }, }: [ - MoveFocus( - Down, - ), + MoveFocus { + direction: Down, + }, ], KeyWithModifier { bare_key: Char( @@ -5699,12 +5699,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Up, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Up, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5714,9 +5714,9 @@ Config { Alt, }, }: [ - MoveFocus( - Up, - ), + MoveFocus { + direction: Up, + }, ], KeyWithModifier { bare_key: Char( @@ -5724,12 +5724,12 @@ Config { ), key_modifiers: {}, }: [ - MoveFocus( - Right, - ), - SwitchToMode( - Normal, - ), + MoveFocus { + direction: Right, + }, + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5739,9 +5739,9 @@ Config { Alt, }, }: [ - MoveFocusOrTab( - Right, - ), + MoveFocusOrTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5750,9 +5750,9 @@ Config { key_modifiers: {}, }: [ GoToNextTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5762,9 +5762,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Resize, - ), + SwitchToMode { + input_mode: Resize, + }, ], KeyWithModifier { bare_key: Char( @@ -5774,11 +5774,11 @@ Config { Alt, }, }: [ - NewPane( - None, - None, - false, - ), + NewPane { + direction: None, + pane_name: None, + start_suppressed: false, + }, ], KeyWithModifier { bare_key: Char( @@ -5796,9 +5796,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Session, - ), + SwitchToMode { + input_mode: Session, + }, ], KeyWithModifier { bare_key: Char( @@ -5808,9 +5808,9 @@ Config { Alt, }, }: [ - MoveTab( - Right, - ), + MoveTab { + direction: Right, + }, ], KeyWithModifier { bare_key: Char( @@ -5819,9 +5819,9 @@ Config { key_modifiers: {}, }: [ GoToPreviousTab, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5831,9 +5831,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Pane, - ), + SwitchToMode { + input_mode: Pane, + }, ], KeyWithModifier { bare_key: Char( @@ -5874,9 +5874,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Scroll, - ), + SwitchToMode { + input_mode: Scroll, + }, ], KeyWithModifier { bare_key: Char( @@ -5886,9 +5886,9 @@ Config { Ctrl, }, }: [ - SwitchToMode( - Tab, - ), + SwitchToMode { + input_mode: Tab, + }, ], KeyWithModifier { bare_key: Char( @@ -5897,9 +5897,9 @@ Config { key_modifiers: {}, }: [ CloseFocus, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Char( @@ -5908,25 +5908,25 @@ Config { key_modifiers: {}, }: [ ToggleFocusFullscreen, - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Esc, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], KeyWithModifier { bare_key: Enter, key_modifiers: {}, }: [ - SwitchToMode( - Normal, - ), + SwitchToMode { + input_mode: Normal, + }, ], }, }, diff --git a/zellij-utils/src/web_server_commands.rs b/zellij-utils/src/web_server_commands.rs index 0b020f6e..a1bcf885 100644 --- a/zellij-utils/src/web_server_commands.rs +++ b/zellij-utils/src/web_server_commands.rs @@ -1,9 +1,11 @@ use crate::consts::WEBSERVER_SOCKET_PATH; use crate::errors::prelude::*; +use crate::web_server_contract::web_server_contract::InstructionForWebServer as ProtoInstructionForWebServer; use interprocess::local_socket::LocalSocketStream; +use prost::Message; use serde::{Deserialize, Serialize}; use std::fs; -use std::io::{self, BufWriter, Write}; +use std::io::{BufWriter, Write}; use std::os::unix::fs::FileTypeExt; pub fn shutdown_all_webserver_instances() -> Result<()> { @@ -51,8 +53,15 @@ pub fn send_webserver_instruction( sender: &mut BufWriter<LocalSocketStream>, instruction: InstructionForWebServer, ) -> Result<()> { - rmp_serde::encode::write(sender, &instruction) - .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; + // Convert to protobuf and send with length prefix + let proto_instruction: ProtoInstructionForWebServer = instruction.into(); + let encoded = proto_instruction.encode_to_vec(); + let len = encoded.len() as u32; + + // Write length prefix + sender.write_all(&len.to_le_bytes())?; + // Write protobuf message + sender.write_all(&encoded)?; sender.flush()?; Ok(()) } diff --git a/zellij-utils/src/web_server_contract/mod.rs b/zellij-utils/src/web_server_contract/mod.rs new file mode 100644 index 00000000..ada2481e --- /dev/null +++ b/zellij-utils/src/web_server_contract/mod.rs @@ -0,0 +1,6 @@ +include!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/assets/prost_web_server/generated_web_server_api.rs" +)); + +mod protobuf_conversion; diff --git a/zellij-utils/src/web_server_contract/protobuf_conversion.rs b/zellij-utils/src/web_server_contract/protobuf_conversion.rs new file mode 100644 index 00000000..7a89f600 --- /dev/null +++ b/zellij-utils/src/web_server_contract/protobuf_conversion.rs @@ -0,0 +1,35 @@ +use crate::errors::prelude::*; +use crate::web_server_commands::InstructionForWebServer as RustInstructionForWebServer; +use crate::web_server_contract::web_server_contract::{ + instruction_for_web_server, InstructionForWebServer as ProtoInstructionForWebServer, + ShutdownWebServerMsg, +}; + +// Convert Rust InstructionForWebServer to protobuf +impl From<RustInstructionForWebServer> for ProtoInstructionForWebServer { + fn from(instruction: RustInstructionForWebServer) -> Self { + let instruction = match instruction { + RustInstructionForWebServer::ShutdownWebServer => { + instruction_for_web_server::Instruction::ShutdownWebServer(ShutdownWebServerMsg {}) + }, + }; + + ProtoInstructionForWebServer { + instruction: Some(instruction), + } + } +} + +// Convert protobuf InstructionForWebServer to Rust +impl TryFrom<ProtoInstructionForWebServer> for RustInstructionForWebServer { + type Error = anyhow::Error; + + fn try_from(proto_instruction: ProtoInstructionForWebServer) -> Result<Self> { + match proto_instruction.instruction { + Some(instruction_for_web_server::Instruction::ShutdownWebServer(_)) => { + Ok(RustInstructionForWebServer::ShutdownWebServer) + }, + None => Err(anyhow!("Missing instruction in InstructionForWebServer")), + } + } +} diff --git a/zellij-utils/src/web_server_contract/web_server_commands.proto b/zellij-utils/src/web_server_contract/web_server_commands.proto new file mode 100644 index 00000000..f8db28f9 --- /dev/null +++ b/zellij-utils/src/web_server_contract/web_server_commands.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package web_server_contract; + +message InstructionForWebServer { + oneof instruction { + ShutdownWebServerMsg shutdown_web_server = 1; + // Future commands can be added here + // RestartWebServerMsg restart_web_server = 2; + // ReloadConfigMsg reload_config = 3; + } +} + +message ShutdownWebServerMsg { + // Empty for now, but allows for future parameters like graceful timeout +}
\ No newline at end of file |
