Plugin API - Type Reference

This page documents the key data types used throughout the Zellij plugin API. These types are used as parameters and return values in plugin commands and as payloads in plugin events.

For the complete type definitions, see the zellij-tile API documentation.

All types listed here are available via use zellij_tile::prelude::*;.


Table of Contents


PaneId

Uniquely identifies a pane across the session. A pane is either a terminal or a plugin.

#![allow(unused)]
fn main() {
pub enum PaneId {
    Terminal(u32),
    Plugin(u32),
}
}

Example:

#![allow(unused)]
fn main() {
let terminal_pane = PaneId::Terminal(1);
let plugin_pane = PaneId::Plugin(0);

match pane_id {
    PaneId::Terminal(id) => { /* terminal pane */ },
    PaneId::Plugin(id) => { /* plugin pane */ },
}
}

FileToOpen

Specifies a file to open in the user's $EDITOR, with optional line number and working directory.

#![allow(unused)]
fn main() {
pub struct FileToOpen {
    pub path: PathBuf,
    pub line_number: Option<usize>,
    pub cwd: Option<PathBuf>,
}
}
FieldTypeDescription
pathPathBufPath to the file to open
line_numberOption<usize>Optional line number to jump to (if the editor supports it)
cwdOption<PathBuf>Optional working directory for the editor process

Example:

#![allow(unused)]
fn main() {
let file = FileToOpen {
    path: PathBuf::from("/home/user/project/src/main.rs"),
    line_number: Some(42),
    cwd: None,
};
open_file(file, BTreeMap::new());
}

CommandToRun

Specifies a command to execute in a command pane.

#![allow(unused)]
fn main() {
pub struct CommandToRun {
    pub path: PathBuf,
    pub args: Vec<String>,
    pub cwd: Option<PathBuf>,
}
}
FieldTypeDescription
pathPathBufPath to the executable
argsVec<String>Command-line arguments
cwdOption<PathBuf>Optional working directory

Example:

#![allow(unused)]
fn main() {
let cmd = CommandToRun {
    path: PathBuf::from("cargo"),
    args: vec!["build".to_string(), "--release".to_string()],
    cwd: Some(PathBuf::from("/home/user/project")),
};
open_command_pane(cmd, BTreeMap::new());
}

FloatingPaneCoordinates

Specifies the position and size of a floating pane.

#![allow(unused)]
fn main() {
pub struct FloatingPaneCoordinates {
    pub x: Option<PercentOrFixed>,
    pub y: Option<PercentOrFixed>,
    pub width: Option<PercentOrFixed>,
    pub height: Option<PercentOrFixed>,
    pub pinned: Option<bool>,
    pub borderless: Option<bool>,
}
}
FieldTypeDescription
xOption<PercentOrFixed>Horizontal position (columns from left)
yOption<PercentOrFixed>Vertical position (rows from top)
widthOption<PercentOrFixed>Width of the pane
heightOption<PercentOrFixed>Height of the pane
pinnedOption<bool>Whether the floating pane is pinned (stays visible when toggling floating panes)
borderlessOption<bool>Whether the pane border is hidden

All fields are optional. When None, Zellij uses its default placement logic.


PercentOrFixed

Specifies a dimension as either a percentage or a fixed number of rows/columns.

#![allow(unused)]
fn main() {
pub enum PercentOrFixed {
    Percent(usize),  // 1 to 100
    Fixed(usize),    // absolute number of columns or rows
}
}

Example:

#![allow(unused)]
fn main() {
let coords = FloatingPaneCoordinates {
    x: Some(PercentOrFixed::Percent(10)),
    y: Some(PercentOrFixed::Fixed(5)),
    width: Some(PercentOrFixed::Percent(80)),
    height: Some(PercentOrFixed::Fixed(20)),
    pinned: Some(true),
    borderless: None,
};
}

PluginIds

Contains identifying information for the current plugin instance.

#![allow(unused)]
fn main() {
pub struct PluginIds {
    pub plugin_id: u32,
    pub zellij_pid: u32,
    pub initial_cwd: PathBuf,
    pub client_id: ClientId,
}
}
FieldTypeDescription
plugin_idu32Unique identifier for this plugin pane
zellij_pidu32Process ID of the Zellij server
initial_cwdPathBufWorking directory when the plugin was loaded
client_idClientIdThe client that loaded this plugin (u16)

