diff options
| author | Aram Drevekenin <aram@poor.dev> | 2025-12-11 14:25:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-11 14:25:42 +0100 |
| commit | 693fa082def5ef0fe030cd7fdc3b1df051b35dc6 (patch) | |
| tree | b3f651462bbc1cd2fa5b2d79207343413ef6b83c /zellij-utils/src/plugin_api/action.proto | |
| parent | fix(zellij-server): unblock building on 32bit targets (#4484) (diff) | |
| download | sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.tar.gz sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.tar.xz sl0ppij-693fa082def5ef0fe030cd7fdc3b1df051b35dc6.zip | |
Command Sequences, Blocking CLI Commands, New Plugin APIs (#4546)
* fix deadlocks
* initial logging to plugin implementation
* only log actions, include keys as Action::Write
* send actions to plugins as a new Event::UserAction
* add Action::Write metadata to plugin API
* run_action plugin command and permission
* block-until-exit/success/failure in the cli
* fix tests
* add NewBlockingPane to the plugin API
* run actions in a different thread so as not to block plugin execution
* add custom context to run_action flow
* fixes for floating pane z_index sorting and unknown protobuf events not crashing plugins
* always render the frame of pinned panes
* macros module
* add macros to config
* KDL macro parsing
* thread macros to the plugin thread
* get/update/delete macros from plugins
* add macros updated event
* add ability to rename macros
* fix deadlock
* fix z_indices with pinned unselectable panes bug
* allow plugins to opt-in to show_cursor
* change show_cursor(bool) to show_cursor(Option<coordinates>)
* test
* upgrade strum to allow proper enum iteration and case insensitive fromstr implementation for Actions
* better cwd tracking for exited command panes
* add initial panes to NewTab Action (no-op for now)
* add initial panes to cli newtab action
* make initial panes work
* add close_on_exit and start_suspended to the cli
* properly convert newtab action (potentially breaking for plugins)
* allow first pane in tab to block
* make distinction between opening panes with the last active client and the current pane in the cli
* improve some apis
* fix fixed size closing pane bug
* fix plugin cursor coordinates
* fix issues with launch-or-focus-plugin having to do with in-place and suppressed panes
* fix: set affected pane in replace pane
* allow setting a pane in place when it is suppressed and being focused (tests failing)
* fix tests
* some fixes for unsuppression of panes
* some fixes for completion_tx in new tab action
* allow replace/suppressed rather than replace/close only
* fixes for inserting suppressed panes without conflicts
* pane focus history and explicit unsuppress plugin api
* fix: prefer explicitly provided pane id in placement in actions that provide it
* fix floating pane coordinate change and z_index
* fix plugin cache dir to persist between sessions
* fix some stack focusing issues when adding panes without a client id
* make sure pinned panes are always above non-pinned floating panes
* allow plugins to copy to clipboard
* initial text styling additions implementations - buggy
* fix dimming issues
* remove extras, stay with just dim and unbold
* unbold and dim as indices
* allow ui components to render success/error colors
* allow plugins to send sigint/sigkill to processes, as well as receive their pid
* ui component fixes and send originating plugin context with run_action
* originating plugin for new tab too
* make plugn show pane command also expand stacked panes
* add sequence plugin
* remove macros
* remove snapshots
* add shortcut for sequence plugin
* fix plugin tests
* plugin tests for new apis
* update snapshots for sequence shortcut
* cleanups and formatting
* Event::CwdChanged
* moar cleanups
* remove some warnings
* remove mroe warnings
* remove dead code
* remove more dead code
* fix minor bugs in sequence plugin
* update sequence help and format codebase
* fix conditional blocking cli commands
* fix initial-command new-tab cli flag
* add client_ids to CwdChanged Event
* last fixes
* add pr
Diffstat (limited to 'zellij-utils/src/plugin_api/action.proto')
| -rw-r--r-- | zellij-utils/src/plugin_api/action.proto | 295 |
1 files changed, 295 insertions, 0 deletions
diff --git a/zellij-utils/src/plugin_api/action.proto b/zellij-utils/src/plugin_api/action.proto index 2772e725..c29884af 100644 --- a/zellij-utils/src/plugin_api/action.proto +++ b/zellij-utils/src/plugin_api/action.proto @@ -5,6 +5,163 @@ import "resize.proto"; package api.action; +// Layout and related types + +enum SplitDirection { + SPLIT_DIRECTION_UNSPECIFIED = 0; + SPLIT_DIRECTION_HORIZONTAL = 1; + SPLIT_DIRECTION_VERTICAL = 2; +} + +message PercentOrFixed { + oneof size_type { + uint32 percent = 1; + uint32 fixed = 2; + } +} + +enum LayoutConstraint { + LAYOUT_CONSTRAINT_UNSPECIFIED = 0; + LAYOUT_CONSTRAINT_MAX_PANES = 1; + LAYOUT_CONSTRAINT_MIN_PANES = 2; + LAYOUT_CONSTRAINT_EXACT_PANES = 3; + LAYOUT_CONSTRAINT_NO_CONSTRAINT = 4; +} + +message LayoutConstraintWithValue { + LayoutConstraint constraint_type = 1; + optional uint32 value = 2; +} + +message PluginUserConfiguration { + map<string, string> configuration = 1; +} + +enum RunPluginLocation { + RUN_PLUGIN_LOCATION_UNSPECIFIED = 0; + RUN_PLUGIN_LOCATION_FILE = 1; + RUN_PLUGIN_LOCATION_ZELLIJ = 2; + RUN_PLUGIN_LOCATION_REMOTE = 3; +} + +message RunPluginLocationData { + RunPluginLocation location_type = 1; + oneof location_data { + string file_path = 2; + PluginTag zellij_tag = 3; + string remote_url = 4; + } +} + +message PluginTag { + string tag = 1; +} + +message RunPlugin { + bool _allow_exec_host_cmd = 1; + RunPluginLocationData location = 2; + PluginUserConfiguration configuration = 3; + optional string initial_cwd = 4; +} + +message PluginAlias { + string name = 1; + optional PluginUserConfiguration configuration = 2; + optional string initial_cwd = 3; + optional RunPlugin run_plugin = 4; +} + +message RunPluginOrAlias { + oneof plugin_type { + RunPlugin plugin = 1; + PluginAlias alias = 2; + } +} + +message RunEditFileAction { + string file_path = 1; + optional uint32 line_number = 2; + optional string cwd = 3; +} + +message PaneRun { + oneof run_type { + RunCommandAction command = 1; + RunPluginOrAlias plugin = 2; + RunEditFileAction edit_file = 3; + string cwd = 4; + } +} + +message TiledPaneLayout { + SplitDirection children_split_direction = 1; + optional string name = 2; + repeated TiledPaneLayout children = 3; + optional SplitSize split_size = 4; + optional PaneRun run = 5; + bool borderless = 6; + optional string focus = 7; + optional bool exclude_from_sync = 8; + bool children_are_stacked = 9; + optional uint32 external_children_index = 10; + bool is_expanded_in_stack = 11; + bool hide_floating_panes = 12; + optional string pane_initial_contents = 13; +} + +message FloatingPaneLayout { + optional string name = 1; + optional PercentOrFixed height = 2; + optional PercentOrFixed width = 3; + optional PercentOrFixed x = 4; + optional PercentOrFixed y = 5; + optional bool pinned = 6; + optional PaneRun run = 7; + optional bool focus = 8; + bool already_running = 9; + optional string pane_initial_contents = 10; + optional uint32 logical_position = 11; +} + +message SwapTiledLayout { + repeated LayoutConstraintTiledPair constraint_map = 1; + optional string name = 2; +} + +message SwapFloatingLayout { + repeated LayoutConstraintFloatingPair constraint_map = 1; + optional string name = 2; +} + +message LayoutConstraintTiledPair { + LayoutConstraintWithValue constraint = 1; + TiledPaneLayout layout = 2; +} + +message LayoutConstraintFloatingPair { + LayoutConstraintWithValue constraint = 1; + repeated FloatingPaneLayout layouts = 2; +} + +message CommandOrPlugin { + oneof command_or_plugin_type { + RunCommandAction command = 1; + RunPluginOrAlias plugin = 2; + } +} + +message NewTabPayload { + optional TiledPaneLayout tiled_layout = 1; + repeated FloatingPaneLayout floating_layouts = 2; + repeated SwapTiledLayout swap_tiled_layouts = 3; + repeated SwapFloatingLayout swap_floating_layouts = 4; + optional string tab_name = 5; + bool should_change_focus_to_new_tab = 6; + optional string cwd = 7; + repeated CommandOrPlugin initial_panes = 8; + optional UnblockCondition first_pane_unblock_condition = 9; +} + message Action { ActionName name = 1; oneof optional_payload { @@ -53,6 +210,9 @@ message Action { CliPipePayload message_payload = 47; MoveTabDirection move_tab_payload = 48; MouseEventPayload mouse_event_payload = 49; + NewBlockingPanePayload new_blocking_pane_payload = 50; + NewTabPayload new_tab_payload = 51; + NewInPlacePanePayload new_in_place_pane_payload = 52; } } @@ -71,6 +231,7 @@ message IdAndName { message PaneIdAndShouldFloat { uint32 pane_id = 1; bool should_float = 2; + bool should_be_in_place = 3; } message NewPluginPanePayload { @@ -111,11 +272,13 @@ message GoToTabNamePayload { message NewFloatingPanePayload { optional RunCommandAction command = 1; + bool near_current_pane = 2; } message NewTiledPanePayload { optional RunCommandAction command = 1; optional resize.ResizeDirection direction = 2; + bool near_current_pane = 3; } message MovePanePayload { @@ -128,6 +291,7 @@ message EditFilePayload { optional string cwd = 3; optional resize.ResizeDirection direction = 4; bool should_float = 5; + bool near_current_pane = 6; } message ScrollAtPayload { @@ -139,12 +303,30 @@ message NewPanePayload { optional string pane_name = 2; } +message NewBlockingPanePayload { + NewPanePlacement placement = 1; + optional string pane_name = 2; + optional RunCommandAction command = 3; + optional UnblockCondition unblock_condition = 4; + bool near_current_pane = 5; +} + +message NewInPlacePanePayload { + optional RunCommandAction command = 1; + optional string pane_name = 2; + bool near_current_pane = 3; + optional PaneId pane_id_to_replace = 4; + bool close_replace_pane = 5; +} + message SwitchToModePayload { input_mode.InputMode input_mode = 1; } message WritePayload { bytes bytes_to_write = 1; + optional KeyWithModifier key_with_modifier = 2; + bool is_kitty_keyboard_protocol = 3; } message WriteCharsPayload { @@ -245,6 +427,8 @@ enum ActionName { ToggleGroupMarking = 88; NewStackedPane = 89; SwitchSession = 90; + NewBlockingPane = 91; + NewInPlacePane = 92; } message Position { @@ -252,6 +436,66 @@ message Position { int64 column = 2; } +// SplitSize represents a dimension that can be either a percentage or fixed size +message SplitSize { + oneof split_size_variant { + uint32 percent = 1; // 1 to 100 + uint32 fixed = 2; // absolute number of columns or rows + } +} + +// PaneId identifies either a terminal or plugin pane +message PaneId { + oneof pane_id_variant { + uint32 terminal = 1; + uint32 plugin = 2; + } +} + +// FloatingPaneCoordinates specifies the position and size of a floating pane +message FloatingPaneCoordinates { + optional SplitSize x = 1; + optional SplitSize y = 2; + optional SplitSize width = 3; + optional SplitSize height = 4; + optional bool pinned = 5; +} + +// UnblockCondition specifies when a blocking pane should unblock +enum UnblockCondition { + UNBLOCK_ON_EXIT_SUCCESS = 0; + UNBLOCK_ON_EXIT_FAILURE = 1; + UNBLOCK_ON_ANY_EXIT = 2; +} + +// NewPanePlacement specifies where a new pane should be placed +message NewPanePlacement { + oneof placement_variant { + bool no_preference = 1; + TiledPlacement tiled = 2; + FloatingPlacement floating = 3; + InPlaceConfig in_place = 4; + StackedPlacement stacked = 5; + } +} + +message TiledPlacement { + optional resize.ResizeDirection direction = 1; +} + +message FloatingPlacement { + optional FloatingPaneCoordinates coordinates = 1; +} + +message InPlaceConfig { + optional PaneId pane_id_to_replace = 1; + bool close_replaced_pane = 2; +} + +message StackedPlacement { + optional PaneId pane_id = 1; +} + message MouseEventPayload { uint32 event_type = 1; bool left = 2; @@ -284,3 +528,54 @@ message NameAndValue { string name = 1; string value = 2; } + +message KeyWithModifier { + BareKey bare_key = 1; + repeated KeyModifier key_modifiers = 2; + optional string character = 3; // Only set when bare_key is CHAR +} + +enum BareKey { + BARE_KEY_UNSPECIFIED = 0; + BARE_KEY_PAGE_DOWN = 1; + BARE_KEY_PAGE_UP = 2; + BARE_KEY_LEFT = 3; + BARE_KEY_DOWN = 4; + BARE_KEY_UP = 5; + BARE_KEY_RIGHT = 6; + BARE_KEY_HOME = 7; + BARE_KEY_END = 8; + BARE_KEY_BACKSPACE = 9; + BARE_KEY_DELETE = 10; + BARE_KEY_INSERT = 11; + BARE_KEY_F1 = 12; + BARE_KEY_F2 = 13; + BARE_KEY_F3 = 14; + BARE_KEY_F4 = 15; + BARE_KEY_F5 = 16; + BARE_KEY_F6 = 17; + BARE_KEY_F7 = 18; + BARE_KEY_F8 = 19; + BARE_KEY_F9 = 20; + BARE_KEY_F10 = 21; + BARE_KEY_F11 = 22; + BARE_KEY_F12 = 23; + BARE_KEY_CHAR = 24; + BARE_KEY_TAB = 25; + BARE_KEY_ESC = 26; + BARE_KEY_ENTER = 27; + BARE_KEY_CAPS_LOCK = 28; + BARE_KEY_SCROLL_LOCK = 29; + BARE_KEY_NUM_LOCK = 30; + BARE_KEY_PRINT_SCREEN = 31; + BARE_KEY_PAUSE = 32; + BARE_KEY_MENU = 33; +} + +enum KeyModifier { + KEY_MODIFIER_UNSPECIFIED = 0; + KEY_MODIFIER_CTRL = 1; + KEY_MODIFIER_ALT = 2; + KEY_MODIFIER_SHIFT = 3; + KEY_MODIFIER_SUPER = 4; +} |
