Skip to content

Class pinnacle.layout

Layout management.

Read the wiki page for more information.

Fields

builtin

builtin = builtin

Builtin layout generators.

Functions

function manage

function pinnacle.layout.manage(on_layout: fun(args: pinnacle.layout.LayoutArgs): pinnacle.layout.LayoutResponse)
    -> pinnacle.layout.LayoutRequester

Begins managing layout requests from the compositor.

You must call this function to get windows to tile. The provided function will be run with the arguments of the layout request. It must return a LayoutResponse containing a LayoutNode that represents the root of a layout tree, along with an identifier.

Example

lua
local layout_requester = Layout.manage(function(args)
    local first_tag = args.tags[1]
    if not first_tag then
        ---@type pinnacle.layout.LayoutResponse
        return {
            root_node = {},
            tree_id = 0,
        }
    end
    layout_cycler.current_tag = first_tag
    local root_node = layout_cycler:layout(args.window_count)
    local tree_id = layout_cycler:current_tree_id()

    ---@type pinnacle.layout.LayoutResponse
    return {
        root_node = root_node,
        tree_id = tree_id,
    }
end)

Parameters

on_layout: fun(args: pinnacle.layout.LayoutArgs): pinnacle.layout.LayoutResponse - A function that receives layout arguments and builds and returns a layout response.

Returns

  1. pinnacle.layout.LayoutRequester - A requester that allows you to force the compositor to request a layout.

Last updated: