Floating panes and popups
On this page
macOS · Since 1.5 · [keys], [app] restore-scrollback
A floating pane floats over a tab's splits, in a box with its title at the top, such as a scratch shell that you show and hide with a key. A popup is a floating pane in the middle of the tab that runs one command, such as lazygit or fzf, and closes when the command ends.
Try it
Press ⇧⌥⌘F and run top. Press ⌥⌘F to hide it, and ⌥⌘F again: top is still running. Drag the box by its title, then drag one of its corners to resize it.
Then bind a popup. Add this to your config and save it:
[keys]
"ctrl+cmd+o" = { command = "pane.popup", args = { command = "fzf", width = 0.6, height = 0.5 } }
Press ⌃⌘O: fzf opens in the middle of the tab. Press Escape: the popup closes.
What it gives you
- A pane over your splits, which leaves their sizes as they are.
- Several in a tab, shown and hidden together with one key.
- The mouse moves a floating pane by its title and resizes it by its edges and corners.
- Popups that run a command of your keys and close when it ends, or stay to show its error.
- Floating panes that come back with their tab when Lokyr opens your windows again.
- Popups from plugins, such as one that opens a Git client in the folder you're in.
Open, show and hide floating panes
- Shell › New Floating Pane, ⇧⌥⌘F, opens a floating pane over the tab. Its shell starts in the folder of the pane you were in, as
new-directorysays by default. Each new one opens a little down and to the right of the one before. - Shell › Show or Hide Floating Panes, ⌥⌘F, hides the tab's floating panes together, their programs running, and shows them again. On a tab with none, it opens one.
- Click a pane to give it the keyboard, whether it floats or not. The floating pane that you click comes in front of the others.
Move, resize and close a floating pane
- What it shows: a card of rounded corners, as the splits' panes are, with its program's icon, its title in bold and its folder at the top, such as
~/…/lokyr, and the × at the right. A popup shows its command's program, such aslazygit.[plugins.splits] look = "plain"gives floating panes the box of before, with a plain title. · Since 1.7 - Move it: drag its title bar. It stays within the tab.
- Resize it: drag its edges or its corners. The pointer shows the way it resizes.
- Close it: click the × at the right of its title, press ⌘W, choose Shell › Pane › Close Pane, or exit its shell. Lokyr asks first while a program other than a shell runs there.
- ⌘W closes a pane, not the tab, while the tab has floating panes, hidden ones too. When the pane you close is the tab's last split pane, the floating pane in front takes its place.
Move a pane between the splits and the floating panes
- Float a pane of the splits: right-click it and choose Float Pane. Its room goes to the pane beside it. A tab of one pane has nothing to float.
- Put a floating pane back into the splits: right-click it and choose Move Pane into Splits. It goes to the right of the split pane that you used last, half and half.
Run a command in a popup
Bind pane.popup to a key in the config's [keys], with the command to run:
[keys]
"ctrl+cmd+g" = { command = "pane.popup", args = { command = "lazygit" } }
"ctrl+cmd+o" = { command = "pane.popup", args = { command = "fzf | xargs open", width = 0.6, height = 0.5 } }
"ctrl+cmd+n" = { command = "pane.popup", args = { command = "vim notes.md", folder = "~/notes" } }
- Where it runs: your login shell runs the command, so it finds the programs of your
PATH, in the folder of the pane you were in, asnew-directorysays by default.foldernames another, such as"~/notes": a folder that isn't there opens no popup, rather than running the command somewhere else. - Its size:
widthandheightare shares of the tab, from0.05to1:0.8and0.7when you leave them out. - When it closes: when the command exits with the status 0, or when you interrupt it, such as with Control-C, or Escape in
fzf. When the command fails, the popup stays open with a line that tells how it ended, so that you can read its error, until you press a key. This holds whateverclose-on-exitsays. - Your keys: Escape and every key that no shortcut of Lokyr's takes go to the command. Lokyr's shortcuts, such as ⌘W or ⌥⌘F, still work.
- On its own: a popup shows whether the tab's other floating panes show or not. ⌥⌘F shows or hides those under it, and the popup keeps the keyboard.
You can move, resize and close a popup as any floating pane. A popup stays over its tab: it doesn't go into the splits, to another tab or to a window, and when the tab's last split pane closes, the popup closes with the tab.
Popups from plugins
A plugin can open a popup too, such as a Git client in the folder you're in, and learn how its command ended. It needs two capabilities: workspace-write, as it opens a pane, and pty-write, as it runs a command there. Lokyr asks you for both when the plugin first runs. The plugin reference covers cx.open_popup and the popup-closed event.
Settings
[keys]
"ctrl+cmd+g" = { command = "pane.popup", args = { command = "lazygit" } }
[app]
restore-windows = "always" # your floating panes come back with their tabs
restore-scrollback = true # with what they showed when you quit
[keys]: your popups' keys, and other keys for the floating panes' commands.[app] restore-windows: whether your windows, and the floating panes of their tabs, open again as Lokyr starts.[app] restore-scrollback: whether the panes that open again show what they showed when you quit.[window] close-on-exit: what a pane does when its program ends, which popups don't follow.
Commands and keys
| Command | Title | Arguments | Default keys |
|---|---|---|---|
pane.new-floating | New Floating Pane | ⇧⌥⌘F | |
pane.toggle-floating | Show or Hide Floating Panes | ⌥⌘F | |
pane.float | Float Pane | ||
pane.move-into-splits | Move Pane into Splits | ||
pane.popup | Open Popup | command, text; folder, text; width, number; height, number |
Float Pane and Move Pane into Splits are in a pane's context menu alone. The commands' reference lists them with the other commands of the panes.
How it works
- A floating pane belongs to its tab. It moves with the tab to another window, and closes with it.
- Its frame is a share of the tab's room, so it keeps its place and size, in proportion, as the window resizes. It is at least a twentieth of the room each way.
- Hidden floating panes keep running, and their scrollback stays in memory; Lokyr draws nothing for them.
- A popup's status: a command interrupted by Control-C exits with 130 in most shells, which closes the popup as 0 does.
- When Lokyr opens your windows again as it starts, each floating pane comes back in its tab, at its place, shown or hidden as you left it. Popups don't come back, so that a command doesn't run again on its own.
Limits
- Your programs end when you quit Lokyr: a floating pane comes back with a new shell.
- A saved layout leaves out a session's floating panes: it opens with the splits alone.
- Floating panes don't snap to the tab's edges or to each other.
See also
- Windows and tabs, for the splits, tabs and broadcast.
- Splits, for the panes of a tab's layout.
- Sessions, whose windows keep their floating panes.