zellij-utils 0.44.1

A utility library for Zellij client and server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
syntax = "proto3";

import "input_mode.proto";
import "key.proto";
import "style.proto";
import "action.proto";

package api.event;

enum EventType {
    /// The input mode or relevant metadata changed
    ModeUpdate = 0;
    /// The tab state in the app was changed
    TabUpdate = 1;
    /// The pane state in the app was changed
    PaneUpdate = 2;
    /// A key was pressed while the user is focused on this plugin's pane
    Key = 3;
    /// A mouse event happened while the user is focused on this plugin's pane
    Mouse = 4;
    /// A timer expired set by the `set_timeout` method exported by `zellij-tile`.
    Timer = 5;
    /// Text was copied to the clipboard anywhere in the app
    CopyToClipboard = 6;
    /// Failed to copy text to clipboard anywhere in the app
    SystemClipboardFailure = 7;
    /// Input was received anywhere in the app
    InputReceived = 8;
    /// This plugin became visible or invisible
    Visible = 9;
    /// A message from one of the plugin's workers
    CustomMessage = 10;
    /// A file was created somewhere in the Zellij CWD folder
    FileSystemCreate = 11;
    /// A file was accessed somewhere in the Zellij CWD folder
    FileSystemRead = 12;
    /// A file was modified somewhere in the Zellij CWD folder
    FileSystemUpdate = 13;
    /// A file was deleted somewhere in the Zellij CWD folder
    FileSystemDelete = 14;
    PermissionRequestResult = 15;
    SessionUpdate = 16;
    RunCommandResult = 17;
    WebRequestResult = 18;
    CommandPaneOpened = 19;
    CommandPaneExited = 20;
    PaneClosed = 21;
    EditPaneOpened = 22;
    EditPaneExited = 23;
    CommandPaneReRun = 24;
    FailedToWriteConfigToDisk = 25;
    ListClients = 26;
    HostFolderChanged = 27;
    FailedToChangeHostFolder = 28;
    PastedText = 29;
    ConfigWasWrittenToDisk = 30;
    WebServerStatus = 31;
    BeforeClose = 32;
    FailedToStartWebServer = 34;
    InterceptedKeyPress = 35;
    PaneRenderReport = 36;
    UserAction = 37;
    ActionComplete = 38;
    CwdChanged = 39;
    AvailableLayoutInfo = 40;
    PluginConfigurationChanged = 41;
    HighlightClicked = 42;
    PaneRenderReportWithAnsi = 43;
    InitialKeybinds = 44;
}

message EventNameList {
  repeated EventType event_types = 1;
}

message Event {
  EventType name = 1;
  oneof payload {
    ModeUpdatePayload mode_update_payload = 2;
    TabUpdatePayload tab_update_payload = 3;
    PaneUpdatePayload pane_update_payload = 4;
    key.Key key_payload = 5;
    MouseEventPayload mouse_event_payload = 6;
    float timer_payload = 7;
    CopyDestination copy_to_clipboard_payload = 8;
    bool visible_payload = 9;
    CustomMessagePayload custom_message_payload = 10;
    FileListPayload file_list_payload = 11;
    PermissionRequestResultPayload permission_request_result_payload = 12;
    SessionUpdatePayload session_update_payload = 13;
    RunCommandResultPayload run_command_result_payload = 14;
    WebRequestResultPayload web_request_result_payload = 15;
    CommandPaneOpenedPayload command_pane_opened_payload = 16;
    CommandPaneExitedPayload command_pane_exited_payload = 17;
    PaneClosedPayload pane_closed_payload = 18;
    EditPaneOpenedPayload edit_pane_opened_payload = 19;
    EditPaneExitedPayload edit_pane_exited_payload = 20;
    CommandPaneReRunPayload command_pane_rerun_payload = 21;
    FailedToWriteConfigToDiskPayload failed_to_write_config_to_disk_payload = 22;
    ListClientsPayload list_clients_payload = 23;
    HostFolderChangedPayload host_folder_changed_payload = 24;
    FailedToChangeHostFolderPayload failed_to_change_host_folder_payload = 25;
    PastedTextPayload pasted_text_payload = 26;
    WebServerStatusPayload web_server_status_payload = 27;
    FailedToStartWebServerPayload failed_to_start_web_server_payload = 28;
    key.Key intercepted_key_payload = 29;
    PaneRenderReportPayload pane_render_report_payload = 30;
    UserActionPayload user_action_payload = 31;
    ActionCompletePayload action_complete_payload = 32;
    CwdChangedPayload cwd_changed_payload = 33;
    AvailableLayoutInfoPayload available_layout_info_payload = 34;
    PluginConfigurationChangedPayload plugin_configuration_changed_payload = 35;
    HighlightClickedPayload highlight_clicked_payload = 36;
    PaneRenderReportPayload pane_render_report_with_ansi_payload = 37;
    InitialKeybindsPayload initial_keybinds_payload = 38;
  }
}

message CwdChangedPayload {
  PaneId pane_id = 1;
  string new_cwd = 2;
  repeated uint32 focused_client_ids = 3;
}