PluginMessage

A message for communication between a plugin and its workers.

#![allow(unused)]
fn main() {
pub struct PluginMessage {
    pub name: String,
    pub payload: String,
    pub worker_name: Option<String>,
}
}
FieldTypeDescription
nameStringMessage identifier/type
payloadStringMessage content
worker_nameOption<String>Target worker name (used with post_message_to)

See Workers for Async Tasks for usage details.


MessageToPlugin

A message destined for another plugin instance (potentially launching it).

#![allow(unused)]
fn main() {
pub struct MessageToPlugin {
    pub plugin_url: Option<String>,
    pub destination_plugin_id: Option<u32>,
    pub plugin_config: BTreeMap<String, String>,
    pub message_name: String,
    pub message_payload: Option<String>,
    pub message_args: BTreeMap<String, String>,
    pub new_plugin_args: Option<NewPluginArgs>,
    pub floating_pane_coordinates: Option<FloatingPaneCoordinates>,
}
}
FieldTypeDescription
plugin_urlOption<String>URL of the target plugin (e.g., "file:/path/to/plugin.wasm")
destination_plugin_idOption<u32>ID of a specific running plugin instance
plugin_configBTreeMap<String, String>Configuration to match or provide to the target plugin
message_nameStringMessage identifier
message_payloadOption<String>Optional message content
message_argsBTreeMap<String, String>Additional key-value arguments
new_plugin_argsOption<NewPluginArgs>Configuration for launching a new plugin if none is running
floating_pane_coordinatesOption<FloatingPaneCoordinates>Position for newly launched plugin pane

NewPluginArgs

Configuration for launching a new plugin instance when the target of a message is not already running.

#![allow(unused)]
fn main() {
pub struct NewPluginArgs {
    pub should_float: Option<bool>,
    pub pane_id_to_replace: Option<PaneId>,
    pub pane_title: Option<String>,
    pub cwd: Option<PathBuf>,
    pub skip_cache: bool,
    pub should_focus: Option<bool>,
}
}
FieldTypeDescription
should_floatOption<bool>Whether the new pane should float
pane_id_to_replaceOption<PaneId>Pane to replace with the new plugin
pane_titleOption<String>Title for the new pane
cwdOption<PathBuf>Working directory for the new plugin
skip_cacheboolWhether to skip the plugin cache (force reload)
should_focusOption<bool>Whether the new pane should receive focus

ResizeStrategy

Describes how a pane should be resized, including direction and boundary behavior.

#![allow(unused)]
fn main() {
pub struct ResizeStrategy {
    pub resize: Resize,
    pub direction: Option<Direction>,
    pub invert_on_boundaries: bool,
}
}
FieldTypeDescription
resizeResizeWhether to increase or decrease the pane area
directionOption<Direction>Which border to move (None = all borders equally)
invert_on_boundariesboolIf true (default), resize inverts when hitting viewport boundaries

Resize

The direction of a resize operation.

#![allow(unused)]
fn main() {
pub enum Resize {
    Increase,
    Decrease,
}
}

Direction

A cardinal direction used for focus movement, pane movement, and resizing.

#![allow(unused)]
fn main() {
pub enum Direction {
    Left,
    Right,
    Up,
    Down,
}
}

InputMode

Describes the different input modes, which change the way keystrokes are interpreted.

#![allow(unused)]
fn main() {
pub enum InputMode {
    Normal,
    Locked,
    Resize,
    Pane,
    Tab,
    Scroll,
    EnterSearch,
    Search,
    RenameTab,
    RenamePane,
    Session,
    Move,
    Prompt,
    Tmux,
}
}
VariantDescription
NormalInput is written to the terminal, except for mode-switching shortcuts
LockedAll input goes to the terminal; all shortcuts disabled except the one to return to Normal
ResizeAllows resizing panes
PaneAllows creating, closing, and navigating between panes
TabAllows creating, closing, and navigating between tabs
ScrollAllows scrolling up and down within a pane
EnterSearchAllows typing a search needle for the scroll buffer
SearchAllows searching within a pane (superset of Scroll)
RenameTabAllows assigning a new name to a tab
RenamePaneAllows assigning a new name to a pane
SessionAllows detaching and session management
MoveAllows moving panes within a tab
PromptAllows interacting with active prompts
TmuxProvides basic tmux keybinding compatibility

