aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/plugin_api/plugin_command.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-01-29 11:53:56 +0100
committerGitHub <noreply@github.com>2026-01-29 11:53:56 +0100
commitcdbdf2b6679c580d4b0c8332694cd8ee9117d49f (patch)
treef262277077de2891c3952663f69f6906356c4e04 /zellij-utils/src/plugin_api/plugin_command.rs
parentfix: session creation time on musl (for "zellij ls") (#4645) (diff)
downloadsl0ppij-cdbdf2b6679c580d4b0c8332694cd8ee9117d49f.tar.gz
sl0ppij-cdbdf2b6679c580d4b0c8332694cd8ee9117d49f.tar.xz
sl0ppij-cdbdf2b6679c580d4b0c8332694cd8ee9117d49f.zip
Allow saving current session for resurrection on demand (#4654)
* initial implementation * session manager ui and plugin api * remove event * cleanups and formatting * add pr
Diffstat (limited to 'zellij-utils/src/plugin_api/plugin_command.rs')
-rw-r--r--zellij-utils/src/plugin_api/plugin_command.rs31
1 files changed, 24 insertions, 7 deletions
diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs
index da0f4599..691a6c45 100644
--- a/zellij-utils/src/plugin_api/plugin_command.rs
+++ b/zellij-utils/src/plugin_api/plugin_command.rs
@@ -6,12 +6,14 @@ pub use super::generated_api::api::{
delete_layout_response, dump_layout_response, dump_session_layout_response,
edit_layout_response, get_focused_pane_info_response, get_pane_pid_response,
parse_layout_response, plugin_command::Payload, rename_layout_response,
- save_layout_response, BreakPanesToNewTabPayload, BreakPanesToTabWithIndexPayload,
- ChangeFloatingPanesCoordinatesPayload, ChangeHostFolderPayload,
- ClearScreenForPaneIdPayload, CliPipeOutputPayload, CloseMultiplePanesPayload,
- CloseTabWithIndexPayload, CommandName, ContextItem, CopyToClipboardPayload,
- CreateTokenResponse as ProtobufCreateTokenResponse, CreateTokenResponse, CursorPosition,
- DeleteLayoutPayload, DeleteLayoutResponse as ProtobufDeleteLayoutResponse,
+ save_layout_response, save_session_response, BreakPanesToNewTabPayload,
+ BreakPanesToTabWithIndexPayload, ChangeFloatingPanesCoordinatesPayload,
+ ChangeHostFolderPayload, ClearScreenForPaneIdPayload, CliPipeOutputPayload,
+ CloseMultiplePanesPayload, CloseTabWithIndexPayload, CommandName, ContextItem,
+ CopyToClipboardPayload, CreateTokenResponse as ProtobufCreateTokenResponse,
+ CreateTokenResponse, CurrentSessionLastSavedTimePayload,
+ CurrentSessionLastSavedTimeResponse as ProtobufCurrentSessionLastSavedTimeResponse,
+ CursorPosition, DeleteLayoutPayload, DeleteLayoutResponse as ProtobufDeleteLayoutResponse,
DumpLayoutPayload, DumpLayoutResponse as ProtobufDumpLayoutResponse,
DumpSessionLayoutPayload, DumpSessionLayoutResponse as ProtobufDumpSessionLayoutResponse,
EditLayoutPayload, EditLayoutResponse as ProtobufEditLayoutResponse,
@@ -44,7 +46,8 @@ pub use super::generated_api::api::{
RequestPluginPermissionPayload, RerunCommandPanePayload, ResizePaneIdWithDirectionPayload,
ResizePayload, RevokeAllWebTokensResponse, RevokeTokenResponse, RevokeWebLoginTokenPayload,
RunActionPayload, RunCommandPayload, SaveLayoutPayload,
- SaveLayoutResponse as ProtobufSaveLayoutResponse, ScrollDownInPaneIdPayload,
+ SaveLayoutResponse as ProtobufSaveLayoutResponse, SaveSessionPayload,
+ SaveSessionResponse as ProtobufSaveSessionResponse, ScrollDownInPaneIdPayload,
ScrollToBottomInPaneIdPayload, ScrollToTopInPaneIdPayload, ScrollUpInPaneIdPayload,
SetFloatingPanePinnedPayload, SetPaneBorderlessPayload,
SetSelfMouseSelectionSupportPayload, SetTimeoutPayload, ShowCursorPayload,
@@ -2103,6 +2106,10 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand {
},
Some(CommandName::GetLayoutDir) => Ok(PluginCommand::GetLayoutDir),
Some(CommandName::GetFocusedPaneInfo) => Ok(PluginCommand::GetFocusedPaneInfo),
+ Some(CommandName::SaveSession) => Ok(PluginCommand::SaveSession),
+ Some(CommandName::CurrentSessionLastSavedTime) => {
+ Ok(PluginCommand::CurrentSessionLastSavedTime)
+ },
None => Err("Unrecognized plugin command"),
}
}
@@ -3443,6 +3450,16 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand {
GetFocusedPaneInfoPayload {},
)),
}),
+ PluginCommand::SaveSession => Ok(ProtobufPluginCommand {
+ name: CommandName::SaveSession as i32,
+ payload: Some(Payload::SaveSessionPayload(SaveSessionPayload {})),
+ }),
+ PluginCommand::CurrentSessionLastSavedTime => Ok(ProtobufPluginCommand {
+ name: CommandName::CurrentSessionLastSavedTime as i32,
+ payload: Some(Payload::CurrentSessionLastSavedTimePayload(
+ CurrentSessionLastSavedTimePayload {},
+ )),
+ }),
}
}
}