message FailedToStartWebServerPayload {
  string error = 1;
}

message PastedTextPayload {
  string pasted_text = 1;
}

enum WebServerStatusIndication {
  Online = 0;
  Offline = 1;
  DifferentVersion = 2;
}

message WebServerStatusPayload {
  WebServerStatusIndication web_server_status_indication = 1;
  optional string payload = 2;
}

message FailedToChangeHostFolderPayload {
  optional string error_message = 1;
}

message HostFolderChangedPayload {
  string new_host_folder_path = 1;
}

message ListClientsPayload {
  repeated ClientInfo client_info = 1;
}

message ClientInfo {
  uint32 client_id = 1;
  PaneId pane_id = 2;
  string running_command = 3;
  bool is_current_client = 4;
}

message FailedToWriteConfigToDiskPayload {
  optional string file_path = 1;
}

message CommandPaneReRunPayload {
  uint32 terminal_pane_id = 1;
  repeated ContextItem context = 3;
}

message PaneClosedPayload {
  PaneId pane_id = 1;
}

// duplicate of plugin_command.PaneId because protobuffs don't like recursive imports
message PaneId {
  PaneType pane_type = 1;
  uint32 id = 2;
}

// duplicate of plugin_command.PaneType because protobuffs don't like recursive imports
enum PaneType {
  Terminal = 0;
  Plugin = 1;
}

message CommandPaneOpenedPayload {
  uint32 terminal_pane_id = 1;
  repeated ContextItem context = 2;
}

message EditPaneOpenedPayload {
  uint32 terminal_pane_id = 1;
  repeated ContextItem context = 2;
}

message CommandPaneExitedPayload {
  uint32 terminal_pane_id = 1;
  optional int32 exit_code = 2;
  repeated ContextItem context = 3;
}

message EditPaneExitedPayload {
  uint32 terminal_pane_id = 1;
  optional int32 exit_code = 2;
  repeated ContextItem context = 3;
}

message SessionUpdatePayload {
  repeated SessionManifest session_manifests = 1;
  repeated ResurrectableSession resurrectable_sessions = 2;
}

message AvailableLayoutInfoPayload {
  repeated LayoutInfo available_layouts = 1;
  repeated LayoutWithError layouts_with_errors = 2;
}

message RunCommandResultPayload {
  optional int32 exit_code = 1;
  bytes stdout = 2;
  bytes stderr = 3;
  repeated ContextItem context = 4;
}

message WebRequestResultPayload {
  int32 status = 1;
  repeated Header headers = 2;
  bytes body = 3;
  repeated ContextItem context = 4;
}

message ContextItem {
  string name = 1;
  string value = 2;
}

message Header {
  string name = 1;
  string value = 2;
}

message PermissionRequestResultPayload {
  bool granted = 1;
}

message FileListPayload {
  repeated string paths = 1;
  repeated FileMetadata paths_metadata = 2;
}

message FileMetadata {
  bool metadata_is_set = 1; // if this is false, the metadata for this file has not been read
  bool is_dir = 2;
  bool is_file = 3;
  bool is_symlink = 4;
  uint64 len = 5;
}

message CustomMessagePayload {
  string message_name = 1;
  string payload = 2;
}

enum CopyDestination {
  Command = 0;
  Primary = 1;
  System = 2;
}

message MouseEventPayload {
  MouseEventName mouse_event_name = 1;
  oneof mouse_event_payload {
    uint32 line_count = 2;
    action.Position position = 3;
  }
}

enum MouseEventName {
    MouseScrollUp = 0;
    MouseScrollDown = 1;
    MouseLeftClick = 2;
    MouseRightClick = 3;
    MouseHold = 4;
    MouseRelease = 5;
    MouseHover = 6;
}

message TabUpdatePayload {
    repeated TabInfo tab_info = 1;
}

message PaneUpdatePayload {
  repeated PaneManifest pane_manifest = 1;
}

message PaneManifest {
  uint32 tab_index = 1;
  repeated PaneInfo panes = 2;
}

message SessionManifest {
  string name = 1;
  repeated TabInfo tabs = 2;
  repeated PaneManifest panes = 3;
  uint32 connected_clients = 4;
  bool is_current_session = 5;
  repeated LayoutInfo available_layouts = 6;
  repeated PluginInfo plugins = 7;
  bool web_clients_allowed = 8;
  uint32 web_client_count = 9;
  repeated ClientTabHistory tab_history = 10;
  repeated ClientPaneHistory pane_history = 11;
  uint64 creation_time = 12;
}

message ClientTabHistory {
  uint32 client_id = 1;
  repeated uint32 tab_history = 2;
}

message ClientPaneHistory {
  uint32 client_id = 1;
  repeated PaneId pane_history = 2;
}

message PluginInfo {
  uint32 plugin_id = 1;
  string plugin_url = 2;
  repeated ContextItem plugin_config = 3;
}

message LayoutInfo {
  string name = 1;
  string source = 2;
  optional LayoutMetadata layout_metadata = 5;
}

