[~] BACK



~~ ZELLIJ ~~

** THE FUTURE IS TERMINAL **

[PRO] | [20250321] | [0] | [0x17]






The server portfolio of nerds is usually n=n+1, and that's without a GUI and only with a command line. Nobody wants a window manager on a server. Unfortunately, the whole thing also presents a few difficulties. The auto-disconnect if you don't do anything in the terminal for a while, the confusion that arises when you have multiple terminal windows open (everyone has issued the wrong command on the wrong server at some point), and so on. In the natural habitat of hackers (at least in German-speaking countries), you quickly end up at Leyrer and one of the talks about tmux. That's how I got hooked on so-called terminal multiplexers. TMUX is great, but it seems a bit outdated after a while. Don't get me wrong, TMUX is great, but you also like to think outside the box and here ZELLIJ caught my eye.

0x01 - OVERVIEW


ZELLIJ describes itself as a terminal workspace with batteries included and doesn't overpromise (and the claim "the future is terminal" convinced me, too). I've optimized my workflow about 90% for terminal, including tiling wm, NixVim as the editor, a highly configured ZSH shell, and various terminal tools. The only thing that has bothered me so far is the lack of clarity, which suffers somewhat when you have multiple terminal windows open. Sure, there are workspaces, but even that can quickly become confusing. This is where terminal multiplexers come into play. These are complete terminal environments in which it's possible to open different terminal sessions or group them into tabs, but also to keep sessions open even when the user is logged out of the server. Especially if you start lengthy processes on a server and let them run and run into autodisconnect, you have the option to log in to the system and reconnect the session, thus not losing any output.
ZELLIJ also makes sense locally. This way, you can build a workspace for all your social stuff like Mastodo, mail, etc., or even one for development with terminal, nvim, and documentation files. Your imagination is the limit here.

0x02 - INSTALLATION


Thanks to diligent contributors, ZELLIJ is in the Nix packages and, as always, goes into the configuration.nix file (or wherever you declare your tools):

CONFIGURATION.NIX
    environment.systemPackages = with pkgs; [
     zellij 
    ];
  

Of course, ZELLIJ can also be found in other packet managers. Just search for it in yours or visit the tool's website (here). Once the installation is complete, ZELLIJ can be started with the same command. However, this will then start a default session with a random name. We'll change that later. ZELLIJ is configured via the config file, which is created by default in /.config/zellij/. What would be great here, of course, is a configuration directly in the nix file, like with nvim or similar. But the basic configuration is already possible, and for now, we'll include the configuration in the dot files.

0x03 - CONFIGURATION


As mentioned above, the configuration runs via a single config file (config.kdl). This contains keybindings, the theme used, plugins to be loaded in a new session, the default shell to be used, scroll buffer size, various paths for layouts, plugins, and much more.

First things first, of course – we want Dracula as a theme in ZELLIJ. To do this, we create a folder called themes - if it doesn't already exist - and place our dracula.kdl file there. There's already an entry for this in the config. All we need to do here is remove the comments and define Dracula as the theme:

CONFIG.KDL
    theme "dracula"
  

Next, we want to have our ZSH as the default shell so that everything continues to work as usual:

CONFIG.KDL
    default_shell "zsh"
  

What also makes sense are the following two parameters:

CONFIG.KDL
    session_name "LOCAL"
    attach_to_session true
  

The first parameter defines the session name when ZELLIJ is started without flags. If this option is not set, ZELLIJ starts with a random session name – which, while quite nicely chosen, isn't particularly helpful in identifying the session, so my session is named "LOCAL." If you now start ZELLIJ, the session is automatically named "LOCAL." If we were to close ZELLIJ and restart it, ZELLIJ would complain that a session with that name already exists and terminate. This is where the second parameter comes into play. It tells ZELLIJ to rejoin the session instead of creating a new one.
That's enough to dive into ZELLIJ and play around with it. Since the config file is quite extensive, I'll post the second part with the config hacks soon. But for now, let's move on to usage.

0x04 - USAGE


