diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-07-22 18:30:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-22 18:30:18 +0200 |
| commit | ffbdb095ec5402455ac7f1cc8ef2f1bb8ebc8df2 (patch) | |
| tree | 99467c7156aa1b9c2fa6d0b65464e1b0c948c913 /zellij-utils/src/data.rs | |
| parent | docs(changelog): current process refresh fix (diff) | |
| download | sl0ppij-ffbdb095ec5402455ac7f1cc8ef2f1bb8ebc8df2.tar.gz sl0ppij-ffbdb095ec5402455ac7f1cc8ef2f1bb8ebc8df2.tar.xz sl0ppij-ffbdb095ec5402455ac7f1cc8ef2f1bb8ebc8df2.zip | |
feat(plugins): some APIs for controlling and receiving information about other panes (#3515)
* add context to opening command panes, and events for their start/finish
* show/hide other panes plugin apis
* get tests to pass
* style(fmt): rustfmt
* update plugin test snapshots
Diffstat (limited to 'zellij-utils/src/data.rs')
| -rw-r--r-- | zellij-utils/src/data.rs | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index 0ebb6f1b..cb27a706 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -910,9 +910,12 @@ pub enum Event { Vec<u8>, BTreeMap<String, String>, ), // status, - // headers, - // body, - // context + // headers, + // body, + // context + CommandPaneOpened(u32, Context), // u32 - terminal_pane_id + CommandPaneExited(u32, Option<i32>, Context), // u32 - terminal_pane_id, Option<i32> - + // exit_code } #[derive( @@ -1671,6 +1674,25 @@ impl FloatingPaneCoordinates { } } +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +pub struct OriginatingPlugin { + pub plugin_id: u32, + pub client_id: ClientId, + pub context: Context, +} + +impl OriginatingPlugin { + pub fn new(plugin_id: u32, client_id: ClientId, context: Context) -> Self { + OriginatingPlugin { + plugin_id, + client_id, + context, + } + } +} + +type Context = BTreeMap<String, String>; + #[derive(Debug, Clone, EnumDiscriminants, ToString)] #[strum_discriminants(derive(EnumString, Hash, Serialize, Deserialize))] #[strum_discriminants(name(CommandType))] @@ -1684,8 +1706,8 @@ pub enum PluginCommand { OpenFileFloating(FileToOpen, Option<FloatingPaneCoordinates>), OpenTerminal(FileToOpen), // only used for the path as cwd OpenTerminalFloating(FileToOpen, Option<FloatingPaneCoordinates>), // only used for the path as cwd - OpenCommandPane(CommandToRun), - OpenCommandPaneFloating(CommandToRun, Option<FloatingPaneCoordinates>), + OpenCommandPane(CommandToRun, Context), + OpenCommandPaneFloating(CommandToRun, Option<FloatingPaneCoordinates>, Context), SwitchTabTo(u32), // tab index SetTimeout(f64), // seconds ExecCmd(Vec<String>), @@ -1747,7 +1769,7 @@ pub enum PluginCommand { DeleteAllDeadSessions, // String -> session name OpenTerminalInPlace(FileToOpen), // only used for the path as cwd OpenFileInPlace(FileToOpen), - OpenCommandPaneInPlace(CommandToRun), + OpenCommandPaneInPlace(CommandToRun, Context), RunCommand( Vec<String>, // command BTreeMap<String, String>, // env_variables @@ -1774,4 +1796,6 @@ pub enum PluginCommand { CloseSelf, NewTabsWithLayoutInfo(LayoutInfo), Reconfigure(String), // String -> stringified configuration + HidePaneWithId(PaneId), + ShowPaneWithId(PaneId, bool), // bool -> should_float_if_hidden } |