message LayoutWithError {
  string layout_name = 1;
  LayoutParsingError error = 2;
}

message LayoutParsingError {
  oneof error_type {
    KdlErrorVariant kdl_error = 1;
    SyntaxError syntax_error = 2;
  }
}

message KdlErrorVariant {
  KdlError kdl_error = 1;
  string file_name = 2;
  string source_code = 3;
}

message SyntaxError {
  // Empty message, just a marker
}

message KdlError {
  string error_message = 1;
  optional uint64 offset = 2;
  optional uint64 len = 3;
  optional string help_message = 4;
}

message LayoutMetadata {
  repeated TabMetadata tabs = 1;
  string creation_time = 2;
  string update_time = 3;

}

message TabMetadata {
  repeated PaneMetadata pane_metadata = 1;
  optional string name = 2;
}

message PaneMetadata {
  optional string name = 1;
  bool is_plugin = 2;
  bool is_builtin_plugin = 3;
}

message ResurrectableSession {
  string name = 1;
  uint64 creation_time = 2;
}

message PaneInfo {
    uint32 id = 1;
    bool is_plugin = 2;
    bool is_focused = 3;
    bool is_fullscreen = 4;
    bool is_floating = 5;
    bool is_suppressed = 6;
    string title = 7;
    bool exited = 8;
    optional int32 exit_status = 9;
    bool is_held = 10;
    uint32 pane_x = 11;
    uint32 pane_content_x = 12;
    uint32 pane_y = 13;
    uint32 pane_content_y = 14;
    uint32 pane_rows = 15;
    uint32 pane_content_rows = 16;
    uint32 pane_columns = 17;
    uint32 pane_content_columns = 18;
    optional action.Position cursor_coordinates_in_pane = 19;
    optional string terminal_command = 20;
    optional string plugin_url = 21;
    bool is_selectable = 22;
    repeated IndexInPaneGroup index_in_pane_group = 23;
    optional string default_fg = 24;
    optional string default_bg = 25;
}

message IndexInPaneGroup {
  uint32 client_id = 1;
  uint32 index = 2;
}

message TabInfo {
    uint32 position = 1;
    string name = 2;
    bool active = 3;
    uint32 panes_to_hide = 4;
    bool is_fullscreen_active = 5;
    bool is_sync_panes_active = 6;
    bool are_floating_panes_visible = 7;
    repeated uint32 other_focused_clients = 8;
    optional string active_swap_layout_name = 9;
    bool is_swap_layout_dirty = 10;
    uint32 viewport_rows = 11;
    uint32 viewport_columns = 12;
    uint32 display_area_rows = 13;
    uint32 display_area_columns = 14;
    uint32 selectable_tiled_panes_count = 15;
    uint32 selectable_floating_panes_count = 16;
    uint32 tab_id = 17;
    bool has_bell_notification = 18;
    bool is_flashing_bell = 19;
}

message ModeUpdatePayload {
  input_mode.InputMode current_mode = 1;
  repeated InputModeKeybinds keybinds = 2;
  style.Style style = 3;
  bool arrow_fonts_support = 4;
  optional string session_name = 5;
  optional input_mode.InputMode base_mode = 6;
  optional string editor = 7;
  optional string shell = 8;
  optional bool web_clients_allowed = 9;
  optional WebSharing web_sharing = 10;
  optional bool currently_marking_pane_group = 11;
  optional bool is_web_client = 12;
  optional string web_server_ip = 13;
  optional uint32 web_server_port = 14;
  optional bool web_server_capability = 15;
}

enum WebSharing {
    On = 0;
    Off = 1;
    Disabled = 2;
}

message InputModeKeybinds {
  input_mode.InputMode mode = 1;
  repeated KeyBind key_bind = 2;
}

message KeyBind {
  key.Key key = 1;
  repeated action.Action action = 2;
}

message PaneRenderReportPayload {
  repeated PaneContentsEntry pane_contents = 1;
}

message PaneContentsEntry {
  PaneId pane_id = 1;
  PaneContents pane_contents = 2;
}

message PaneContents {
  repeated string viewport = 1;
  optional SelectedText selected_text = 2;
  repeated string lines_above_viewport = 3;
  repeated string lines_below_viewport = 4;
}

message PaneScrollbackResponse {
  oneof response {
    PaneContents ok = 1;
    string err = 2;
  }
}

message SelectedText {
  action.Position start = 1;
  action.Position end = 2;
}

message UserActionPayload {
  action.Action action = 1;
  uint32 client_id = 2;
  optional uint32 terminal_id = 3;
  optional uint32 cli_client_id = 4;
}

message ActionCompletePayload {
  action.Action action = 1;
  optional PaneId pane_id = 2;
  repeated ContextItem context = 3;
}

message PluginConfigurationChangedPayload {
  repeated ContextItem configuration = 1;
}

message HighlightClickedPayload {
  PaneId pane_id = 1;
  string pattern = 2;
  string matched_string = 3;
  repeated ContextItem context = 4;
}

message InitialKeybindsPayload {
  repeated InputModeKeybinds keybinds = 1;
}