diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-05-12 12:20:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-12 12:20:23 +0200 |
| commit | fc6c5942a12d7314f606be390de9d05497f20bd3 (patch) | |
| tree | 5b1136794d1fe3177a5a8d99460d26a87ae76696 /zellij-utils/src/plugin_api/plugin_command.rs | |
| parent | docs(changelog): update permissions pr (diff) | |
| download | sl0ppij-fc6c5942a12d7314f606be390de9d05497f20bd3.tar.gz sl0ppij-fc6c5942a12d7314f606be390de9d05497f20bd3.tar.xz sl0ppij-fc6c5942a12d7314f606be390de9d05497f20bd3.zip | |
Welcome screen del fix (#5160)
* fix: session-manager delete
* rustfmt
* add pr
Diffstat (limited to 'zellij-utils/src/plugin_api/plugin_command.rs')
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.rs | 118 |
1 files changed, 106 insertions, 12 deletions
diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs index 5bfb2b42..fa77739a 100644 --- a/zellij-utils/src/plugin_api/plugin_command.rs +++ b/zellij-utils/src/plugin_api/plugin_command.rs @@ -28,7 +28,9 @@ pub use super::generated_api::api::{ CreateTokenResponse, CurrentSessionLastSavedTimePayload, CurrentSessionLastSavedTimeResponse as ProtobufCurrentSessionLastSavedTimeResponse, CursorPosition, CustomIndexHighlight as ProtobufCustomIndexHighlight, - CustomRgbHighlight as ProtobufCustomRgbHighlight, DeleteLayoutPayload, + CustomRgbHighlight as ProtobufCustomRgbHighlight, + DeleteAllDeadSessionsResponse as ProtobufDeleteAllDeadSessionsResponse, + DeleteDeadSessionResponse as ProtobufDeleteDeadSessionResponse, DeleteLayoutPayload, DeleteLayoutResponse as ProtobufDeleteLayoutResponse, DumpLayoutPayload, DumpLayoutResponse as ProtobufDumpLayoutResponse, DumpSessionLayoutPayload, DumpSessionLayoutResponse as ProtobufDumpSessionLayoutResponse, EditLayoutPayload, @@ -59,11 +61,12 @@ pub use super::generated_api::api::{ HideFloatingPanesResponse as ProtobufHideFloatingPanesResponse, HidePaneWithIdPayload, HighlightAndUnhighlightPanesPayload, HighlightLayer as ProtobufHighlightLayer, HighlightStyle as ProtobufHighlightStyle, HttpVerb as ProtobufHttpVerb, IdAndNewName, - KeyToRebind, KeyToUnbind, KillSessionsPayload, ListTokensResponse, LoadNewPluginPayload, - MessageToPluginPayload, MovePaneWithPaneIdInDirectionPayload, MovePaneWithPaneIdPayload, - MovePayload, NewPluginArgs as ProtobufNewPluginArgs, NewTabPayload, - NewTabResponse as ProtobufNewTabResponse, NewTabsResponse as ProtobufNewTabsResponse, - NewTabsWithLayoutInfoPayload, + KeyToRebind, KeyToUnbind, KillSessionsPayload, + KillSessionsResponse as ProtobufKillSessionsResponse, ListTokensResponse, + LoadNewPluginPayload, MessageToPluginPayload, MovePaneWithPaneIdInDirectionPayload, + MovePaneWithPaneIdPayload, MovePayload, NewPluginArgs as ProtobufNewPluginArgs, + NewTabPayload, NewTabResponse as ProtobufNewTabResponse, + NewTabsResponse as ProtobufNewTabsResponse, NewTabsWithLayoutInfoPayload, OpenCommandPaneBackgroundResponse as ProtobufOpenCommandPaneBackgroundResponse, OpenCommandPaneFloatingNearPluginPayload, OpenCommandPaneFloatingNearPluginResponse as ProtobufOpenCommandPaneFloatingNearPluginResponse, @@ -129,12 +132,12 @@ pub use super::generated_api::api::{ }; use crate::data::{ - ConnectToSession, DeleteLayoutResponse, EditLayoutResponse, FloatingPaneCoordinates, - GetFocusedPaneInfoResponse, GetPaneCwdResponse, GetPanePidResponse, - GetPaneRunningCommandResponse, GetSessionListResponse, HighlightLayer, HighlightStyle, - HttpVerb, InputMode, KeyWithModifier, MessageToPlugin, NewPluginArgs, PaneId, PermissionType, - PluginCommand, RegexHighlight, RenameLayoutResponse, SaveLayoutResponse, SessionInfo, - SessionListSnapshot, + ConnectToSession, DeleteAllDeadSessionsResponse, DeleteDeadSessionResponse, + DeleteLayoutResponse, EditLayoutResponse, FloatingPaneCoordinates, GetFocusedPaneInfoResponse, + GetPaneCwdResponse, GetPanePidResponse, GetPaneRunningCommandResponse, GetSessionListResponse, + HighlightLayer, HighlightStyle, HttpVerb, InputMode, KeyWithModifier, KillSessionsResponse, + MessageToPlugin, NewPluginArgs, PaneId, PermissionType, PluginCommand, RegexHighlight, + RenameLayoutResponse, SaveLayoutResponse, SessionInfo, SessionListSnapshot, }; use crate::input::actions::Action; use crate::input::layout::PercentOrFixed; @@ -394,6 +397,66 @@ impl TryFrom<ProtobufGetSessionListResponse> for GetSessionListResponse { } } +impl From<KillSessionsResponse> for ProtobufKillSessionsResponse { + fn from(response: KillSessionsResponse) -> Self { + match response { + KillSessionsResponse::Ok => ProtobufKillSessionsResponse { error: None }, + KillSessionsResponse::Err(err) => ProtobufKillSessionsResponse { error: Some(err) }, + } + } +} + +impl From<ProtobufKillSessionsResponse> for KillSessionsResponse { + fn from(protobuf_response: ProtobufKillSessionsResponse) -> Self { + match protobuf_response.error { + Some(err) => KillSessionsResponse::Err(err), + None => KillSessionsResponse::Ok, + } + } +} + +impl From<DeleteDeadSessionResponse> for ProtobufDeleteDeadSessionResponse { + fn from(response: DeleteDeadSessionResponse) -> Self { + match response { + DeleteDeadSessionResponse::Ok => ProtobufDeleteDeadSessionResponse { error: None }, + DeleteDeadSessionResponse::Err(err) => { + ProtobufDeleteDeadSessionResponse { error: Some(err) } + }, + } + } +} + +impl From<ProtobufDeleteDeadSessionResponse> for DeleteDeadSessionResponse { + fn from(protobuf_response: ProtobufDeleteDeadSessionResponse) -> Self { + match protobuf_response.error { + Some(err) => DeleteDeadSessionResponse::Err(err), + None => DeleteDeadSessionResponse::Ok, + } + } +} + +impl From<DeleteAllDeadSessionsResponse> for ProtobufDeleteAllDeadSessionsResponse { + fn from(response: DeleteAllDeadSessionsResponse) -> Self { + match response { + DeleteAllDeadSessionsResponse::Ok => { + ProtobufDeleteAllDeadSessionsResponse { error: None } + }, + DeleteAllDeadSessionsResponse::Err(err) => { + ProtobufDeleteAllDeadSessionsResponse { error: Some(err) } + }, + } + } +} + +impl From<ProtobufDeleteAllDeadSessionsResponse> for DeleteAllDeadSessionsResponse { + fn from(protobuf_response: ProtobufDeleteAllDeadSessionsResponse) -> Self { + match protobuf_response.error { + Some(err) => DeleteAllDeadSessionsResponse::Err(err), + None => DeleteAllDeadSessionsResponse::Ok, + } + } +} + impl From<GetPaneCwdResponse> for ProtobufGetPaneCwdResponse { fn from(response: GetPaneCwdResponse) -> Self { match response { @@ -1370,6 +1433,21 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand { None => Ok(PluginCommand::GetSessionList), _ => Err("Mismatched payload for GetSessionList"), }, + Some(CommandName::KillSessionsAndReply) => match protobuf_plugin_command.payload { + Some(Payload::KillSessionsAndReplyPayload(KillSessionsPayload { + session_names, + })) => Ok(PluginCommand::KillSessionsAndReply(session_names)), + _ => Err("Mismatched payload for KillSessionsAndReply"), + }, + Some(CommandName::DeleteDeadSessionAndReply) => match protobuf_plugin_command.payload { + Some(Payload::DeleteDeadSessionAndReplyPayload(dead_session_name)) => { + Ok(PluginCommand::DeleteDeadSessionAndReply(dead_session_name)) + }, + _ => Err("Mismatched payload for DeleteDeadSessionAndReply"), + }, + Some(CommandName::DeleteAllDeadSessionsAndReply) => { + Ok(PluginCommand::DeleteAllDeadSessionsAndReply) + }, Some(CommandName::DumpSessionLayout) => match protobuf_plugin_command.payload { Some(Payload::DumpSessionLayoutPayload(payload)) => { Ok(PluginCommand::DumpSessionLayout { @@ -3221,6 +3299,22 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand { ProtobufGetSessionListPayload {}, )), }), + PluginCommand::KillSessionsAndReply(session_names) => Ok(ProtobufPluginCommand { + name: CommandName::KillSessionsAndReply as i32, + payload: Some(Payload::KillSessionsAndReplyPayload(KillSessionsPayload { + session_names, + })), + }), + PluginCommand::DeleteDeadSessionAndReply(dead_session_name) => { + Ok(ProtobufPluginCommand { + name: CommandName::DeleteDeadSessionAndReply as i32, + payload: Some(Payload::DeleteDeadSessionAndReplyPayload(dead_session_name)), + }) + }, + PluginCommand::DeleteAllDeadSessionsAndReply => Ok(ProtobufPluginCommand { + name: CommandName::DeleteAllDeadSessionsAndReply as i32, + payload: None, + }), PluginCommand::DumpSessionLayout { tab_index } => Ok(ProtobufPluginCommand { name: CommandName::DumpSessionLayout as i32, payload: tab_index.map(|idx| { |