If we now start ZELLIJ, we see a workspace with status bars, the name Local, and everything in the Dracula theme (I had to modify something here because the white tabs in the lower status bar were burning my eyes out. Maybe I'll put that in a PR sometime) – a wonderful starting point. ZELLIJ works with two status bars. The lower one lists the shortcuts that can be accessed with CTRL and ALT, and the upper status bar shows the tool name, the session name, and the tabs open in the session. In direct comparison to TMUX, ZELLIJ appears a bit more "colorful."


In my opinion, the whole thing is still simple enough not to be too intrusive.
The upper status bar serves purely as an overview and organization of the tabs, while the lower one functions as a menu for operation. In contrast to TMUX, you are given direct access to ZELLIJ controls, making it significantly easier to use the tool without having to learn new keybindings. This is particularly helpful for beginners. The commands are divided into two categories – CTRL and ALT.
The commands that are operated with ALT are the following:

ALT
    ALT + n  -- new pane
    ALT + cursor -- change focus
    ALT + f  -- floating
  

So, if we want to spawn a new terminal window within a tab, a simple ALT + n is enough, and a new terminal appears. The original terminal window is treated as the master, and additional panes are created next to or below it. To switch between the individual panes, use ALT + Cursor. In my opinion, the whole thing is still simple enough not to be too intrusive.
The upper status bar serves purely as an overview and organization of the tabs, while the lower one functions as a menu for operation. In contrast to TMUX, you get direct access to ZELLIJ controls, making it significantly easier to use the tool without having to learn new keybindings. This is particularly helpful for beginners. The commands are divided into two categories: CTRL and ALT.
The commands that are operated with ALT are the following: or or alternatively ALT + hjkl. If you only need a terminal for a short time, for example, to test scripts or quickly look something up, you can use ALT + f to create a floating terminal in the middle of the screen that sits above all other panes.


Things get a bit more complex with the CTRL commands; these serve as a menu for controlling ZELLIJ.

CTRL
    CTRL + g  -- LOCK
    CTRL + p  -- PANE
    CTRL + t  -- TAB
    CTRL + n  -- RESIZE
    CTRL + h  -- MOVE
    CTRL + s  -- SEARCH
    CTRL + o  -- SESSION
    CTRL + q  -- QUIT
  

The first in the list is the LOCK command. This locks the interface and keybindings of ZELLIJ. What's the point? It's quite simple. Some ZELLIJ keybindings overlap with those of other tools. A small example: In NixVim, I have the keybinding CTRL + hjkl to switch between different buffers. However, in ZELLIJ, CTRL + h is the MOVE command. Since ZELLIJ is now one level above the started NVIM, the ZELLIJ command is executed, not the NVIM keybinding. With LOCK we can now deactivate all ZELLIJ keybindings and use NVIM as usual. The menu items Pane and Tab contain the options available for the panes and tabs. Create new, resize, close, change focus, etc. Under the menu item RESIZE you will find quick access to the size options for the individual panes. Here you can change the size with +/- or change the window size in the respective direction with UP/DOWN/LEFT/RIGHT or HJKL. If you don't like the arrangement of the windows, you can change it with the MOVE option.
The next item on our list is SEARCH. This allows you to search for keywords within the panes. The penultimate item is SESSION. This offers complete management of both active and inactive sessions, which makes ZELLIJ so convenient. The following options are available under SESSION:

SESSION
    d  -- DETACH
    w  -- SESSION MANAGER
    c  -- CONFIGURE
    p  -- PLUGIN MANAGER
  

DETACH detaches you from the current session and exits ZELLIJ.
Things get more exciting with the SESSION MANAGER. Here, you'll find a floating window that offers you three options: you can either start a new session, connect to an existing session, or revive an old one, all completely straightforward and without any terminal magic. With CONFIGURE, you have a simple configuration menu in which you can specify the LEADER keys and the MODE behavior—i.e., whether you want to start in LOCK mode or whether you want all shortcuts activated directly upon startup.
For now, I'll leave the LEADER keys at ALT and CTRL, as this would otherwise conflict with XMonad. Last but not least, the PLUGIN MANAGER. This organizes your plugins and reloads them, or defines the paths to them. Once you've had enough playing around with ZELLIJ, you can close everything with CTRL + q.

0x04 - CONCLUSION


TMUX is a wonderful terminal multiplexer, but very complex and unhelpful for beginners. ZELLIJ offers a significantly lower hurdle here thanks to its self-explanatory menu and clarity. So, if you're looking to learn fewer new shortcuts but still want to work smoothly with a terminal multiplexer, you should definitely check out ZELLIJ. It's definitely becoming part of my daily workflow now, and I'll also distribute it to the servers so I have it available there. The roadmap for ZELLIJ also promises a lot. For example, server/client integration and SSH plugin integration are planned, and that could be really good.

Have fun with it!
[~] BACK