HttpVerb

HTTP method for web requests.

#![allow(unused)]
fn main() {
pub enum HttpVerb {
    Get,
    Post,
    Put,
    Delete,
}
}

RegexHighlight

Defines a regex-based content highlight that a plugin can apply to a terminal pane.

#![allow(unused)]
fn main() {
pub struct RegexHighlight {
    pub pattern: String,
    pub style: HighlightStyle,
    pub layer: HighlightLayer,
    pub context: BTreeMap<String, String>,
    pub on_hover: bool,
    pub bold: bool,
    pub italic: bool,
    pub underline: bool,
    pub tooltip_text: Option<String>,
}
}
FieldTypeDescription
patternStringRegex pattern to match against pane content
styleHighlightStyleColor scheme for matched text
layerHighlightLayerPriority layer for overlapping highlights
contextBTreeMap<String, String>Arbitrary data echoed back on click via HighlightClicked event
on_hoverboolIf true, highlight only renders when the cursor overlaps the match
boldboolRender matched text in bold
italicboolRender matched text in italic
underlineboolRender matched text with underline
tooltip_textOption<String>Text shown at the bottom of the pane frame when hovering over the match

HighlightStyle

Color scheme for a regex highlight. Theme-based variants reference colors from the active theme.

#![allow(unused)]
fn main() {
pub enum HighlightStyle {
    None,
    Emphasis0,
    Emphasis1,
    Emphasis2,
    Emphasis3,
    BackgroundEmphasis0,
    BackgroundEmphasis1,
    BackgroundEmphasis2,
    BackgroundEmphasis3,
    CustomRgb {
        fg: Option<(u8, u8, u8)>,
        bg: Option<(u8, u8, u8)>,
    },
    CustomIndex {
        fg: Option<u8>,
        bg: Option<u8>,
    },
}
}
VariantDescription
NoneNo color override (use with bold/italic/underline for style-only highlights)
Emphasis0..Emphasis3Foreground set to theme emphasis color 0-3, no background override
BackgroundEmphasis0..BackgroundEmphasis3Background set to theme emphasis color 0-3, foreground set to background color
CustomRgbCustom foreground and/or background as RGB tuples
CustomIndexCustom foreground and/or background as terminal color indices (0-255)

HighlightLayer

Priority layer for plugin-supplied regex highlights. Higher-priority layers take visual precedence over lower ones when highlights overlap. Built-in highlights (mouse selection, search results) always take precedence over all plugin layers.

#![allow(unused)]
fn main() {
pub enum HighlightLayer {
    Hint,
    Tool,
    ActionFeedback,
}
}
VariantPriorityDescription
HintLowestPure pattern matching (paths, URLs, IPs)
ToolMiddleBacked by runtime domain knowledge (git, docker, k8s)
ActionFeedbackHighestResult of an explicit user action (search, bookmarks)

PaneContents

The text contents of a pane, including viewport and scrollback.

#![allow(unused)]
fn main() {
pub struct PaneContents {
    pub lines_above_viewport: Vec<String>,
    pub lines_below_viewport: Vec<String>,
    pub viewport: Vec<String>,
    pub selected_text: Option<SelectedText>,
}
}
FieldTypeDescription
lines_above_viewportVec<String>Lines above the current viewport (only populated if full scrollback is requested)
lines_below_viewportVec<String>Lines below the current viewport (only populated if full scrollback is requested)
viewportVec<String>Currently visible lines
selected_textOption<SelectedText>Currently selected text range, if any

Note: lines_above_viewport and lines_below_viewport are only populated when explicitly requested (e.g., with get_full_scrollback: true in get_pane_scrollback). This is for performance reasons.


LayoutInfo

Identifies a layout by its source.

#![allow(unused)]
fn main() {
pub enum LayoutInfo {
    BuiltIn(String),
    File(String, LayoutMetadata),
    Url(String),
    Stringified(String),
}
}
VariantDescription
BuiltIn(name)A built-in layout (e.g., "default", "compact", "welcome")
File(name, metadata)A layout file from the layout directory, with parsed metadata
Url(url)A layout loaded from a URL
Stringified(kdl)A raw KDL layout string

LayoutMetadata

Parsed metadata about a layout's structure.

#![allow(unused)]
fn main() {
pub struct LayoutMetadata {
    pub tabs: Vec<TabMetadata>,
    pub creation_time: String,
    pub update_time: String,
}
}
FieldTypeDescription
tabsVec<TabMetadata>Metadata for each tab defined in the layout
creation_timeStringWhen the layout was created
update_timeStringWhen the layout was last updated

KeyWithModifier

A keyboard key combined with zero or more modifier keys.

#![allow(unused)]
fn main() {
pub struct KeyWithModifier {
    pub bare_key: BareKey,
    pub key_modifiers: BTreeSet<KeyModifier>,
}
}
FieldTypeDescription
bare_keyBareKeyThe base key (e.g., BareKey::Char('a'), BareKey::Enter, BareKey::F(1))
key_modifiersBTreeSet<KeyModifier>Set of active modifiers (Ctrl, Alt, Shift, Super)

TabInfo

Information about a currently opened tab.

#![allow(unused)]
fn main() {
pub struct TabInfo {
    pub position: usize,
    pub name: String,
    pub active: bool,
    pub panes_to_hide: usize,
    pub is_fullscreen_active: bool,
    pub is_sync_panes_active: bool,
    pub are_floating_panes_visible: bool,
    pub other_focused_clients: Vec<ClientId>,
    pub active_swap_layout_name: Option<String>,
    pub is_swap_layout_dirty: bool,
    pub viewport_rows: usize,
    pub viewport_columns: usize,
    pub display_area_rows: usize,
    pub display_area_columns: usize,
    pub selectable_tiled_panes_count: usize,
    pub selectable_floating_panes_count: usize,
    pub tab_id: usize,
    pub has_bell_notification: bool,
    pub is_flashing_bell: bool,
}
}
FieldTypeDescription
positionusizeThe tab's 0-indexed position
nameStringDisplay name of the tab
activeboolWhether this tab is currently focused
panes_to_hideusizeNumber of suppressed panes in this tab
is_fullscreen_activeboolWhether a pane is taking up the full display area
is_sync_panes_activeboolWhether STDIN sync is active for this tab
are_floating_panes_visibleboolWhether floating panes are visible
other_focused_clientsVec<ClientId>Other clients focused on this tab
active_swap_layout_nameOption<String>Name of the active swap layout, if any
is_swap_layout_dirtyboolWhether the user manually changed the layout
viewport_rowsusizeRow count in the viewport (excluding UI panes)
viewport_columnsusizeColumn count in the viewport (excluding UI panes)
display_area_rowsusizeTotal row count (including UI panes)
display_area_columnsusizeTotal column count (including UI panes)
selectable_tiled_panes_countusizeNumber of selectable tiled panes
selectable_floating_panes_countusizeNumber of selectable floating panes
tab_idusizeStable identifier for this tab
has_bell_notificationboolWhether this tab has an active bell notification
is_flashing_bellboolWhether this tab is currently flashing its bell

PaneInfo

Information about a currently open pane.

The coordinates and size fields come in two variants:

  • Pane coordinates (pane_x, pane_columns, etc.) - the entire space including frame and title
  • Content coordinates (pane_content_x, pane_content_columns, etc.) - the area taken by the pane's content only
