aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-03-26 18:44:56 +0100
committerGitHub <noreply@github.com>2024-03-26 18:44:56 +0100
commit2eaa50cc44284bdfd47a98770625f380c15fd51d (patch)
treee86909cdfce996d08442c5152fa4bacdbf203745 /zellij-utils/src
parentdocs(changelog): ui fixes (diff)
downloadsl0ppij-2eaa50cc44284bdfd47a98770625f380c15fd51d.tar.gz
sl0ppij-2eaa50cc44284bdfd47a98770625f380c15fd51d.tar.xz
sl0ppij-2eaa50cc44284bdfd47a98770625f380c15fd51d.zip
feat(plugins): add api to dump the current session layout to a plugin (#3227)
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/data.rs1
-rw-r--r--zellij-utils/src/errors.rs3
-rw-r--r--zellij-utils/src/plugin_api/plugin_command.proto1
-rw-r--r--zellij-utils/src/plugin_api/plugin_command.rs8
4 files changed, 13 insertions, 0 deletions
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs
index 379fb126..78fbbd77 100644
--- a/zellij-utils/src/data.rs
+++ b/zellij-utils/src/data.rs
@@ -1378,4 +1378,5 @@ pub enum PluginCommand {
KillSessions(Vec<String>), // one or more session names
ScanHostFolder(PathBuf), // TODO: rename to ScanHostFolder
WatchFilesystem,
+ DumpSessionLayout,
}
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index d05df3a2..51174b75 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -351,6 +351,7 @@ pub enum ScreenContext {
NewInPlacePluginPane,
DumpLayoutToHd,
RenameSession,
+ DumpLayoutToPlugin,
}
/// Stack call representations corresponding to the different types of [`PtyInstruction`]s.
@@ -371,6 +372,7 @@ pub enum PtyContext {
DumpLayout,
LogLayoutToHd,
FillPluginCwd,
+ DumpLayoutToPlugin,
Exit,
}
@@ -402,6 +404,7 @@ pub enum PluginContext {
UnblockCliPipes,
WatchFilesystem,
KeybindPipe,
+ DumpLayoutToPlugin,
}
/// Stack call representations corresponding to the different types of [`ClientInstruction`]s.
diff --git a/zellij-utils/src/plugin_api/plugin_command.proto b/zellij-utils/src/plugin_api/plugin_command.proto
index c95111e5..b05c8ac8 100644
--- a/zellij-utils/src/plugin_api/plugin_command.proto
+++ b/zellij-utils/src/plugin_api/plugin_command.proto
@@ -95,6 +95,7 @@ enum CommandName {
KillSessions = 81;
ScanHostFolder = 82;
WatchFilesystem = 83;
+ DumpSessionLayout = 84;
}
message PluginCommand {
diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs
index e452e53c..232a9f2d 100644
--- a/zellij-utils/src/plugin_api/plugin_command.rs
+++ b/zellij-utils/src/plugin_api/plugin_command.rs
@@ -867,6 +867,10 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand {
Some(_) => Err("WatchFilesystem should have no payload, found a payload"),
None => Ok(PluginCommand::WatchFilesystem),
},
+ Some(CommandName::DumpSessionLayout) => match protobuf_plugin_command.payload {
+ Some(_) => Err("DumpSessionLayout should have no payload, found a payload"),
+ None => Ok(PluginCommand::DumpSessionLayout),
+ },
None => Err("Unrecognized plugin command"),
}
}
@@ -1381,6 +1385,10 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand {
name: CommandName::WatchFilesystem as i32,
payload: None,
}),
+ PluginCommand::DumpSessionLayout => Ok(ProtobufPluginCommand {
+ name: CommandName::DumpSessionLayout as i32,
+ payload: None,
+ }),
}
}
}