diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-09-16 21:02:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-16 21:02:04 +0200 |
| commit | d78f3586dd3de75b0ae6a71500b6f15a1ef8d71d (patch) | |
| tree | 6e12313db4515a03f7653c099d1239e34ae4eb86 /zellij-tile | |
| parent | docs(readme): update sponsors (diff) | |
| download | sl0ppij-d78f3586dd3de75b0ae6a71500b6f15a1ef8d71d.tar.gz sl0ppij-d78f3586dd3de75b0ae6a71500b6f15a1ef8d71d.tar.xz sl0ppij-d78f3586dd3de75b0ae6a71500b6f15a1ef8d71d.zip | |
feat(plugins): APIs to break multiple panes into a new tab or an existing tab (#3610)
* feat(plugins): break multiple panes to a new tab
* fix(layouts): properly ignore run instructions when breaking panes
* feat(plugins): break multiple panes to existing tab
* feat(apis): allow these methods to also specify whether they want focus changed to the tab
* various fixes
* allow specifying name for the new tab when breaking out panes
* style(fmt): rustfmt
Diffstat (limited to 'zellij-tile')
| -rw-r--r-- | zellij-tile/src/shim.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index 9b57d1a9..268e10f2 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -1030,6 +1030,38 @@ where unsafe { host_run_plugin_command() }; } +/// Create a new tab that includes the specified pane ids +pub fn break_panes_to_new_tab( + pane_ids: &[PaneId], + new_tab_name: Option<String>, + should_change_focus_to_new_tab: bool, +) { + let plugin_command = PluginCommand::BreakPanesToNewTab( + pane_ids.to_vec(), + new_tab_name, + should_change_focus_to_new_tab, + ); + let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); + object_to_stdout(&protobuf_plugin_command.encode_to_vec()); + unsafe { host_run_plugin_command() }; +} + +/// Create a new tab that includes the specified pane ids +pub fn break_panes_to_tab_with_index( + pane_ids: &[PaneId], + tab_index: usize, + should_change_focus_to_new_tab: bool, +) { + let plugin_command = PluginCommand::BreakPanesToTabWithIndex( + pane_ids.to_vec(), + tab_index, + should_change_focus_to_new_tab, + ); + let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); + object_to_stdout(&protobuf_plugin_command.encode_to_vec()); + unsafe { host_run_plugin_command() }; +} + // Utility Functions #[allow(unused)] |
