Whetstone.
LayoutsKDL basics
Module 7 · Lesson 112 min

KDL basics

A layout is a text file that describes an arrangement of panes and tabs. They’re written in KDL, a small, readable config language. A layout is just nested pane and tab nodes, with a split_direction where you want to control how children divide the space.

A minimal layout
layout {
    pane
    pane split_direction="vertical" {
        pane
        pane command="htop"
    }
}

Read that top to bottom: one pane, then a vertically-split region holding two panes, the second of which runs htop on load. A pane with a command starts that program instead of a bare shell. Tabs work the same way, one level up.

Two tabs, each split
layout {
    tab split_direction="vertical" {
        pane
        pane
    }
    tab {
        pane
        pane
    }
}
Practice

Try it yourself

Do

Write and load a layout

Create a small layout file and boot a session from it.

  • Save a file dev.kdl with a layout block: one wide pane on top, two panes split below it
  • Run zellij --layout ./dev.kdl
  • Confirm the session opens with your arrangement instead of a single pane
Done whenZellij started with the panes arranged the way your KDL described.
Check

A pane that runs a command

Add a command-driven pane and confirm it launches on load.

You should see

A pane command="htop" (or any installed command) in your layout starts that program automatically when the session opens, instead of an empty shell.

Sign in to track your progress →