Develop Zellij plugins with Rust/WASM, API reference, event system, UI rendering, plugin lifecycle, and real-world examples from diverse open source plugins
Comprehensive assistance for developing Zellij terminal multiplexer plugins using Rust and WebAssembly.
Trigger this skill when:
use zellij_tile::prelude::*;
#[derive(Default)]
struct State {
// Your plugin state
}
impl ZellijPlugin for State {
fn load(&mut self, configuration: BTreeMap<String, String>) {
request_permission(&[PermissionType::ReadApplicationState]);
subscribe(&[EventType::Key, EventType::PaneUpdate]);
}
fn update(&mut self, event: Event) -> bool {
// Handle events, return true to re-render
false
}
fn render(&mut self, rows: usize, cols: usize) {
// Render UI
}
}
# Add WASM target
rustup target add wasm32-wasip1
# Build
cargo build --release
# Location: target/wasm32-wasip1/release/<PLUGIN_NAME>.wasm
On big-chungus,
cargo buildwill fail withcan't find crate for core./usr/bin/rustcprecedes rustup onPATHand carries nowasm32-wasip1std. The error reads exactly like a missing target, sorustup target addlooks like the fix and does nothing — the target is installed. PinRUSTCinstead:T=~/.rustup/toolchains/1.95.0-x86_64-unknown-linux-gnu RUSTC="$T/bin/rustc" "$T/bin/cargo" build --release --target wasm32-wasip1Related:
rustc --print sysrootreturns empty whenRUSTUP_TOOLCHAINis set, which sends the diagnosis further astray.
Do not rebuild a plugin just because zellij was upgraded. There is no plugin API version gate in 0.44.3 — a plugin built against zellij-tile 0.41.1 loads fine. The only cost of an old build is cosmetic (pre-0.43 knows
Style.palettebut notStyle.styling, so 16-colour approximation). See thezellij-workspace-opsskill.
# Temporary load
zellij plugin -- file://<PATH_TO_FILE>
# Floating
zellij plugin --floating -- file://<PATH>
# With configuration
zellij plugin -- file://<PATH> --configuration key=value
Use the official scaffolding tool:
zellij plugin -f -- https://github.com/zellij-org/create-rust-plugin/releases/latest/download/create-rust-plugin.wasm
This launches develop-rust-plugin for real-time iteration (Ctrl+Shift+R to rebuild).
Load Phase:
Update Phase:
Render Phase:
Local Testing:
zellij plugin -- file:./target/wasm32-wasip1/release/plugin.wasm
Release:
cargo build --release
# Share via awesome-zellij repository
bind "Ctrl t" {
LaunchOrFocusPlugin "file:path/to/plugin.wasm" {
floating true
}
}
let context = BTreeMap::from([
("operation".to_string(), "git_status".to_string())
]);
run_command(vec!["git", "status"], context);
// Handle result
Event::RunCommandResult(exit_code, stdout, stderr, context) => {
if context.get("operation") == Some(&"git_status".to_string()) {
self.process_result(stdout);
}
}
plugin location="path/to/plugin.wasm" {
format_left "{widget1} {widget2}"
format_right "{widget3}"
widget1_param1 "value"
widget1_param2 "value"
}
fn load(&mut self, _config: BTreeMap<String, String>) {
subscribe(&[EventType::PaneUpdate]);
}
fn update(&mut self, event: Event) -> bool {
match event {
Event::PaneUpdate(panes) => {
self.sync_pane_state(panes);
true
}
_ => false
}
}
Read-Only:
ReadApplicationState - Access mode, tabs, panes, sessionsWrite Operations:
ChangeApplicationState - Modify panes, tabs, navigationOpenFiles - Open files in $EDITOROpenTerminalsOrPlugins - Create terminal/plugin panesWriteToStdin - Write to pane stdinAdvanced:
RunCommands - Execute background commandsReconfigure - Modify configurationWebAccess - HTTP requestsFullHdAccess - Host filesystem accessStart with plugin-development-tutorial.md for foundational concepts and step-by-step guidance.
plugin-examples-ui-navigation.mdplugin-examples-status-theming.mdplugin-examples-external-integration.mdplugin-api-commands.mdplugin-api-events.mdEach example file contains real-world patterns extracted from production plugins.
Build configurable, composable UI components (see zjstatus example).
Spawn and manage long-running processes (see zj-docker example).
Coordinate multiple plugins via message passing.
load() phasereferences/
├── plugin-development-tutorial.md # Complete tutorial
├── plugin-api-commands.md # API reference
├── plugin-api-events.md # Event system
├── plugin-examples-ui-navigation.md # UI patterns
├── plugin-examples-status-theming.md # Configuration & theming
└── plugin-examples-external-integration.md # External systems
scripts/
# Helper scripts for development automation
assets/
# Templates, boilerplate, example projects
To refresh this skill with updated documentation: