Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Zellij New WASM Plugin System (zellij.dev)
185 points by sbt567 on June 27, 2023 | hide | past | favorite | 68 comments


Because it's not immediately obvious, Zellij is a terminal multiplexer like tmux or GNU screen, whose distinguishing feature is that it comes with more built-in functionality, has a more discoverable UI, and a more opinionated/modern default configuration while still being highly customizable (as demonstrated in the OP).

https://github.com/zellij-org/zellij


HOT DAMN! Over the last few weeks I've wished almost daily I was proficient in tmux, but it's annoying to get started in because you have to look up EVERYTHING. I just tried Zellij (they have a "try without installing" command on their website) and it's exactly what I wanted Termux to be. Thank you so much for this comment!


Indeed, for someone new to terminal multiplexing, its the superior UX, its just missing some advanced things tmux does, but which are being worked on


Would you mind giving an example of what you're thinking of?


Too bad it isn't a drop in replacement for tmux because of memory usage. There are memory leaks and even without that the base memory uses is a couple hundred megabytes. Tmux on the other hand, consumes only tens of megabytes of memory.


Hey, there are no memory leaks that I'm aware of (there were a few, but we plugged them in recent months). If you know differently, I'd appreciate an issue report.


If you run e.g. btop or bpytop in a separate zellij tab, zellij will eventually gobble up all your memory and die.

In the beginning I wa very entusiastic and switched from tmux to zellij on remote machines, but as I usually have btop running in a tab it would die in a day or two, so now I'm back to using tmux on remote machines and reserve zellij for local (and make sure I don't run btop in a tab).


(Does HN have an indentation limit, I can't seem to reply to imsnif…)

I'm always running the latest zellij, but I'll start btop in a tab right away and see what happens.

I did mention it in https://github.com/zellij-org/zellij/issues/1625#issuecommen... and noticed the issue is still open, so I haven't tried btop in zellij since v0.36.0.


Keeping track is hard sometimes, I saw it again in the issue as you mentioned. :)


I'm like 90% sure this was fixed - if you'd be willing to try with a recent Zellij version, that would be great.

Otherwise, I'll try your reproduction myself and will fix if I can reproduce. Thanks.


I'm now running v0.37.2 on a remote machine with 3 tabs: a shell, syslog spooled by lnav, and btop. To me it looks like it grows by 2 kB RAM every minute. I am logging to a file with timestamps, and we will see the results tomorrow.


In the course of less than 12 hours zellij grew from 93 MB to 1227 MB in roughly 2 kB increments per minute. Closing the tab running btop will release the stolen memory.

I will append a comment to the Microsoft GitHub issue mentioned above a little later.


Thanks! If you could also specify how you measured it and attach some debug logs (there are instructions in the issue template) that would be great. Because my instance has run overnight without issue and I'd love to be able to reproduce this.


I entered a comment ( https://github.com/zellij-org/zellij/issues/1625#issuecommen... ) before I read your comment here. Please let me know if that is sufficient.


Yeah, and it does flicker a bit etc.

But I still use it all the time now — I found it so much easier to get up to speed with relative to tmux. And it's getting better all the time, so I'm happy to invest in it...


Leaks like crazy on macOS.

For WebAssembly plugins, I also wish they used Extism, which is kinda the de facto standard for this.


Yeah and sudden unexplained crashed made me stop using


I just tried it out and it apparently highjacks normal command-line editing shortcuts like ctrl-n, ctrl-p, ctrl-h, etc.


Its not tmux, are you sure you're engaging its binding which enables/disables its binding map, I belive Ctrl+G IIRC, unlike tmux which prefixes its bindings with a customizable chord


I see that now, but then you can’t use the buffer navigation hotkeys. I’ll just stick with tmux.


With no support for Windows


Works great in WSL in windows terminal....


Hijacking this for a question I've been wondering about. For context, I'm a long-time tmux user who spends 90% of my time in remote shells.

Ideally, I'd have my WM handle panes, layouts, etc. "Terminal multiplexing" seems to me to be misplacing client/UI concerns. Session persistence is the concern of the server, and multiplexing should be handled by ssh. However, getting the client terminals to coordinate nicely (e.g. reattaching to the appropriate sessions, opening new terminals in the same remote working directory) require more sophisticated clients than exist currently (to my knowledge).

Does anyone feel similarly? Anyone have a setup that approximates what I'm looking for?


Emacs. Runs as a server, stays alive when clients drop. Window management on keyboard. Tramp mode is great. But I'm sure you've heard this already :)


Iterm2 has tmux control mode support that enables somewhat native ui: https://iterm2.com/documentation-tmux-integration.html

There is also wezterm with its own mux server implementation: https://wezfurlong.org/wezterm/multiplexing.html


