aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-02-11 13:26:33 +0100
committerGitHub <noreply@github.com>2026-02-11 13:26:33 +0100
commit13a82eea6d74d8168e538b8755131ed793a7f054 (patch)
treebb8d2c1b6cd24bf46b84860360c48e6249e21ba1 /zellij-utils
parentAllow writing characters, bytes and keys to specific panes from the CLI (#4691) (diff)
downloadsl0ppij-13a82eea6d74d8168e538b8755131ed793a7f054.tar.gz
sl0ppij-13a82eea6d74d8168e538b8755131ed793a7f054.tar.xz
sl0ppij-13a82eea6d74d8168e538b8755131ed793a7f054.zip
CLI commands to query tab ids, names and info (#4695)
* add equivalent tab_id commands to tab_position commands (cli and plugins) * add list-tabs and current-tab-info cli commands * rustfmt * add pr
Diffstat (limited to 'zellij-utils')
-rw-r--r--zellij-utils/assets/prost/api.action.rs25
-rw-r--r--zellij-utils/assets/prost/api.plugin_command.rs80
-rw-r--r--zellij-utils/assets/prost_ipc/client_server_contract.rs54
-rw-r--r--zellij-utils/src/cli.rs49
-rw-r--r--zellij-utils/src/client_server_contract/common_types.proto29
-rw-r--r--zellij-utils/src/data.rs8
-rw-r--r--zellij-utils/src/errors.rs6
-rw-r--r--zellij-utils/src/input/actions.rs42
-rw-r--r--zellij-utils/src/ipc/protobuf_conversion.rs108
-rw-r--r--zellij-utils/src/plugin_api/action.proto11
-rw-r--r--zellij-utils/src/plugin_api/action.rs12
-rw-r--r--zellij-utils/src/plugin_api/plugin_command.proto40
-rw-r--r--zellij-utils/src/plugin_api/plugin_command.rs148
13 files changed, 556 insertions, 56 deletions
diff --git a/zellij-utils/assets/prost/api.action.rs b/zellij-utils/assets/prost/api.action.rs
index ee6d434f..7cc9043b 100644
--- a/zellij-utils/assets/prost/api.action.rs
+++ b/zellij-utils/assets/prost/api.action.rs
@@ -290,7 +290,7 @@ pub struct OverrideLayoutPayload {
pub struct Action {
#[prost(enumeration="ActionName", tag="1")]
pub name: i32,
- #[prost(oneof="action::OptionalPayload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54")]
+ #[prost(oneof="action::OptionalPayload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 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")]
pub optional_payload: ::core::option::Option<action::OptionalPayload>,
}
/// Nested message and enum types in `Action`.
@@ -398,6 +398,12 @@ pub mod action {
OverrideLayoutPayload(super::OverrideLayoutPayload),
#[prost(message, tag="54")]
SetPaneBorderlessPayload(super::SetPaneBorderlessPayload),
+ #[prost(uint64, tag="55")]
+ GoToTabByIdPayload(u64),
+ #[prost(uint64, tag="56")]
+ CloseTabByIdPayload(u64),
+ #[prost(message, tag="57")]
+ RenameTabByIdPayload(super::TabIdAndName),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
@@ -422,6 +428,14 @@ pub struct IdAndName {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct TabIdAndName {
+ #[prost(uint64, tag="1")]
+ pub tab_id: u64,
+ #[prost(string, tag="2")]
+ pub name: ::prost::alloc::string::String,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PaneIdAndShouldFloat {
#[prost(uint32, tag="1")]
pub pane_id: u32,
@@ -1055,6 +1069,9 @@ pub enum ActionName {
NewInPlacePane = 92,
OverrideLayout = 93,
SetPaneBorderless = 94,
+ GoToTabById = 95,
+ CloseTabById = 96,
+ RenameTabById = 97,
}
impl ActionName {
/// String value of the enum field names used in the ProtoBuf definition.
@@ -1155,6 +1172,9 @@ impl ActionName {
ActionName::NewInPlacePane => "NewInPlacePane",
ActionName::OverrideLayout => "OverrideLayout",
ActionName::SetPaneBorderless => "SetPaneBorderless",
+ ActionName::GoToTabById => "GoToTabById",
+ ActionName::CloseTabById => "CloseTabById",
+ ActionName::RenameTabById => "RenameTabById",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
@@ -1252,6 +1272,9 @@ impl ActionName {
"NewInPlacePane" => Some(Self::NewInPlacePane),
"OverrideLayout" => Some(Self::OverrideLayout),
"SetPaneBorderless" => Some(Self::SetPaneBorderless),
+ "GoToTabById" => Some(Self::GoToTabById),
+ "CloseTabById" => Some(Self::CloseTabById),
+ "RenameTabById" => Some(Self::RenameTabById),
_ => None,
}
}
diff --git a/zellij-utils/assets/prost/api.plugin_command.rs b/zellij-utils/assets/prost/api.plugin_command.rs
index 2be64791..90023ef1 100644
--- a/zellij-utils/assets/prost/api.plugin_command.rs
+++ b/zellij-utils/assets/prost/api.plugin_command.rs
@@ -3,7 +3,7 @@
pub struct PluginCommand {
#[prost(enumeration="CommandName", tag="1")]
pub name: i32,
- #[prost(oneof="plugin_command::Payload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142")]
+ #[prost(oneof="plugin_command::Payload", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147")]
pub payload: ::core::option::Option<plugin_command::Payload>,
}
/// Nested message and enum types in `PluginCommand`.
@@ -267,6 +267,16 @@ pub mod plugin_command {
GetPaneRunningCommandPayload(super::GetPaneRunningCommandPayload),
#[prost(message, tag="142")]
GetPaneCwdPayload(super::GetPaneCwdPayload),
+ #[prost(message, tag="143")]
+ SwitchTabToIdPayload(super::SwitchTabToIdPayload),
+ #[prost(message, tag="144")]
+ GoToTabWithIdPayload(super::GoToTabWithIdPayload),
+ #[prost(message, tag="145")]
+ CloseTabWithIdPayload(super::CloseTabWithIdPayload),
+ #[prost(message, tag="146")]
+ RenameTabWithIdPayload(super::RenameTabWithIdPayload),
+ #[prost(message, tag="147")]
+ BreakPanesToTabWithIdPayload(super::BreakPanesToTabWithIdPayload),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
@@ -934,6 +944,59 @@ pub struct FixedOrPercentValue {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct SwitchTabToIdPayload {
+ #[prost(uint64, tag="1")]
+ pub tab_id: u64,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct GoToTabWithIdPayload {
+ #[prost(uint64, tag="1")]
+ pub tab_id: u64,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct CloseTabWithIdPayload {
+ #[prost(uint64, tag="1")]
+ pub tab_id: u64,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct RenameTabWithIdPayload {
+ #[prost(uint64, tag="1")]
+ pub tab_id: u64,
+ #[prost(string, tag="2")]
+ pub new_name: ::prost::alloc::string::String,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct BreakPanesToTabWithIdPayload {
+ #[prost(message, repeated, tag="1")]
+ pub pane_ids: ::prost::alloc::vec::Vec<PaneId>,
+ #[prost(uint64, tag="2")]
+ pub tab_id: u64,
+ #[prost(bool, tag="3")]
+ pub should_change_focus_to_target_tab: bool,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct BreakPanesToTabWithIdResponse {
+ #[prost(oneof="break_panes_to_tab_with_id_response::Result", tags="1, 2")]
+ pub result: ::core::option::Option<break_panes_to_tab_with_id_response::Result>,
+}
+/// Nested message and enum types in `BreakPanesToTabWithIdResponse`.
+pub mod break_panes_to_tab_with_id_response {
+ #[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Oneof)]
+ pub enum Result {
+ #[prost(uint64, tag="1")]
+ TabId(u64),
+ #[prost(bool, tag="2")]
+ None(bool),
+ }
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTokenResponse {
#[prost(string, optional, tag="1")]
pub token: ::core::option::Option<::prost::alloc::string::String>,
@@ -1735,6 +1798,11 @@ pub enum CommandName {
GetTabInfo = 189,
GetPaneRunningCommand = 190,
GetPaneCwd = 191,
+ SwitchTabToId = 192,
+ GoToTabWithId = 193,
+ CloseTabWithId = 194,
+ RenameTabWithId = 195,
+ BreakPanesToTabWithId = 196,
}
impl CommandName {
/// String value of the enum field names used in the ProtoBuf definition.
@@ -1914,6 +1982,11 @@ impl CommandName {
CommandName::GetTabInfo => "GetTabInfo",
CommandName::GetPaneRunningCommand => "GetPaneRunningCommand",
CommandName::GetPaneCwd => "GetPaneCwd",
+ CommandName::SwitchTabToId => "SwitchTabToId",
+ CommandName::GoToTabWithId => "GoToTabWithId",
+ CommandName::CloseTabWithId => "CloseTabWithId",
+ CommandName::RenameTabWithId => "RenameTabWithId",
+ CommandName::BreakPanesToTabWithId => "BreakPanesToTabWithId",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
@@ -2090,6 +2163,11 @@ impl CommandName {
"GetTabInfo" => Some(Self::GetTabInfo),
"GetPaneRunningCommand" => Some(Self::GetPaneRunningCommand),
"GetPaneCwd" => Some(Self::GetPaneCwd),
+ "SwitchTabToId" => Some(Self::SwitchTabToId),
+ "GoToTabWithId" => Some(Self::GoToTabWithId),
+ "CloseTabWithId" => Some(Self::CloseTabWithId),
+ "RenameTabWithId" => Some(Self::RenameTabWithId),
+ "BreakPanesToTabWithId" => Some(Self::BreakPanesToTabWithId),
_ => None,
}
}
diff --git a/zellij-utils/assets/prost_ipc/client_server_contract.rs b/zellij-utils/assets/prost_ipc/client_server_contract.rs
index 90754a11..248810ab 100644
--- a/zellij-utils/assets/prost_ipc/client_server_contract.rs
+++ b/zellij-utils/assets/prost_ipc/client_server_contract.rs
@@ -119,7 +119,7 @@ pub struct RgbColor {
#[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, 92, 93, 94, 95, 96, 97, 98, 99, 100")]
+ #[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, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105")]
pub action_type: ::core::option::Option<action::ActionType>,
}
/// Nested message and enum types in `Action`.
@@ -327,6 +327,16 @@ pub mod action {
WriteCharsToPaneId(super::WriteCharsToPaneIdAction),
#[prost(message, tag="100")]
WriteToPaneId(super::WriteToPaneIdAction),
+ #[prost(message, tag="101")]
+ GoToTabById(super::GoToTabByIdAction),
+ #[prost(message, tag="102")]
+ CloseTabById(super::CloseTabByIdAction),
+ #[prost(message, tag="103")]
+ RenameTabById(super::RenameTabByIdAction),
+ #[prost(message, tag="104")]
+ ListTabs(super::ListTabsAction),
+ #[prost(message, tag="105")]
+ CurrentTabInfo(super::CurrentTabInfoAction),
}
}
// Action message definitions (all 92 variants)
@@ -546,6 +556,28 @@ pub struct ListPanesAction {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct ListTabsAction {
+ #[prost(bool, tag="1")]
+ pub show_state: bool,
+ #[prost(bool, tag="2")]
+ pub show_dimensions: bool,
+ #[prost(bool, tag="3")]
+ pub show_panes: bool,
+ #[prost(bool, tag="4")]
+ pub show_layout: bool,
+ #[prost(bool, tag="5")]
+ pub show_all: bool,
+ #[prost(bool, tag="6")]
+ pub output_json: bool,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct CurrentTabInfoAction {
+ #[prost(bool, tag="1")]
+ pub output_json: bool,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TogglePanePinnedAction {
}
#[allow(clippy::derive_partial_eq_without_eq)]
@@ -961,6 +993,26 @@ pub struct RenameTabAction {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct GoToTabByIdAction {
+ #[prost(uint64, tag="1")]
+ pub id: u64,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct CloseTabByIdAction {
+ #[prost(uint64, tag="1")]
+ pub id: u64,
+}
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct RenameTabByIdAction {
+ #[prost(uint64, tag="1")]
+ pub id: u64,
+ #[prost(string, tag="2")]
+ pub name: ::prost::alloc::string::String,
+}
+#[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,
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs
index 376eafa1..6e99766c 100644
--- a/zellij-utils/src/cli.rs
+++ b/zellij-utils/src/cli.rs
@@ -884,6 +884,19 @@ pub enum CliAction {
},
/// Remove a previously set tab name
UndoRenameTab,
+ /// Go to tab with stable ID
+ GoToTabById {
+ id: u64,
+ },
+ /// Close tab with stable ID
+ CloseTabById {
+ id: u64,
+ },
+ /// Rename tab by stable ID
+ RenameTabById {
+ id: u64,
+ name: String,
+ },
/// Create a new tab, optionally with a specified tab layout and name
///
/// Returns: The created tab's ID as a single number on stdout
@@ -1143,6 +1156,42 @@ tail -f /tmp/my-live-logfile | zellij action pipe --name logs --plugin https://e
#[clap(short, long, value_parser)]
json: bool,
},
+ /// List all tabs with their information
+ ///
+ /// Returns: Tab information in table or JSON format
+ ListTabs {
+ /// Include state information (active, fullscreen, sync, floating visibility)
+ #[clap(short, long, value_parser)]
+ state: bool,
+
+ /// Include dimension information (viewport, display area)
+ #[clap(short, long, value_parser)]
+ dimensions: bool,
+
+ /// Include pane counts
+ #[clap(short, long, value_parser)]
+ panes: bool,
+
+ /// Include layout information (swap layout name and dirty state)
+ #[clap(short, long, value_parser)]
+ layout: bool,
+
+ /// Include all available fields
+ #[clap(short, long, value_parser)]
+ all: bool,
+
+ /// Output as JSON
+ #[clap(short, long, value_parser)]
+ json: bool,
+ },
+ /// Get information about the currently active tab
+ ///
+ /// Returns: Tab name and ID by default, or full info in JSON
+ CurrentTabInfo {
+ /// Output as JSON with full TabInfo
+ #[clap(short, long, value_parser)]
+ json: bool,
+ },
TogglePanePinned,
/// Stack pane ids
/// Ids are a space separated list of pane ids.
diff --git a/zellij-utils/src/client_server_contract/common_types.proto b/zellij-utils/src/client_server_contract/common_types.proto
index 2154dde4..512f52bd 100644
--- a/zellij-utils/src/client_server_contract/common_types.proto
+++ b/zellij-utils/src/client_server_contract/common_types.proto
@@ -236,6 +236,11 @@ message Action {
ListPanesAction list_panes = 98;
WriteCharsToPaneIdAction write_chars_to_pane_id = 99;
WriteToPaneIdAction write_to_pane_id = 100;
+ GoToTabByIdAction go_to_tab_by_id = 101;
+ CloseTabByIdAction close_tab_by_id = 102;
+ RenameTabByIdAction rename_tab_by_id = 103;
+ ListTabsAction list_tabs = 104;
+ CurrentTabInfoAction current_tab_info = 105;
}
}
@@ -307,6 +312,17 @@ message ListPanesAction {
bool show_all = 5;
bool output_json = 6;
}
+message ListTabsAction {
+ bool show_state = 1;
+ bool show_dimensions = 2;
+ bool show_panes = 3;
+ bool show_layout = 4;
+ bool show_all = 5;
+ bool output_json = 6;
+}
+message CurrentTabInfoAction {
+ bool output_json = 1;
+}
message TogglePanePinnedAction {}
message TogglePaneInGroupAction {}
message ToggleGroupMarkingAction {}
@@ -558,6 +574,19 @@ message RenameTabAction {
repeated uint32 name = 2;
}
+message GoToTabByIdAction {
+ uint64 id = 1;
+}
+
+message CloseTabByIdAction {
+ uint64 id = 1;
+}
+
+message RenameTabByIdAction {
+ uint64 id = 1;
+ string name = 2;
+}
+
message RenameSessionAction {
string name = 1;
}
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs
index c6e95f9e..4ec7d654 100644
--- a/zellij-utils/src/data.rs
+++ b/zellij-utils/src/data.rs
@@ -2270,6 +2270,7 @@ pub struct PaneListEntry {
}
pub type ListPanesResponse = Vec<PaneListEntry>;
+pub type ListTabsResponse = Vec<TabInfo>;
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct ClientInfo {
@@ -3352,6 +3353,12 @@ pub enum PluginCommand {
// the new tab
BreakPanesToTabWithIndex(Vec<PaneId>, usize, bool), // usize - tab_index, bool -
// should_change_focus_to_new_tab
+ SwitchTabToId(u64), // u64 - tab_id
+ GoToTabWithId(u64), // u64 - tab_id
+ CloseTabWithId(u64), // u64 - tab_id
+ RenameTabWithId(u64, String), // u64 - tab_id, String - new name
+ BreakPanesToTabWithId(Vec<PaneId>, u64, bool), // u64 - tab_id, bool -
+ // should_change_focus_to_target_tab
ReloadPlugin(u32), // u32 - plugin pane id
LoadNewPlugin {
url: String,
@@ -3445,6 +3452,7 @@ pub type NewTabsResponse = Vec<usize>;
pub type FocusOrCreateTabResponse = Option<usize>;
pub type BreakPanesToNewTabResponse = Option<usize>;
pub type BreakPanesToTabWithIndexResponse = Option<usize>;
+pub type BreakPanesToTabWithIdResponse = Option<usize>;
// Response types for plugin API methods that create panes
pub type OpenFileResponse = Option<PaneId>;
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 06bb6801..3b5822a8 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -297,6 +297,10 @@ pub enum ScreenContext {
UndoRenameTab,
MoveTabLeft,
MoveTabRight,
+ GoToTabWithId,
+ CloseTabWithId,
+ RenameTabWithId,
+ BreakPanesToTabWithId,
TerminalResize,
TerminalPixelDimensions,
TerminalBackgroundColor,
@@ -359,6 +363,8 @@ pub enum ScreenContext {
GetTabInfo,
ListClientsMetadata,
ListPanes,
+ ListTabs,
+ GetCurrentTabInfo,
Reconfigure,
RerunCommandPane,
ResizePaneWithId,
diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs
index bf77fe4d..f53a5c69 100644
--- a/zellij-utils/src/input/actions.rs
+++ b/zellij-utils/src/input/actions.rs
@@ -432,6 +432,16 @@ pub enum Action {
tab_index: u32,
name: Vec<u8>,
},
+ GoToTabById {
+ id: u64,
+ },
+ CloseTabById {
+ id: u64,
+ },
+ RenameTabById {
+ id: u64,
+ name: String,
+ },
BreakPane,
BreakPaneRight,
BreakPaneLeft,
@@ -475,6 +485,17 @@ pub enum Action {
show_all: bool,
output_json: bool,
},
+ ListTabs {
+ show_state: bool,
+ show_dimensions: bool,
+ show_panes: bool,
+ show_layout: bool,
+ show_all: bool,
+ output_json: bool,
+ },
+ CurrentTabInfo {
+ output_json: bool,
+ },
TogglePanePinned,
StackPanes {
pane_ids: Vec<PaneId>,
@@ -933,6 +954,9 @@ impl Action {
},
]),
CliAction::UndoRenameTab => Ok(vec![Action::UndoRenameTab]),
+ CliAction::GoToTabById { id } => Ok(vec![Action::GoToTabById { id }]),
+ CliAction::CloseTabById { id } => Ok(vec![Action::CloseTabById { id }]),
+ CliAction::RenameTabById { id, name } => Ok(vec![Action::RenameTabById { id, name }]),
CliAction::NewTab {
name,
layout,
@@ -1331,6 +1355,24 @@ impl Action {
show_all: all,
output_json: json,
}]),
+ CliAction::ListTabs {
+ state,
+ dimensions,
+ panes,
+ layout,
+ all,
+ json,
+ } => Ok(vec![Action::ListTabs {
+ show_state: state,
+ show_dimensions: dimensions,
+ show_panes: panes,
+ show_layout: layout,
+ show_all: all,
+ output_json: json,
+ }]),
+ CliAction::CurrentTabInfo { json } => {
+ Ok(vec![Action::CurrentTabInfo { output_json: json }])
+ },
CliAction::TogglePanePinned => Ok(vec![Action::TogglePanePinned]),
CliAction::StackPanes { pane_ids } => {
let mut malformed_ids = vec![];
diff --git a/zellij-utils/src/ipc/protobuf_conversion.rs b/zellij-utils/src/ipc/protobuf_conversion.rs
index 3c127e78..656be5db 100644
--- a/zellij-utils/src/ipc/protobuf_conversion.rs
+++ b/zellij-utils/src/ipc/protobuf_conversion.rs
@@ -717,32 +717,32 @@ impl From<crate::input::actions::Action>
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, ListPanesAction,
- MouseEventAction, MoveFocusAction, MoveFocusOrTabAction, MovePaneAction,
- MovePaneBackwardsAction, MoveTabAction, NewBlockingPaneAction, NewFloatingPaneAction,
- NewFloatingPluginPaneAction, NewInPlacePaneAction, NewInPlacePluginPaneAction,
- NewPaneAction, NewStackedPaneAction, NewTabAction, NewTiledPaneAction,
- NewTiledPluginPaneAction, NextSwapLayoutAction, NoOpAction, OverrideLayoutAction,
- PageScrollDownAction, PageScrollUpAction, PaneIdWithPlugin, PaneNameInputAction,
- PreviousSwapLayoutAction, QueryTabNamesAction, QuitAction, RenamePluginPaneAction,
- RenameSessionAction, RenameTabAction, RenameTerminalPaneAction, ResizeAction,
- RunAction, SaveSessionAction, ScrollDownAction, ScrollDownAtAction,
- ScrollToBottomAction, ScrollToTopAction, ScrollUpAction, ScrollUpAtAction,
- SearchAction, SearchInputAction, SearchToggleOptionAction, SetPaneBorderlessAction,
- SkipConfirmAction, StackPanesAction, StartOrReloadPluginAction, SwitchFocusAction,
- SwitchModeForAllClientsAction, SwitchSessionAction, SwitchToModeAction,
- TabNameInputAction, ToggleActiveSyncTabAction, ToggleFloatingPanesAction,
- ToggleFocusFullscreenAction, ToggleGroupMarkingAction, ToggleMouseModeAction,
- TogglePaneBorderlessAction, TogglePaneEmbedOrFloatingAction, TogglePaneFramesAction,
- TogglePaneInGroupAction, TogglePanePinnedAction, ToggleTabAction, UndoRenamePaneAction,
- UndoRenameTabAction, WriteAction, WriteCharsAction, WriteCharsToPaneIdAction,
- WriteToPaneIdAction,
+ CloseFocusAction, ClosePluginPaneAction, CloseTabAction, CloseTabByIdAction,
+ CloseTerminalPaneAction, ConfirmAction, CopyAction, CurrentTabInfoAction, DenyAction,
+ DetachAction, DumpLayoutAction, DumpScreenAction, EditFileAction, EditScrollbackAction,
+ FocusNextPaneAction, FocusPluginPaneWithIdAction, FocusPreviousPaneAction,
+ FocusTerminalPaneWithIdAction, GoToNextTabAction, GoToPreviousTabAction, GoToTabAction,
+ GoToTabByIdAction, GoToTabNameAction, HalfPageScrollDownAction, HalfPageScrollUpAction,
+ KeybindPipeAction, LaunchOrFocusPluginAction, LaunchPluginAction, ListClientsAction,
+ ListPanesAction, ListTabsAction, MouseEventAction, MoveFocusAction,
+ MoveFocusOrTabAction, MovePaneAction, MovePaneBackwardsAction, MoveTabAction,
+ NewBlockingPaneAction, NewFloatingPaneAction, NewFloatingPluginPaneAction,
+ NewInPlacePaneAction, NewInPlacePluginPaneAction, NewPaneAction, NewStackedPaneAction,
+ NewTabAction, NewTiledPaneAction, NewTiledPluginPaneAction, NextSwapLayoutAction,
+ NoOpAction, OverrideLayoutAction, PageScrollDownAction, PageScrollUpAction,
+ PaneIdWithPlugin, PaneNameInputAction, PreviousSwapLayoutAction, QueryTabNamesAction,
+ QuitAction, RenamePluginPaneAction, RenameSessionAction, RenameTabAction,
+ RenameTabByIdAction, RenameTerminalPaneAction, ResizeAction, RunAction,
+ SaveSessionAction, ScrollDownAction, ScrollDownAtAction, ScrollToBottomAction,
+ ScrollToTopAction, ScrollUpAction, ScrollUpAtAction, SearchAction, SearchInputAction,
+ SearchToggleOptionAction, SetPaneBorderlessAction, SkipConfirmAction, StackPanesAction,
+ StartOrReloadPluginAction, SwitchFocusAction, SwitchModeForAllClientsAction,
+ SwitchSessionAction, SwitchToModeAction, TabNameInputAction, ToggleActiveSyncTabAction,
+ ToggleFloatingPanesAction, ToggleFocusFullscreenAction, ToggleGroupMarkingAction,
+ ToggleMouseModeAction, TogglePaneBorderlessAction, TogglePaneEmbedOrFloatingAction,
+ TogglePaneFramesAction, TogglePaneInGroupAction, TogglePanePinnedAction,
+ ToggleTabAction, UndoRenamePaneAction, UndoRenameTabAction, WriteAction,
+ WriteCharsAction, WriteCharsToPaneIdAction, WriteToPaneIdAction,
};
use std::collections::HashMap;
@@ -1212,6 +1212,15 @@ impl From<crate::input::actions::Action>
name: name.into_iter().map(|b| b as u32).collect(),
})
},
+ crate::input::actions::Action::GoToTabById { id } => {
+ ActionType::GoToTabById(GoToTabByIdAction { id })
+ },
+ crate::input::actions::Action::CloseTabById { id } => {
+ ActionType::CloseTabById(CloseTabByIdAction { id })
+ },
+ crate::input::actions::Action::RenameTabById { id, name } => {
+ ActionType::RenameTabById(RenameTabByIdAction { id, name })
+ },
crate::input::actions::Action::BreakPane => ActionType::BreakPane(BreakPaneAction {}),
crate::input::actions::Action::BreakPaneRight => {
ActionType::BreakPaneRight(BreakPaneRightAction {})
@@ -1338,6 +1347,24 @@ impl From<crate::input::actions::Action>
crate::input::actions::Action::SaveSession => {
ActionType::SaveSession(SaveSessionAction {})
},
+ crate::input::actions::Action::ListTabs {
+ show_state,
+ show_dimensions,
+ show_panes,
+ show_layout,
+ show_all,
+ output_json,
+ } => ActionType::ListTabs(ListTabsAction {
+ show_state,
+ show_dimensions,
+ show_panes,
+ show_layout,
+ show_all,
+ output_json,
+ }),
+ crate::input::actions::Action::CurrentTabInfo { output_json } => {
+ ActionType::CurrentTabInfo(CurrentTabInfoAction { output_json })
+ },
};
Self {
@@ -1871,6 +1898,22 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.collect(),
})
},
+ ActionType::GoToTabById(go_to_tab_by_id_action) => {
+ Ok(crate::input::actions::Action::GoToTabById {
+ id: go_to_tab_by_id_action.id,
+ })
+ },
+ ActionType::CloseTabById(close_tab_by_id_action) => {
+ Ok(crate::input::actions::Action::CloseTabById {
+ id: close_tab_by_id_action.id,
+ })
+ },
+ ActionType::RenameTabById(rename_tab_by_id_action) => {
+ Ok(crate::input::actions::Action::RenameTabById {
+ id: rename_tab_by_id_action.id,
+ name: rename_tab_by_id_action.name,
+ })
+ },
ActionType::BreakPane(_) => Ok(crate::input::actions::Action::BreakPane),
ActionType::BreakPaneRight(_) => Ok(crate::input::actions::Action::BreakPaneRight),
ActionType::BreakPaneLeft(_) => Ok(crate::input::actions::Action::BreakPaneLeft),
@@ -1936,6 +1979,19 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
output_json: list_panes_action.output_json,
})
},
+ ActionType::ListTabs(list_tabs_action) => Ok(crate::input::actions::Action::ListTabs {
+ show_state: list_tabs_action.show_state,
+ show_dimensions: list_tabs_action.show_dimensions,
+ show_panes: list_tabs_action.show_panes,
+ show_layout: list_tabs_action.show_layout,
+ show_all: list_tabs_action.show_all,
+ output_json: list_tabs_action.output_json,
+ }),
+ ActionType::CurrentTabInfo(current_tab_info_action) => {
+ Ok(crate::input::actions::Action::CurrentTabInfo {
+ output_json: current_tab_info_action.output_json,
+ })
+ },
ActionType::TogglePanePinned(_) => Ok(crate::input::actions::Action::TogglePanePinned),
ActionType::StackPanes(stack_panes_action) => {
Ok(crate::input::actions::Action::StackPanes {
diff --git a/zellij-utils/src/plugin_api/action.proto b/zellij-utils/src/plugin_api/action.proto
index 802d0a0e..83181097 100644
--- a/zellij-utils/src/plugin_api/action.proto
+++ b/zellij-utils/src/plugin_api/action.proto
@@ -232,6 +232,9 @@ message Action {
NewInPlacePanePayload new_in_place_pane_payload = 52;
OverrideLayoutPayload override_layout_payload = 53;
SetPaneBorderlessPayload set_pane_borderless_payload = 54;
+ uint64 go_to_tab_by_id_payload = 55;
+ uint64 close_tab_by_id_payload = 56;
+ TabIdAndName rename_tab_by_id_payload = 57;
}
}
@@ -247,6 +250,11 @@ message IdAndName {
uint32 id = 2;
}
+message TabIdAndName {
+ uint64 tab_id = 1;
+ string name = 2;
+}
+
message PaneIdAndShouldFloat {
uint32 pane_id = 1;
bool should_float = 2;
@@ -451,6 +459,9 @@ enum ActionName {
NewInPlacePane = 92;
OverrideLayout = 93;
SetPaneBorderless = 94;
+ GoToTabById = 95;
+ CloseTabById = 96;
+ RenameTabById = 97;
}
message Position {
diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs
index 92dc618c..047244d7 100644
--- a/zellij-utils/src/plugin_api/action.rs
+++ b/zellij-utils/src/plugin_api/action.rs
@@ -1030,8 +1030,12 @@ impl TryFrom<Action> for ProtobufAction {
chars: chars_to_write,
})),
}),
- Action::WriteToPaneId { .. } | Action::WriteCharsToPaneId { .. } => {
- Err("WriteToPaneId and WriteCharsToPaneId are CLI-only actions, not available in keybindings")
+ Action::WriteToPaneId { .. }
+ | Action::WriteCharsToPaneId { .. }
+ | Action::GoToTabById { .. }
+ | Action::CloseTabById { .. }
+ | Action::RenameTabById { .. } => {
+ Err("WriteToPaneId, WriteCharsToPaneId, GoToTabById, CloseTabById, and RenameTabById are CLI-only actions, not available in keybindings")
},
Action::SwitchToMode { input_mode } => {
let input_mode: ProtobufInputMode = input_mode.try_into()?;
@@ -1782,7 +1786,9 @@ impl TryFrom<Action> for ProtobufAction {
| Action::SetPaneBorderless { .. }
| Action::SkipConfirm { action: _ }
| Action::SwitchSession { .. }
- | Action::SaveSession => Err("Unsupported action"),
+ | Action::SaveSession
+ | Action::ListTabs { .. }
+ | Action::CurrentTabInfo { .. } => Err("Unsupported action"),
}
}
}
diff --git a/zellij-utils/src/plugin_api/plugin_command.proto b/zellij-utils/src/plugin_api/plugin_command.proto
index b450c13f..a2a25f99 100644
--- a/zellij-utils/src/plugin_api/plugin_command.proto
+++ b/zellij-utils/src/plugin_api/plugin_command.proto
@@ -184,6 +184,11 @@ enum CommandName {
GetTabInfo = 189;
GetPaneRunningCommand = 190;
GetPaneCwd = 191;
+ SwitchTabToId = 192;
+ GoToTabWithId = 193;
+ CloseTabWithId = 194;
+ RenameTabWithId = 195;
+ BreakPanesToTabWithId = 196;
}
message PluginCommand {
@@ -317,6 +322,11 @@ message PluginCommand {
GetTabInfoPayload get_tab_info_payload = 140;
GetPaneRunningCommandPayload get_pane_running_command_payload = 141;
GetPaneCwdPayload get_pane_cwd_payload = 142;
+ SwitchTabToIdPayload switch_tab_to_id_payload = 143;
+ GoToTabWithIdPayload go_to_tab_with_id_payload = 144;
+ CloseTabWithIdPayload close_tab_with_id_payload = 145;
+ RenameTabWithIdPayload rename_tab_with_id_payload = 146;
+ BreakPanesToTabWithIdPayload break_panes_to_tab_with_id_payload = 147;
}
}
@@ -749,6 +759,36 @@ enum FixedOrPercent {
Percent = 1;
}
+message SwitchTabToIdPayload {
+ uint64 tab_id = 1;
+}
+
+message GoToTabWithIdPayload {
+ uint64 tab_id = 1;
+}
+
+message CloseTabWithIdPayload {
+ uint64 tab_id = 1;
+}
+
+message RenameTabWithIdPayload {
+ uint64 tab_id = 1;
+ string new_name = 2;
+}
+
+message BreakPanesToTabWithIdPayload {
+ repeated PaneId pane_ids = 1;
+ uint64 tab_id = 2;
+ bool should_change_focus_to_target_tab = 3;
+}
+
+message BreakPanesToTabWithIdResponse {
+ oneof result {
+ uint64 tab_id = 1;
+ bool none = 2;
+ }
+}
+
message CreateTokenResponse {
optional string token = 1;
optional string token_label = 2;
diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs
index 7871d15f..6ade3376 100644
--- a/zellij-utils/src/plugin_api/plugin_command.rs
+++ b/zellij-utils/src/plugin_api/plugin_command.rs
@@ -3,20 +3,23 @@ pub use super::generated_api::api::{
event::{EventNameList as ProtobufEventNameList, Header},
input_mode::InputMode as ProtobufInputMode,
plugin_command::{
- break_panes_to_new_tab_response, break_panes_to_tab_with_index_response,
- delete_layout_response, dump_layout_response, dump_session_layout_response,
- edit_layout_response, focus_or_create_tab_response, get_focused_pane_info_response,
- get_pane_cwd_response, get_pane_pid_response, get_pane_running_command_response,
- new_tab_response, parse_layout_response, plugin_command::Payload, rename_layout_response,
- save_layout_response, save_session_response, BreakPanesToNewTabPayload,
+ break_panes_to_new_tab_response, break_panes_to_tab_with_id_response,
+ break_panes_to_tab_with_index_response, delete_layout_response, dump_layout_response,
+ dump_session_layout_response, edit_layout_response, focus_or_create_tab_response,
+ get_focused_pane_info_response, get_pane_cwd_response, get_pane_pid_response,
+ get_pane_running_command_response, new_tab_response, parse_layout_response,
+ plugin_command::Payload, rename_layout_response, save_layout_response,
+ save_session_response, BreakPanesToNewTabPayload,
BreakPanesToNewTabResponse as ProtobufBreakPanesToNewTabResponse,
+ BreakPanesToTabWithIdPayload,
+ BreakPanesToTabWithIdResponse as ProtobufBreakPanesToTabWithIdResponse,
BreakPanesToTabWithIndexPayload,
BreakPanesToTabWithIndexResponse as ProtobufBreakPanesToTabWithIndexResponse,
ChangeFloatingPanesCoordinatesPayload, ChangeHostFolderPayload,
ClearScreenForPaneIdPayload, CliPipeOutputPayload, CloseMultiplePanesPayload,
- CloseTabWithIndexPayload, CommandName, ContextItem, CopyToClipboardPayload,
- CreateTokenResponse as ProtobufCreateTokenResponse, CreateTokenResponse,
- CurrentSessionLastSavedTimePayload,
+ CloseTabWithIdPayload, CloseTabWithIndexPayload, CommandName, ContextItem,
+ CopyToClipboardPayload, CreateTokenResponse as ProtobufCreateTokenResponse,
+ CreateTokenResponse, CurrentSessionLastSavedTimePayload,
CurrentSessionLastSavedTimeResponse as ProtobufCurrentSessionLastSavedTimeResponse,
CursorPosition, DeleteLayoutPayload, DeleteLayoutResponse as ProtobufDeleteLayoutResponse,
DumpLayoutPayload, DumpLayoutResponse as ProtobufDumpLayoutResponse,
@@ -39,13 +42,14 @@ pub use super::generated_api::api::{
GetPaneRunningCommandPayload as ProtobufGetPaneRunningCommandPayload,
GetPaneRunningCommandResponse as ProtobufGetPaneRunningCommandResponse,
GetPaneScrollbackPayload, GetTabInfoPayload,
- GetTabInfoResponse as ProtobufGetTabInfoResponse, GroupAndUngroupPanesPayload,
- HidePaneWithIdPayload, HighlightAndUnhighlightPanesPayload, HttpVerb as ProtobufHttpVerb,
- IdAndNewName, KeyToRebind, KeyToUnbind, KillSessionsPayload, ListTokensResponse,
- LoadNewPluginPayload, MessageToPluginPayload, MovePaneWithPaneIdInDirectionPayload,
- MovePaneWithPaneIdPayload, MovePayload, NewPluginArgs as ProtobufNewPluginArgs,
- NewTabPayload, NewTabResponse as ProtobufNewTabResponse,
- NewTabsResponse as ProtobufNewTabsResponse, NewTabsWithLayoutInfoPayload,
+ GetTabInfoResponse as ProtobufGetTabInfoResponse, GoToTabWithIdPayload,
+ GroupAndUngroupPanesPayload, HidePaneWithIdPayload, HighlightAndUnhighlightPanesPayload,
+ HttpVerb as ProtobufHttpVerb, IdAndNewName, KeyToRebind, KeyToUnbind, KillSessionsPayload,
+ ListTokensResponse, LoadNewPluginPayload, MessageToPluginPayload,
+ MovePaneWithPaneIdInDirectionPayload, MovePaneWithPaneIdPayload, MovePayload,
+ NewPluginArgs as ProtobufNewPluginArgs, NewTabPayload,
+ NewTabResponse as ProtobufNewTabResponse, NewTabsResponse as ProtobufNewTabsResponse,
+ NewTabsWithLayoutInfoPayload,
OpenCommandPaneBackgroundResponse as ProtobufOpenCommandPaneBackgroundResponse,
OpenCommandPaneFloatingNearPluginPayload,
OpenCommandPaneFloatingNearPluginResponse as ProtobufOpenCommandPaneFloatingNearPluginResponse,
@@ -77,9 +81,10 @@ pub use super::generated_api::api::{
ParseLayoutResponse as ProtobufParseLayoutResponse, PluginCommand as ProtobufPluginCommand,
PluginMessagePayload, RebindKeysPayload, ReconfigurePayload, ReloadPluginPayload,
RenameLayoutPayload, RenameLayoutResponse as ProtobufRenameLayoutResponse,
- RenameWebLoginTokenPayload, RenameWebTokenResponse, ReplacePaneWithExistingPanePayload,
- RequestPluginPermissionPayload, RerunCommandPanePayload, ResizePaneIdWithDirectionPayload,
- ResizePayload, RevokeAllWebTokensResponse, RevokeTokenResponse, RevokeWebLoginTokenPayload,
+ RenameTabWithIdPayload, RenameWebLoginTokenPayload, RenameWebTokenResponse,
+ ReplacePaneWithExistingPanePayload, RequestPluginPermissionPayload,
+ RerunCommandPanePayload, ResizePaneIdWithDirectionPayload, ResizePayload,
+ RevokeAllWebTokensResponse, RevokeTokenResponse, RevokeWebLoginTokenPayload,
RunActionPayload, RunCommandPayload, RunningCommand as ProtobufRunningCommand,
SaveLayoutPayload, SaveLayoutResponse as ProtobufSaveLayoutResponse, SaveSessionPayload,
SaveSessionResponse as ProtobufSaveSessionResponse, ScrollDownInPaneIdPayload,
@@ -87,9 +92,9 @@ pub use super::generated_api::api::{
SetFloatingPanePinnedPayload, SetPaneBorderlessPayload,
SetSelfMouseSelectionSupportPayload, SetTimeoutPayload, ShowCursorPayload,
ShowPaneWithIdPayload, StackPanesPayload, SubscribePayload, SwitchSessionPayload,
- SwitchTabToPayload, TogglePaneBorderlessPayload, TogglePaneEmbedOrEjectForPaneIdPayload,
- TogglePaneIdFullscreenPayload, UnsubscribePayload, WebRequestPayload,
- WriteCharsToPaneIdPayload, WriteToPaneIdPayload,
+ SwitchTabToIdPayload, SwitchTabToPayload, TogglePaneBorderlessPayload,
+ TogglePaneEmbedOrEjectForPaneIdPayload, TogglePaneIdFullscreenPayload, UnsubscribePayload,
+ WebRequestPayload, WriteCharsToPaneIdPayload, WriteToPaneIdPayload,
},
plugin_permission::PermissionType as ProtobufPermissionType,
resize::ResizeAction as ProtobufResizeAction,
@@ -1679,6 +1684,44 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand {
)),
_ => Err("Mismatched payload for BreakPanesToTabWithIndex"),
},
+ Some(CommandName::SwitchTabToId) => match protobuf_plugin_command.payload {
+ Some(Payload::SwitchTabToIdPayload(payload)) => {
+ Ok(PluginCommand::SwitchTabToId(payload.tab_id))
+ },
+ _ => Err("Mismatched payload for SwitchTabToId"),
+ },
+ Some(CommandName::GoToTabWithId) => match protobuf_plugin_command.payload {
+ Some(Payload::GoToTabWithIdPayload(payload)) => {
+ Ok(PluginCommand::GoToTabWithId(payload.tab_id))
+ },
+ _ => Err("Mismatched payload for GoToTabWithId"),
+ },
+ Some(CommandName::CloseTabWithId) => match protobuf_plugin_command.payload {
+ Some(Payload::CloseTabWithIdPayload(payload)) => {
+ Ok(PluginCommand::CloseTabWithId(payload.tab_id))
+ },
+ _ => Err("Mismatched payload for CloseTabWithId"),
+ },
+ Some(CommandName::RenameTabWithId) => match protobuf_plugin_command.payload {
+ Some(Payload::RenameTabWithIdPayload(payload)) => Ok(
+ PluginCommand::RenameTabWithId(payload.tab_id, payload.new_name),
+ ),
+ _ => Err("Mismatched payload for RenameTabWithId"),
+ },
+ Some(CommandName::BreakPanesToTabWithId) => match protobuf_plugin_command.payload {
+ Some(Payload::BreakPanesToTabWithIdPayload(payload)) => {
+ Ok(PluginCommand::BreakPanesToTabWithId(
+ payload
+ .pane_ids
+ .into_iter()
+ .filter_map(|p_id| p_id.try_into().ok())
+ .collect(),
+ payload.tab_id,
+ payload.should_change_focus_to_target_tab,
+ ))
+ },
+ _ => Err("Mismatched payload for BreakPanesToTabWithId"),
+ },
Some(CommandName::ReloadPlugin) => match protobuf_plugin_command.payload {
Some(Payload::ReloadPluginPayload(reload_plugin_payload)) => {
Ok(PluginCommand::ReloadPlugin(reload_plugin_payload.plugin_id))
@@ -3128,6 +3171,48 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand {
},
)),
}),
+ PluginCommand::SwitchTabToId(tab_id) => Ok(ProtobufPluginCommand {
+ name: CommandName::SwitchTabToId as i32,
+ payload: Some(Payload::SwitchTabToIdPayload(SwitchTabToIdPayload {
+ tab_id,
+ })),
+ }),
+ PluginCommand::GoToTabWithId(tab_id) => Ok(ProtobufPluginCommand {
+ name: CommandName::GoToTabWithId as i32,
+ payload: Some(Payload::GoToTabWithIdPayload(GoToTabWithIdPayload {
+ tab_id,
+ })),
+ }),
+ PluginCommand::CloseTabWithId(tab_id) => Ok(ProtobufPluginCommand {
+ name: CommandName::CloseTabWithId as i32,
+ payload: Some(Payload::CloseTabWithIdPayload(CloseTabWithIdPayload {
+ tab_id,
+ })),
+ }),
+ PluginCommand::RenameTabWithId(tab_id, new_name) => Ok(ProtobufPluginCommand {
+ name: CommandName::RenameTabWithId as i32,
+ payload: Some(Payload::RenameTabWithIdPayload(RenameTabWithIdPayload {
+ tab_id,
+ new_name,
+ })),
+ }),
+ PluginCommand::BreakPanesToTabWithId(
+ pane_ids,
+ tab_id,
+ should_change_focus_to_target_tab,
+ ) => Ok(ProtobufPluginCommand {
+ name: CommandName::BreakPanesToTabWithId as i32,
+ payload: Some(Payload::BreakPanesToTabWithIdPayload(
+ BreakPanesToTabWithIdPayload {
+ pane_ids: pane_ids
+ .into_iter()
+ .filter_map(|p_id| p_id.try_into().ok())
+ .collect(),
+ tab_id,
+ should_change_focus_to_target_tab,
+ },
+ )),
+ }),
PluginCommand::ReloadPlugin(plugin_id) => Ok(ProtobufPluginCommand {
name: CommandName::ReloadPlugin as i32,
payload: Some(Payload::ReloadPluginPayload(ReloadPluginPayload {
@@ -3601,8 +3686,8 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand {
// Conversion implementations for tab creation response types
use crate::data::{
- BreakPanesToNewTabResponse, BreakPanesToTabWithIndexResponse, FocusOrCreateTabResponse,
- NewTabResponse, NewTabsResponse, OpenCommandPaneBackgroundResponse,
+ BreakPanesToNewTabResponse, BreakPanesToTabWithIdResponse, BreakPanesToTabWithIndexResponse,
+ FocusOrCreateTabResponse, NewTabResponse, NewTabsResponse, OpenCommandPaneBackgroundResponse,
OpenCommandPaneFloatingNearPluginResponse, OpenCommandPaneFloatingResponse,
OpenCommandPaneInPlaceOfPluginResponse, OpenCommandPaneInPlaceResponse,
OpenCommandPaneNearPluginResponse, OpenCommandPaneResponse, OpenFileFloatingNearPluginResponse,
@@ -3725,6 +3810,21 @@ impl From<BreakPanesToTabWithIndexResponse> for ProtobufBreakPanesToTabWithIndex
}
}
+impl From<BreakPanesToTabWithIdResponse> for ProtobufBreakPanesToTabWithIdResponse {
+ fn from(response: BreakPanesToTabWithIdResponse) -> Self {
+ match response {
+ Some(tab_id) => ProtobufBreakPanesToTabWithIdResponse {
+ result: Some(break_panes_to_tab_with_id_response::Result::TabId(
+ tab_id as u64,
+ )),
+ },
+ None => ProtobufBreakPanesToTabWithIdResponse {
+ result: Some(break_panes_to_tab_with_id_response::Result::None(true)),
+ },
+ }
+ }
+}
+
// Pane-creating command response conversions
impl TryFrom<ProtobufOpenFileResponse> for OpenFileResponse {