#![allow(unused)]
fn main() {
pub struct PaneInfo {
    pub id: u32,
    pub is_plugin: bool,
    pub is_focused: bool,
    pub is_fullscreen: bool,
    pub is_floating: bool,
    pub is_suppressed: bool,
    pub title: String,
    pub exited: bool,
    pub exit_status: Option<i32>,
    pub is_held: bool,
    pub pane_x: usize,
    pub pane_content_x: usize,
    pub pane_y: usize,
    pub pane_content_y: usize,
    pub pane_rows: usize,
    pub pane_content_rows: usize,
    pub pane_columns: usize,
    pub pane_content_columns: usize,
    pub cursor_coordinates_in_pane: Option<(usize, usize)>,
    pub terminal_command: Option<String>,
    pub plugin_url: Option<String>,
    pub is_selectable: bool,
    pub index_in_pane_group: BTreeMap<ClientId, usize>,
    pub default_fg: Option<String>,
    pub default_bg: Option<String>,
}
}
FieldTypeDescription
idu32Pane identifier (unique within its type: terminal or plugin)
is_pluginbooltrue if plugin pane, false if terminal pane
is_focusedboolWhether this pane is focused in its layer
is_fullscreenboolWhether this pane is in fullscreen mode
is_floatingboolWhether this pane is floating
is_suppressedboolWhether this pane is suppressed (hidden but still running)
titleStringDisplay title of the pane
exitedboolWhether the pane's process has exited
exit_statusOption<i32>Exit code if the process exited
is_heldboolWhether the pane is paused waiting for user input
pane_xusizeX position including frame
pane_content_xusizeX position of content area
pane_yusizeY position including frame
pane_content_yusizeY position of content area
pane_rowsusizeHeight including frame
pane_content_rowsusizeHeight of content area
pane_columnsusizeWidth including frame
pane_content_columnsusizeWidth of content area
cursor_coordinates_in_paneOption<(usize, usize)>Cursor position (x, y) relative to pane, if visible
terminal_commandOption<String>Stringified command and args (for command panes)
plugin_urlOption<String>Plugin URL (for plugin panes)
is_selectableboolWhether the user can select this pane
index_in_pane_groupBTreeMap<ClientId, usize>Pane group membership indices per client
default_fgOption<String>Default foreground color (e.g., "#00e000")
default_bgOption<String>Default background color (e.g., "#001a3a")

PaneManifest

A dictionary of all panes in the session, indexed by tab position.

#![allow(unused)]
fn main() {
pub struct PaneManifest {
    pub panes: HashMap<usize, Vec<PaneInfo>>,
}
}
FieldTypeDescription
panesHashMap<usize, Vec<PaneInfo>>Map from tab position (0-indexed) to panes in that tab

Panes include tiled, floating, and suppressed panes.


SessionInfo

Information about a running Zellij session.

#![allow(unused)]
fn main() {
pub struct SessionInfo {
    pub name: String,
    pub tabs: Vec<TabInfo>,
    pub panes: PaneManifest,
    pub connected_clients: usize,
    pub is_current_session: bool,
    pub available_layouts: Vec<LayoutInfo>,
    pub plugins: BTreeMap<u32, PluginInfo>,
    pub web_clients_allowed: bool,
    pub web_client_count: usize,
    pub tab_history: BTreeMap<ClientId, Vec<usize>>,
    pub pane_history: BTreeMap<ClientId, Vec<PaneId>>,
    pub creation_time: Duration,
}
}
FieldTypeDescription
nameStringSession name
tabsVec<TabInfo>All tabs in this session
panesPaneManifestAll panes in this session
connected_clientsusizeNumber of connected clients
is_current_sessionboolWhether this is the session the plugin is running in
available_layoutsVec<LayoutInfo>Layouts available in this session
pluginsBTreeMap<u32, PluginInfo>Running plugins indexed by ID
web_clients_allowedboolWhether web clients are allowed
web_client_countusizeNumber of connected web clients
tab_historyBTreeMap<ClientId, Vec<usize>>Tab focus history per client
pane_historyBTreeMap<ClientId, Vec<PaneId>>Pane focus history per client
creation_timeDurationWhen the session was created

ClientInfo

Information about a connected client.

#![allow(unused)]
fn main() {
pub struct ClientInfo {
    pub client_id: ClientId,
    pub pane_id: PaneId,
    pub running_command: String,
    pub is_current_client: bool,
}
}
FieldTypeDescription
client_idClientIdUnique client identifier (u16)
pane_idPaneIdThe pane this client is focused on
running_commandStringStringified command or plugin name in the focused pane
is_current_clientboolWhether this is the client associated with the requesting plugin

ModeInfo

Information about the current input mode, keybindings, and session metadata. Delivered via the ModeUpdate event.

#![allow(unused)]
fn main() {
pub struct ModeInfo {
    pub mode: InputMode,
    pub base_mode: Option<InputMode>,
    pub keybinds: Vec<(InputMode, Vec<(KeyWithModifier, Vec<Action>)>)>,
    pub style: Style,
    pub capabilities: PluginCapabilities,
    pub session_name: Option<String>,
    pub editor: Option<PathBuf>,
    pub shell: Option<PathBuf>,
    pub web_clients_allowed: Option<bool>,
    pub web_sharing: Option<WebSharing>,
    pub currently_marking_pane_group: Option<bool>,
    pub is_web_client: Option<bool>,
    pub web_server_ip: Option<IpAddr>,
    pub web_server_port: Option<u16>,
    pub web_server_capability: Option<bool>,
}
}
FieldTypeDescription
modeInputModeCurrently active input mode
base_modeOption<InputMode>Base mode (when in a transient mode)
keybindsVec<(InputMode, Vec<(KeyWithModifier, Vec<Action>)>)>All keybindings organized by mode
styleStyleActive theme colors and styling
capabilitiesPluginCapabilitiesTerminal capabilities
session_nameOption<String>Name of the current session
editorOption<PathBuf>Configured $EDITOR
shellOption<PathBuf>Configured shell
web_clients_allowedOption<bool>Whether web clients are permitted
web_sharingOption<WebSharing>Web sharing status
currently_marking_pane_groupOption<bool>Whether pane group marking mode is active
is_web_clientOption<bool>Whether the current client is a web client
web_server_ipOption<IpAddr>Configured web server IP
web_server_portOption<u16>Configured web server port
web_server_capabilityOption<bool>Whether web server functionality is available

Mouse

A mouse event that occurred while the user is focused on the plugin pane.

#![allow(unused)]
fn main() {
pub enum Mouse {
    ScrollUp(usize),
    ScrollDown(usize),
    LeftClick(isize, usize),
    RightClick(isize, usize),
    Hold(isize, usize),
    Release(isize, usize),
    Hover(isize, usize),
}
}
VariantParametersDescription
ScrollUp(n)usize - number of linesMouse wheel scrolled up
ScrollDown(n)usize - number of linesMouse wheel scrolled down
LeftClick(line, col)isize, usize - line and columnLeft mouse button clicked
RightClick(line, col)isize, usize - line and columnRight mouse button clicked
Hold(line, col)isize, usize - line and columnMouse button held (drag)
Release(line, col)isize, usize - line and columnMouse button released
Hover(line, col)isize, usize - line and columnMouse moved without button pressed

CopyDestination

Specifies where text was copied to.

#![allow(unused)]
fn main() {
pub enum CopyDestination {
    Command,
    Primary,
    System,
}
}
VariantDescription
CommandCopied via a configured command
PrimaryCopied to the primary selection (X11)
SystemCopied to the system clipboard

PermissionType

Permission types that plugins can request. See Permissions for details.

#![allow(unused)]
fn main() {
pub enum PermissionType {
    ReadApplicationState,
    ChangeApplicationState,
    OpenFiles,
    RunCommands,
    OpenTerminalsOrPlugins,
    WriteToStdin,
    WebAccess,
    ReadCliPipes,
    MessageAndLaunchOtherPlugins,
    Reconfigure,
    FullHdAccess,
    StartWebServer,
    InterceptInput,
    ReadPaneContents,
    RunActionsAsUser,
    WriteToClipboard,
    ReadSessionEnvironmentVariables,
}
}
VariantDescription
ReadApplicationStateRead Zellij state (panes, tabs, UI)
ChangeApplicationStateChange Zellij state and run commands
OpenFilesOpen files for editing
RunCommandsRun host commands
OpenTerminalsOrPluginsStart new terminals and plugins
WriteToStdinWrite to pane STDIN
WebAccessMake HTTP requests
ReadCliPipesControl CLI pipe input/output
MessageAndLaunchOtherPluginsSend messages to and launch other plugins
ReconfigureChange Zellij runtime configuration
FullHdAccessFull access to the host filesystem
StartWebServerStart a local web server
InterceptInputIntercept keyboard and mouse input
ReadPaneContentsRead pane viewport and scrollback contents
RunActionsAsUserExecute actions as the user
WriteToClipboardWrite to the user's clipboard
ReadSessionEnvironmentVariablesRead environment variables from session creation