I'm using resurrect tmux plugin configured to rerun ssh commands, it's not perfect as it's not restoring remote session, but at least you have session open to right host in pane that you expect with scroll history.


Mosh is an amazing tool - https://mosh.org/

Does exactly what you describe with a minimum of fuss.


`wezterm ssh` uses ssh the way you describe it.

It does not offer persistence by itself, but iirc there are server components in wezterm which might give you reattach able sessions.


Awesome! I will be sold forever when something similar to tmux ressurect is available.

Also I want to point out the way this is being handled in GH issue 575.

It's taking time, but the politeness of many people, specially @imsnif is out of this world.

This will be killer and it's ready, because one can freely create the tabs and panes designs while working, then dumping and customizing more later.

I'm learning rust myself now, and projects and people like this encourages me even more. (Even with the rust foundation issues that happened)

Thanks all!


I was checking it like a year ago and it was cool but lacked some functionalities that i relied on daily basis (in comparison with tmux). I'm sure that some of those could be already implemented but plugins could probably fulfill rest of those.

For sure i see need for some kind of plugin "package manager" here. on one hand this would help with discoverability of plugins, but more importantly with updates. checking each of plugin every so often isn't convinient and in such systems i usually check once or twice a year if there is any update.


Big fan of Zellij!

Here are my configs for anyone interested — more modal than the default: https://gist.github.com/max-sixty/6be7225ddc0a9cecb7203d5f7f...


It seems odd to distinguish between a plugin and a program running in a terminal pane. This seems to imply you must reimplement all such functionality as a new plugin, instead of just running your preferred tool, as usual, in a terminal window.

For example, they have implemented a file explorer as a plugin. But this means you can only use it when Zellij is available, and not as a standard tool on another system. This reduces flexibility and means you need different tools in different contexts.

I'd love to be corrected, but I can't think of any good reason why a special file explorer needs to exist, just to be coded to this plugin standard, instead of as a normal terminal program.


Good question!

A few reasons:

1. Ease of distribution - distributing a precompiled wasm blob is immensely easier than distributing an application

2. Sandboxing - both on the fs level and regarding special permissions, which brings us to

3. Stronger capabilities - you can use the terminal workspace around you by manipulating panes, tabs and other plugins, creating a workspace experience rather than a single app

4. More knowledge about the application - want to trigger when the user enters a certain folder? When a certain pane is focused? When certain text appears on screen?

5. Composability - integrate with other plugins to render a dashboard-like experience rather than a single app that a user needs to manually compose

While some of these are also achievable with native apps, I have found that if you give users (developers in this case) opinionated defaults that make integration easier - you'll get more people building more interesting things. Even if they technically can implement them all on their own.


> 1. Ease of distribution - distributing a precompiled wasm blob is immensely easier than distributing an application

The precompiled WASM blob could be the (console) application (which runs in e.g. Deno/Node or Wasmedge/Wasmtime/...).


Maybe you're focusing too closely on the specific example. It's interesting to me in the large for sure.

For one, since plugin permissions seem to be on the roadmap, users can expect to be able to write and run third-party code with a bit more confidence than if it were just another unix process.

Looking further down the line, imagine a pluggable web/native frontend for Zellij. At its most basic level of operation, it would still serve as a full terminal multiplexer, but it would also have the potential to do anything the containing runtime supports (render images, play video, render rich inputs/controls).

I wasn't imagining this before, but I kind of am now...


I tried Zellij a while ago (year+?) and wasn’t a huge fan. After some major updates I tried it again and it’s become my daily driver.

Great application and I’m looking forward to seeing the plugin ecosystem grow. Thanks to the maintainers and contributors for their work.


It looks pretty cool. Is there a plugin that is just "convert this program into a plugin"? i.e. say I'm doing some networking set up and I want to check whether what I'm doing is improving or reducing effective performance. I would like:

1. One pane with my UDP benchmark between two of my machines

2. One pane with my UDP benchmark between two other machines

3. One pane which is a normal terminal where I'm going to make my changes

So what I'd do is make my changes in normal terminal, then switch over to #1 and hit Enter and it runs, then switch over to #2 and it runs. I don't want to write a specific plugin for my UDP benchmark tool. I want a plugin that takes a pre-baked command (with flags and arguments) and turns it into a pane that I can just switch to and hit Enter.

Honestly, I currently use a tiling terminal emulator (iTerm2) and it's not bad, but I have to hit Up+Enter and then that's overlapping with the history of whatever shell is on that machine.


Hi, Zellij has this feature. Please check out command panes: https://zellij.dev/documentation/zellij-run.html

You can either open them through the cli with "zellij run -- <your command>" when inside a zellij session, or set them up in a layout so it opens all of the ones you want in a new tab arranged the way you like.


