You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,43 @@ Note: `SessionInfo` from `zellij-tile` has many required fields. See `manager.rs
98
98
## CI
99
99
100
100
GitHub Actions workflow (`.github/workflows/ci.yml`) runs on PRs and pushes to main:
101
-
-`test` - Runs unit tests on native target
101
+
-`test` - Runs unit tests on native target (must explicitly specify `--target x86_64-unknown-linux-gnu` because `.cargo/config.toml` defaults to wasm32-wasip1)
102
102
-`build-wasm` - Verifies WASM compilation
103
103
-`clippy` - Lints with `-D warnings`
104
104
-`fmt` - Checks formatting
105
+
106
+
## WASM Sandbox Limitations
107
+
108
+
Zellij plugins run in a WASI sandbox with restricted filesystem access:
109
+
110
+
-**Cannot directly write to real filesystem** - `std::fs::write()` writes to a sandboxed virtual filesystem
**Each Zellij session has its own plugin instance** with separate state:
124
+
- Switching from session A to B means interacting with B's plugin instance
125
+
- State does not transfer between sessions automatically
126
+
- To share state, must use external storage (files via `run_command`)
127
+
128
+
**Plugin reloading**:
129
+
-`zellij action start-or-reload-plugin "file:/path/to/plugin.wasm"` - Reloads in current session only
130
+
- Must reload separately in each session, or close/reopen the plugin pane
131
+
- Closing the pane (not just hiding) and reopening loads the new binary
132
+
133
+
## Quick-Switch Feature
134
+
135
+
The plugin supports quick-switching to the previous session:
136
+
- When switching sessions, writes current session name to `/tmp/zsm-previous-session` via `run_command`
137
+
- When plugin opens, reads that file and pre-selects the previous session
138
+
- Press Enter to instantly toggle back
139
+
140
+
Implementation in `state.rs`: `write_previous_session()` and `request_previous_session_read()` use async `run_command` because direct filesystem access is sandboxed.
0 commit comments