PermissionStatus

Result of a permission request.

#![allow(unused)]
fn main() {
pub enum PermissionStatus {
    Granted,
    Denied,
}
}

WebServerStatus

Status of the Zellij web server.

#![allow(unused)]
fn main() {
pub enum WebServerStatus {
    Online(String),
    Offline,
    DifferentVersion(String),
}
}
VariantDescription
Online(base_url)Web server is online at the given base URL
OfflineWeb server is not running
DifferentVersion(version)Web server is running a different Zellij version

FileMetadata

Metadata about a file from filesystem events.

#![allow(unused)]
fn main() {
pub struct FileMetadata {
    pub is_dir: bool,
    pub is_file: bool,
    pub is_symlink: bool,
    pub len: u64,
}
}
FieldTypeDescription
is_dirboolWhether the path is a directory
is_fileboolWhether the path is a regular file
is_symlinkboolWhether the path is a symbolic link
lenu64File size in bytes

ConnectToSession

Configuration for switching to or creating a session.

#![allow(unused)]
fn main() {
pub struct ConnectToSession {
    pub name: Option<String>,
    pub tab_position: Option<usize>,
    pub pane_id: Option<(u32, bool)>,
    pub layout: Option<LayoutInfo>,
    pub cwd: Option<PathBuf>,
}
}
FieldTypeDescription
nameOption<String>Session name (if None, a new session with a random name is created)
tab_positionOption<usize>Tab to focus after switching
pane_idOption<(u32, bool)>Pane to focus: (id, is_plugin)
layoutOption<LayoutInfo>Layout to apply when creating a new session
cwdOption<PathBuf>Working directory for the new session

Action

The Action enum represents all possible Zellij actions that can be triggered programmatically via run_action. The full enum has many variants; the most commonly used ones are listed below:

VariantDescription
QuitQuit Zellij
Write { bytes, .. }Write bytes to the focused pane
WriteChars { chars }Write characters to the focused pane
SwitchToMode { input_mode }Switch input mode
Resize { resize, direction }Resize the focused pane
MoveFocus { direction }Move focus in a direction
NewPane { direction, .. }Open a new pane
NewTab { .. }Open a new tab
GoToNextTabSwitch to the next tab
GoToPreviousTabSwitch to the previous tab
GoToTab { index }Switch to a tab by index
CloseTabClose the focused tab
CloseFocusClose the focused pane
ToggleFocusFullscreenToggle focused pane fullscreen
ToggleFloatingPanesToggle floating panes visibility
DetachDetach from the session
CopyCopy selected text
PreviousSwapLayoutSwitch to previous swap layout
NextSwapLayoutSwitch to next swap layout
LaunchOrFocusPlugin { plugin, .. }Launch or focus a plugin
RenameSession { name }Rename the current session

For the complete list, see the source code.


EventType

Discriminant enum used with subscribe and unsubscribe. Each variant corresponds to an Event variant of the same name.

#![allow(unused)]
fn main() {
pub enum EventType {
    ModeUpdate,
    TabUpdate,
    PaneUpdate,
    Key,
    Mouse,
    Timer,
    CopyToClipboard,
    SystemClipboardFailure,
    InputReceived,
    Visible,
    CustomMessage,
    FileSystemCreate,
    FileSystemRead,
    FileSystemUpdate,
    FileSystemDelete,
    PermissionRequestResult,
    SessionUpdate,
    RunCommandResult,
    WebRequestResult,
    CommandPaneOpened,
    CommandPaneExited,
    PaneClosed,
    EditPaneOpened,
    EditPaneExited,
    CommandPaneReRun,
    FailedToWriteConfigToDisk,
    ListClients,
    HostFolderChanged,
    FailedToChangeHostFolder,
    PastedText,
    ConfigWasWrittenToDisk,
    WebServerStatus,
    FailedToStartWebServer,
    BeforeClose,
    InterceptedKeyPress,
    UserAction,
    PaneRenderReport,
    PaneRenderReportWithAnsi,
    ActionComplete,
    CwdChanged,
    AvailableLayoutInfo,
    PluginConfigurationChanged,
    HighlightClicked,
}
}

See Events for details on each event and its payload.