Arrange your windows with boxes

Here's a situation you'll run into sooner or later. You're working on something, and you want your editor on one half of the screen. On the other half you want a log, your test runner and a spare shell, but you only need to look at one of them at a time.

A workspace can't quite do that. In a grid every window gets its own slice, so those three end up small. In tabs you only see one window at a time, so the editor disappears whenever you check the log. What you want is two layouts at once: side by side on the outside, tabs on the inside.

That's what a box is for. A box holds windows and has a layout of its own, so one part of your screen can be arranged one way and another part another way. Here's what we're going to build:

A terminal named editor fills the left half of the screen. The right half shows three tabs named logs, tests and shell, with shell in front.
One workspace with two layouts: an editor on the left, and three tabs on the right.

Boxes are the trickiest idea in Tessera, so we'll take this slowly. Press the keys as you read, because they make a lot more sense in your hands than they do on the page. If you get lost, nothing bad can happen: boxes only arrange your windows, and none of the keys we'll use to build this one will close anything.

You've already been using one

Remember the little label from your first windows, the one that said BOX: grid · 4 windows? I said we'd come back to it. Your workspace is a box! It's the outermost one, every workspace has one, and that's why a workspace has a layout that Mod+t can change.

So you already know how a box behaves. All we're going to do now is put smaller boxes inside that one.

Set the scene

Go to a workspace you haven't used yet, such as the one on Mod+4. Open a terminal with Mod+Shift+Return and type echo editor, so you can tell it apart from the others. Open a second terminal and type echo logs.

They start out as tabs, so press Mod+t three times on a new workspace to choose row. Now your two terminals sit side by side, with logs focused on the right.

Make a box

Press Mod+Shift+i. That's called wrapping: you've just wrapped logs in a new box.

Two terminals side by side. Diagonal stripes cover only the right one, logs, and a label over it reads BOX: tabbed, 1 window, and below that 1, row, tabbed.
logs in a box of its own. The stripes show you exactly how much of the screen the box covers.

Nothing moved, and that's how it's supposed to be. The box fits snugly around the window, so the only thing you can see is the stripes. They mean you've selected the whole box rather than one window in it. Your terminal hasn't gone anywhere, and it's still running underneath.

The label tells you what you've got. BOX: tabbed · 1 window describes this box: it uses the tabbed layout and holds one window. The line below it, 1 > row > tabbed, is how you get there from the outside: workspace 1 (yours will show whichever one you're on), whose row holds this tabbed box.

These stripes stay until you go back to a window, which is different from the quick flash you get from Mod+t. A flash just says "that changed." These say "this is what your next command will act on."

Put something in it

Press Mod+Shift+Return and type echo tests.

The editor terminal still fills the left half. The right half now has two tabs, logs and tests, with tests in front.
The new terminal opened inside the box, as a tab beside logs. The left half didn't move.

You had the box selected, so the new terminal opened inside it. Now look at your screen: tabs on the right, and editor still has the whole left half. That's two layouts on one screen!

Open one more terminal and type echo shell. That's the screen from the top of this page, and it only took you one new key.

Find your way around

Press Mod+h a few times. From shell, you move left through tests and logs. Press it once more and you reach editor, outside the box.

The direction keys try nearby siblings, the things that share a box, first. When you reach its edge, Tessera looks outside it for a neighbor in that direction. It helps to picture your screen as a tree:

workspace (row)
├── editor
└── box (tabbed)
    ├── logs
    ├── tests
    └── shell

logs, tests and shell are siblings. editor is a sibling of their box, one level up. Tessera climbs that level when there's no tab farther left. At the workspace edge, another Mod+h leaves you on editor.

Press Mod+l to return. You land on logs, the tab you last used, and can type right away. Tessera remembers a child in each box, so this also works through several nested levels. If a box hasn't been visited, you enter through its nearest edge. Press Mod+l once more to focus tests, then press Mod+o. The O is for out: it selects the whole box explicitly.

Stripes cover the right half of the screen, tabs included. The label reads BOX: tabbed, 3 windows, and below that 1, row, tabbed. The editor on the left has no stripes.
Mod+o moves out one level. Now the whole box is selected, tabs and all.

The stripes are back, and you're now at the level where editor and the box are siblings. Directions from a selected box move at that level, climbing outward at its edge. Press Mod+i to enter its remembered direct child, tests. The I is for in. An explicit inward command always moves just one level.

The stripes disappear as soon as you reach the window. You can start typing right away. The stripes identify a selected box; when navigation lands on a window, that window takes the keyboard back.

Tabbed boxes use left and right to move among tabs, and stacked boxes use up and down. A key across that axis looks outside the box. Grid boxes use the positions you see on the screen. Each follows the same rule at its edge.

Mod+o selects one parent, Mod+i enters one child, and the direction keys let you reach neighboring windows without selecting their boxes first. Try moving between editor and the tabs, then stop on tests for the next part.

Two more things will save you some trouble. While a box is selected, no program has the keyboard. If you forget and start typing, you don't lose anything: your first key goes to the window you were last using in that box, and the stripes go away. And if you only want to jump back to the window you were just using, Mod+Tab does that from anywhere on the workspace, box or no box.

Give the box its own layout

You're on tests, inside the box. Press Mod+t four times: grid, stacked, row, then column.

The editor terminal still fills the left half. On the right, logs, tests and shell are stacked in three rows, all visible at once.
Only the box changed. editor still has the whole left half.

Mod+t changes the layout of the box around whatever you have selected, and only that box. Everything outside it stays exactly where it was. This is what a box gets you: you can rearrange one part of your screen without disturbing the rest.

The bar keeps the workspace's row icon and adds a breadcrumb for the box you're using. Its smaller icons show the layouts along that path, even after the selection label fades. To change the workspace's own layout from in here, press Mod+o until the stripes cover everything, then press Mod+t.

We want tabs again for the next part, so press Mod+t three more times: dwindle, tile, and back around to tabbed.

Where to next

You just learned the two ideas that matter most: every box has its own layout, and you move between levels with Mod+o and Mod+i. Leave your windows as they are, because we'll keep using them while we move windows between boxes.