Absolutely perfect, mate. Thank you.


Sure thing! Btw, plugins can also open these command panes, this is how the multitask "mini-ci" plugin works.


More interested in when they'll implement concurrent, switchable sessions, one of the main reasons one would continue to use tmux, but this is nice development


Very soon! We want to implement it as a default plugin and wanted to release this system first.


What do you mean by concurrent, switchable sessions? Googling those terms didn't show me anything that (in my limited knowledge) tmux has that Zellij doesn't


And for those who are tmux users, zellij can be configured to be more space efficient, ie reduce borders to a single line. There are even tmux bindings.

I've since grown fond of zellij's locked mode which hides all keybindings behind a Ctrl+G toggle. That behaves more like vim modes than the awkward Ctrl+B in tmux.


Is it possible to remove the session name and the text that says „zellij“? They take up too much space.


The session name yes, the branding no. You can create a custom plugin though instead of the built-in UI ones and render whatever you like...


100% Agree. Unfortunately no. They say it's a way to promote their small project.


If it's bothersome, building a custom copy of the project looks to be as simple as `git clone` and `cargo build`.


locked mode is my fav as well. I used it to re-make a DoomEmacs-like workspace with helix.


This looks cool, I’ll use it as an excuse to try zellij & writing some wasm.


Very cool! As a wasm fan, I'm excited to see this and really appreciate the detailed write-up. As a maintainer of Extism[0] (a wasm plugin system framework) I'm curious if our project came up in your research for this, and if so, what is missing or kept you from considering it as a solution?

https://github.com/extism/extism


I'm pretty sure our plugin system predates your project (it's been around since before our beta was released in 2021, we've just given it the attention it deserved right now).

I'd definitely have wanted to outsource this though if we didn't have the infrastructure in place already. Extism seems solid.


Ah you are right indeed! Well, great minds think alike then I'd say ;) Love zellij, fantastic work.


Why do terminal applications need a WASM runtime? I feel like I'm not really understanding something fundamental about WASM.


I do understand why people try this approach:

First: wasm is the perfect plug-in language, as it provides a high level of isolation and therefore security for the host app.

Second: the promise of wasm is that you can write it in any language. I think this is compelling for any application that seeks for extensibility.

Wether all this is worth the effort is probably the actual question. Maybe we will be surprised by killer plugins that wouldn’t be possible with regular plug-in systems…


> Maybe we will be surprised by killer plugins that wouldn’t be possible with regular plug-in systems…

It's less "this wouldn't be possible" and more the fact that the existence of plugins that are sandboxed and access-permissioned makes me far more likely to seek out and install plugins in the first place, since it lowers the trust barrier. It's the same reason why I browse random websites freely while also being loathe to install random binaries on my computer. Being language-agnostic is just icing on the cake.


You might be missing the fact that WASM nowadays doesn't necessarily have anything to do with web browsers. It was initially designed for running in web browsers, but in the last few years there's been a lot of activity surrounding embedding WASM runtimes in processes other than web browsers. Mostly the idea is for it to be a way to execute untrusted / customer code (e.g. "plugins") with sophisticated sandboxing, etc.


Wasm has the promise to be a single target for your plugins that could be written in node/rust/python and the consumer won't have to have that specific version of python installed. That and the possibility to sandbox a plugin so my repl function can't also upload my ssh keys would be nice.

WASM doesn't mean this has to be true, but it could be.


It's both dynamically loadable & doesn't require any external dependencies. Each WASM container has its own heap, so you don't need e.g. glibc versions to be the same, which is otherwise a PITA for plugins.


Terminal is just UI. It’s completely orthogonal to WASM.


It's great to see more use cases of Wasmer [1] out there. I'm excited for what's coming next on this front :)

[1] https://wasmer.io/


what's coming next is replacing wasmer with wasmtime [1], the runtime closely following wasm and implemented by the same people designing the standard itself.

[1] https://wasmtime.dev/


While that's not true, since the Wasm spec is designed mainly by the browsers, I appreciate the hustle-trolling haha

In any case I wonder what's the need for try to push Wasmer down. Here are your previous comments, all hateful against Wasmer on different announcements:

1. https://news.ycombinator.com/item?id=36128284 (on WASIX launch)

2. https://news.ycombinator.com/item?id=33835683 (on WAI bindings)

Honest question: are you related to the Bytecode Alliance at all? (I saw a comment from you in HN promoting a company from that alliance)


Is Zellij in the same realm / in competition with Warp terminal?

https://www.warp.dev/


Zellij has had a plugin system for more than a year, but I haven't seen ... more than two-three plugins in total?


The system was unstable - it's gotten a major overhaul, already seen a few people writing plug-ins using the new system.


Starting to look like a text based window manager from the early 80s.


Does this use Extism?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: