Skip to content

Built-in Layouts

Classes:

  • Bsp

    This layout is inspired by bspwm, but it does not try to copy its

  • Columns

    Extension of the Stack layout.

  • Floating

    Floating layout, which does nothing with windows but handles focus order.

  • Matrix

    This layout divides the screen into a matrix of equally sized cells and

  • Max

    Maximized layout.

  • MonadTall

    Emulate the behavior of XMonad's default tiling scheme.

  • MonadThreeCol

    Emulate the behavior of XMonad's ThreeColumns layout.

  • MonadWide

    Emulate the behavior of XMonad's horizontal tiling scheme.

  • RatioTile

    Tries to tile all windows in the width/height ratio passed in.

  • ScreenSplit

    A layout that allows you to split the screen into separate areas, each of which

  • Slice

    Slice layout.

  • Spiral

    A mathematical layout.

  • Stack

    A layout composed of stacks of windows.

  • Tile

    A layout with two stacks of windows dividing the screen.

  • TreeTab

    Tree Tab Layout.

  • VerticalTile

    Tiling layout that works nice on vertically mounted monitors.

  • Zoomy

    A layout with single active windows, and few other previews at the right.

Bsp

Bsp(**config)

Bases: Layout

This layout is inspired by bspwm, but it does not try to copy its features.

The first client occupies the entire screen space. When a new client is created, the selected space is partitioned in 2 and the new client occupies one of those subspaces, leaving the old client with the other.

The partition can be either horizontal or vertical according to the dimensions of the current space: if its width/height ratio is above a pre-configured value, the subspaces are created side-by-side, otherwise, they are created on top of each other. The partition direction can be freely toggled. All subspaces can be resized and clients can be shuffled around.

All clients are organized at the leaves of a full binary tree.

An example key configuration is::

Key([mod], "j", lazy.layout.down()),
Key([mod], "k", lazy.layout.up()),
Key([mod], "h", lazy.layout.left()),
Key([mod], "l", lazy.layout.right()),
Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
Key([mod, "shift"], "h", lazy.layout.shuffle_left()),
Key([mod, "shift"], "l", lazy.layout.shuffle_right()),
Key([mod, "mod1"], "j", lazy.layout.flip_down()),
Key([mod, "mod1"], "k", lazy.layout.flip_up()),
Key([mod, "mod1"], "h", lazy.layout.flip_left()),
Key([mod, "mod1"], "l", lazy.layout.flip_right()),
Key([mod, "control"], "j", lazy.layout.grow_down()),
Key([mod, "control"], "k", lazy.layout.grow_up()),
Key([mod, "control"], "h", lazy.layout.grow_left()),
Key([mod, "control"], "l", lazy.layout.grow_right()),
Key([mod, "shift"], "n", lazy.layout.normalize()),
Key([mod], "Return", lazy.layout.toggle_split()),

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(
    client: Window, wrap: bool = False
) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(
    client: Window, wrap: bool = False
) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

remove

remove(client)

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(c1: Window, c2: Window) -> None

Swap the two given clients c1 and c2.

Columns

Columns(**config)

Bases: Layout

Extension of the Stack layout.

The screen is split into columns, which can be dynamically added or removed. Each column can present its windows in 2 modes: split or stacked. In split mode, all windows are presented simultaneously, spliting the column space. In stacked mode, only a single window is presented from the stack of windows. Columns and windows can be resized and windows can be shuffled around.

This layout can also emulate wmii's default layout via:

layout.Columns(num_columns=1, insert_position=1)

Or the "Vertical", and "Max", depending on the default parameters.

An example key configuration is:

Key([mod], "j", lazy.layout.down()),
Key([mod], "k", lazy.layout.up()),
Key([mod], "h", lazy.layout.left()),
Key([mod], "l", lazy.layout.right()),
Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
Key([mod, "shift"], "h", lazy.layout.shuffle_left()),
Key([mod, "shift"], "l", lazy.layout.shuffle_right()),
Key([mod, "control"], "j", lazy.layout.grow_down()),
Key([mod, "control"], "k", lazy.layout.grow_up()),
Key([mod, "control"], "h", lazy.layout.grow_left()),
Key([mod, "control"], "l", lazy.layout.grow_right()),
Key([mod, "shift", "control"], "h", lazy.layout.swap_column_left()),
Key([mod, "shift", "control"], "l", lazy.layout.swap_column_right()),
Key([mod], "Return", lazy.layout.toggle_split()),
Key([mod], "n", lazy.layout.normalize()),

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Returns first client in first column of layout.

  • focus_last

    Returns last client in last column of layout.

  • focus_next

    Returns the next client after 'win' in layout,

  • focus_previous

    Returns the client previous to 'win' in layout.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • normalize

    Give columns equal widths.

  • remove

    Called whenever a window is removed from the group.

  • reset

    Resets column widths, respecting 'initial_ratio' value.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Returns first client in first column of layout.

focus_last

focus_last() -> Window | None

Returns last client in last column of layout.

focus_next

focus_next(win: Window) -> None

Returns the next client after 'win' in layout, or None if there is no such client.

focus_previous

focus_previous(win: Window) -> Window | None

Returns the client previous to 'win' in layout. or None if there is no such client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

normalize

normalize()

Give columns equal widths.

remove

remove(client)

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

reset

reset()

Resets column widths, respecting 'initial_ratio' value.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(c1: Window, c2: Window) -> None

Swap the two given clients c1 and c2.

Floating

Floating(
    float_rules: list[_Match] | None = None,
    no_reposition_rules=None,
    **config
)

Bases: Layout

Floating layout, which does nothing with windows but handles focus order.

Match objects:

from libqtile.config import Match
Match(title=WM_NAME, wm_class=WM_CLASS, role=WM_WINDOW_ROLE)

When a new window is opened its match method is called with each of these rules. If one matches, the window will float. The following will float GIMP and Skype:

from libqtile.config import Match
float_rules=[Match(wm_class="skype"), Match(wm_class="gimp")]

The following Match will float all windows that are transient windows for a parent window:

Match(func=lambda c: bool(c.is_transient_for()))

Specify these in the floating_layout in your config.

Floating layout will try to center most of floating windows by default, but if you don't want this to happen for certain windows that are centered by mistake, you can use no_reposition_rules option to specify them and layout will rely on windows to position themselves in correct location on the screen.

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • compute_client_position

    Recompute client.x and client.y, returning whether or not to place

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • find_clients

    Find all clients belonging to a given group.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • match

    Used to default float some windows.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

  • to_screen

    Adjust offsets of clients within current screen.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

compute_client_position

compute_client_position(client, screen_rect)

Recompute client.x and client.y, returning whether or not to place this client above other windows or not.

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

find_clients

find_clients(group)

Find all clients belonging to a given group.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first(group=None)

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last(group=None)

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(win: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(win)

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

match

match(win)

Used to default float some windows.

remove

remove(client: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(c1: Window, c2: Window) -> None

Swap the two given clients c1 and c2.

to_screen

to_screen(group, new_screen)

Adjust offsets of clients within current screen.

Matrix

Matrix(**config)

Bases: _SimpleLayoutBase

This layout divides the screen into a matrix of equally sized cells and places one window in each cell. The number of columns is configurable and can also be changed interactively.

Methods:

  • add

    Increase number of columns.

  • add_client

    Add client to Layout.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • delete

    Decrease number of columns.

  • doc

    Returns the documentation for a specified command name.

  • down

    Switch to the next window in current column.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • get_column

    Get all clients in given column.

  • get_row

    Get all clients in given row.

  • hide

    Called when layout is being hidden.

  • horizontal_traversal

    Internal method for determining left or right client.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • left

    Switch to the next window on current row.

  • remove

    Called whenever a window is removed from the group.

  • right

    Switch to the next window on current row.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

  • up

    Switch to the previous window in current column.

  • vertical_traversal

    Internal method for determining above or below client.

Attributes:

  • column

    Calc column index of current client.

  • group (_Group) –

    Returns the group this layout is attached to.

  • row

    Calc row index of current client.

  • rows

    Calc current number of rows, basd on number of clients and columns.

column property

column

Calc column index of current client.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

row property

row

Calc row index of current client.

rows property

rows

Calc current number of rows, basd on number of clients and columns.

add

add()

Increase number of columns.

add_client

add_client(client: Window) -> None

Add client to Layout. Note that for Matrix the clients are appended at end of list. If needed a new row in matrix is created.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

delete

delete()

Decrease number of columns.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

down

down()

Switch to the next window in current column.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

get_column

get_column(column)

Get all clients in given column.

get_row

get_row(row)

Get all clients in given row.

hide

hide() -> None

Called when layout is being hidden.

horizontal_traversal

horizontal_traversal(direction)

Internal method for determining left or right client. Negative direction is to left.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

left

left()

Switch to the next window on current row.

remove

remove(client: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

right

right()

Switch to the next window on current row.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(window1: Window, window2: Window) -> None

Swap the two given clients c1 and c2.

up

up()

Switch to the previous window in current column.

vertical_traversal

vertical_traversal(direction)

Internal method for determining above or below client. Negative direction is to top.

Max

Max(**config)

Bases: _SimpleLayoutBase

Maximized layout.

A simple layout that only displays one window at a time, filling the screen_rect. This is suitable for use on laptops and other devices with small screens. Conceptually, the windows are managed as a stack, with commands to switch to next and previous windows in the stack.

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

remove

remove(client: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(window1: Window, window2: Window) -> None

Swap the two given clients c1 and c2.

MonadTall

MonadTall(**config)

Bases: _SimpleLayoutBase

Emulate the behavior of XMonad's default tiling scheme.

Main-Pane:

A main pane that contains a single window takes up a vertical portion of the screen_rect based on the ratio setting. This ratio can be adjusted with the grow_main and shrink_main or, while the main pane is in focus, grow and shrink. You may also set the ratio directly with set_ratio.

---------------------
|            |      |
|            |      |
|            |      |
|            |      |
|            |      |
|            |      |
---------------------

Using the flip method will switch which horizontal side the main pane will occupy. The main pane is considered the "top" of the stack.

---------------------
|      |            |
|      |            |
|      |            |
|      |            |
|      |            |
|      |            |
---------------------

Secondary-panes:

Occupying the rest of the screen_rect are one or more secondary panes. The secondary panes will share the vertical space of the screen_rect however they can be resized at will with the grow and shrink methods. The other secondary panes will adjust their sizes to smoothly fill all of the space.

---------------------          ---------------------
|            |      |          |            |______|
|            |______|          |            |      |
|            |      |          |            |      |
|            |______|          |            |      |
|            |      |          |            |______|
|            |      |          |            |      |
---------------------          ---------------------

Panes can be moved with the shuffle_up and shuffle_down methods. As mentioned the main pane is considered the top of the stack; moving up is counter-clockwise and moving down is clockwise.

The opposite is true if the layout is "flipped".

---------------------          ---------------------
|            |  2   |          |   2   |           |
|            |______|          |_______|           |
|            |  3   |          |   3   |           |
|     1      |______|          |_______|     1     |
|            |  4   |          |   4   |           |
|            |      |          |       |           |
---------------------          ---------------------

Normalizing/Resetting:

To restore all secondary client windows to their default size ratios use the normalize method.

To reset all client windows to their default sizes, including the primary window, use the reset method.

Maximizing:

To toggle a client window between its minimum and maximum sizes simply use the maximize on a focused client.

Suggested Bindings:

Key([modkey], "h", lazy.layout.left()),
Key([modkey], "l", lazy.layout.right()),
Key([modkey], "j", lazy.layout.down()),
Key([modkey], "k", lazy.layout.up()),
Key([modkey, "shift"], "h", lazy.layout.swap_left()),
Key([modkey, "shift"], "l", lazy.layout.swap_right()),
Key([modkey, "shift"], "j", lazy.layout.shuffle_down()),
Key([modkey, "shift"], "k", lazy.layout.shuffle_up()),
Key([modkey], "i", lazy.layout.grow()),
Key([modkey], "m", lazy.layout.shrink()),
Key([modkey], "n", lazy.layout.reset()),
Key([modkey, "shift"], "n", lazy.layout.normalize()),
Key([modkey], "o", lazy.layout.maximize()),
Key([modkey, "shift"], "space", lazy.layout.flip()),

Methods:

  • add_client

    Add client to layout.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Clone layout for other groups.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Position client based on order and sizes.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • flip

    Flip the layout horizontally.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • get_shrink_margin

    Return how many remaining pixels a client can shrink.

  • grow

    Grow current window.

  • grow_down_shared

    Grow lower secondary clients.

  • grow_main

    Grow main pane.

  • grow_up_shared

    Grow higher secondary clients.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • left

    Focus on the closest window to the left of the current window.

  • maximize

    Grow the currently focused client to the max size.

  • normalize

    Evenly distribute screen-space among secondary clients.

  • remove

    Remove client from layout.

  • reset

    Reset Layout.

  • right

    Focus on the closest window to the right of the current window.

  • select

    Return a selected object.

  • set_ratio

    Directly set the main pane ratio.

  • show

    Called when layout is being shown.

  • shrink

    Shrink current window.

  • shrink_down

    Shrink current window down.

  • shrink_down_shared

    Shrink secondary clients.

  • shrink_main

    Shrink main pane.

  • shrink_up

    Shrink the window up.

  • shrink_up_shared

    Shrink the shared space.

  • shuffle_down

    Shuffle the client down the stack.

  • shuffle_up

    Shuffle the client up the stack.

  • swap

    Swap two windows.

  • swap_left

    Swap current window with closest window to the left.

  • swap_main

    Swap current window to main pane.

  • swap_right

    Swap current window with closest window to the right.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Add client to layout.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Clone layout for other groups.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Position client based on order and sizes.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

flip

flip()

Flip the layout horizontally.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

get_shrink_margin

get_shrink_margin(cidx)

Return how many remaining pixels a client can shrink.

grow

grow()

Grow current window.

Will grow the currently focused client reducing the size of those around it. Growing will stop when no other secondary clients can reduce their size any further.

grow_down_shared

grow_down_shared(cidx, amt)

Grow lower secondary clients.

Will grow all secondary clients below the specified index by an equal share of the provided amount.

grow_main

grow_main()

Grow main pane.

Will grow the main pane, reducing the size of clients in the secondary pane.

grow_up_shared

grow_up_shared(cidx, amt)

Grow higher secondary clients.

Will grow all secondary clients above the specified index by an equal share of the provided amount.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

left

left()

Focus on the closest window to the left of the current window.

maximize

maximize()

Grow the currently focused client to the max size.

normalize

normalize(redraw=True)

Evenly distribute screen-space among secondary clients.

remove

remove(client: Window) -> Window | None

Remove client from layout.

reset

reset(ratio=None, redraw=True)

Reset Layout.

right

right()

Focus on the closest window to the right of the current window.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

set_ratio

set_ratio(ratio)

Directly set the main pane ratio.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

shrink

shrink()

Shrink current window.

Will shrink the currently focused client reducing the size of those around it. Shrinking will stop when the client has reached the minimum size.

shrink_down

shrink_down(cidx, amt)

Shrink current window down.

Will shrink all secondary clients below the specified index in order. Each client will attempt to shrink as much as it is able before the next client is resized.

Any amount that was unable to be applied to the clients is returned.

shrink_down_shared

shrink_down_shared(cidx, amt)

Shrink secondary clients.

Will shrink all secondary clients below the specified index by an equal share of the provided amount. After applying the shared amount to all affected clients, any amount left over will be applied in a non-equal manner with shrink_down.

Any amount that was unable to be applied to the clients is returned.

shrink_main

shrink_main()

Shrink main pane.

Will shrink the main pane, increasing the size of clients in the secondary pane.

shrink_up

shrink_up(cidx, amt)

Shrink the window up.

Will shrink all secondary clients above the specified index in order. Each client will attempt to shrink as much as it is able before the next client is resized.

Any amount that was unable to be applied to the clients is returned.

shrink_up_shared

shrink_up_shared(cidx, amt)

Shrink the shared space.

Will shrink all secondary clients above the specified index by an equal share of the provided amount. After applying the shared amount to all affected clients, any amount left over will be applied in a non-equal manner with shrink_up.

Any amount that was unable to be applied to the clients is returned.

shuffle_down

shuffle_down()

Shuffle the client down the stack.

shuffle_up

shuffle_up()

Shuffle the client up the stack.

swap

swap(window1: Window, window2: Window) -> None

Swap two windows.

swap_left

swap_left()

Swap current window with closest window to the left.

swap_main

swap_main()

Swap current window to main pane.

swap_right

swap_right()

Swap current window with closest window to the right.

MonadThreeCol

MonadThreeCol(**config)

Bases: MonadTall

Emulate the behavior of XMonad's ThreeColumns layout.

A layout similar to tall but with three columns. With an ultra wide display this layout can be used for a huge main window - ideally at the center of the screen - and up to six reasonable sized secondary windows.

Main-Pane:

A main pane that contains a single window takes up a vertical portion of the screen_rect based on the ratio setting. This ratio can be adjusted with the grow_main and shrink_main or, while the main pane is in focus, grow and shrink. The main pane can also be centered.

---------------------------    ---------------------------
|           |      |      |    |      |           |      |
|           |      |      |    |      |           |      |
|           |      |      |    |      |           |      |
|           |      |      |    |      |           |      |
|           |      |      |    |      |           |      |
|           |      |      |    |      |           |      |
---------------------------    ---------------------------

Secondary-panes:

Occupying the rest of the screen_rect are one or more secondary panes. The secondary panes will be divided into two columns and share the vertical space of each column. However they can be resized at will with the grow and shrink methods. The other secondary panes will adjust their sizes to smoothly fill all of the space.

---------------------------    ---------------------------
|           |      |      |    |           |______|      |
|           |______|      |    |           |      |      |
|           |      |______|    |           |      |______|
|           |______|      |    |           |      |      |
|           |      |      |    |           |______|      |
|           |      |      |    |           |      |      |
---------------------------    ---------------------------

Panes can be moved with the shuffle_up and shuffle_down methods. As mentioned the main pane is considered the top of the stack; moving up is counter-clockwise and moving down is clockwise. A secondary pane can also be promoted to the main pane with the swap_main method.

Normalizing/Resetting:

To restore all secondary client windows to their default size ratios use the normalize method.

To reset all client windows to their default sizes, including the primary window, use the reset method.

Maximizing:

To maximized a client window simply use the maximize on a focused client.

Methods:

  • add_client

    Add client to layout.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Clone layout for other groups.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Position client based on order and sizes.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • flip

    Flip the layout horizontally.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • get_shrink_margin

    Return how many remaining pixels a client can shrink.

  • grow

    Grow current window.

  • grow_down_shared

    Grow lower secondary clients.

  • grow_main

    Grow main pane.

  • grow_up_shared

    Grow higher secondary clients.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • left

    Focus on the closest window to the left of the current window.

  • maximize

    Grow the currently focused client to the max size.

  • normalize

    Evenly distribute screen-space among secondary clients.

  • remove

    Remove client from layout.

  • reset

    Reset Layout.

  • right

    Focus on the closest window to the right of the current window.

  • select

    Return a selected object.

  • set_ratio

    Directly set the main pane ratio.

  • show

    Called when layout is being shown.

  • shrink

    Shrink current window.

  • shrink_down

    Shrink current window down.

  • shrink_down_shared

    Shrink secondary clients.

  • shrink_main

    Shrink main pane.

  • shrink_up

    Shrink the window up.

  • shrink_up_shared

    Shrink the shared space.

  • shuffle_down

    Shuffle the client down the stack.

  • shuffle_up

    Shuffle the client up the stack.

  • swap

    Swap two windows.

  • swap_left

    Swap current window with closest window to the left.

  • swap_main

    Swap current window to main pane.

  • swap_right

    Swap current window with closest window to the right.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Add client to layout.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Clone layout for other groups.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Position client based on order and sizes.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

flip

flip()

Flip the layout horizontally.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

get_shrink_margin

get_shrink_margin(cidx)

Return how many remaining pixels a client can shrink.

grow

grow()

Grow current window.

Will grow the currently focused client reducing the size of those around it. Growing will stop when no other secondary clients can reduce their size any further.

grow_down_shared

grow_down_shared(cidx, amt)

Grow lower secondary clients.

Will grow all secondary clients below the specified index by an equal share of the provided amount.

grow_main

grow_main()

Grow main pane.

Will grow the main pane, reducing the size of clients in the secondary pane.

grow_up_shared

grow_up_shared(cidx, amt)

Grow higher secondary clients.

Will grow all secondary clients above the specified index by an equal share of the provided amount.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

left

left()

Focus on the closest window to the left of the current window.

maximize

maximize()

Grow the currently focused client to the max size.

normalize

normalize(redraw=True)

Evenly distribute screen-space among secondary clients.

remove

remove(client: Window) -> Window | None

Remove client from layout.

reset

reset(ratio=None, redraw=True)

Reset Layout.

right

right()

Focus on the closest window to the right of the current window.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

set_ratio

set_ratio(ratio)

Directly set the main pane ratio.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

shrink

shrink()

Shrink current window.

Will shrink the currently focused client reducing the size of those around it. Shrinking will stop when the client has reached the minimum size.

shrink_down

shrink_down(cidx, amt)

Shrink current window down.

Will shrink all secondary clients below the specified index in order. Each client will attempt to shrink as much as it is able before the next client is resized.

Any amount that was unable to be applied to the clients is returned.

shrink_down_shared

shrink_down_shared(cidx, amt)

Shrink secondary clients.

Will shrink all secondary clients below the specified index by an equal share of the provided amount. After applying the shared amount to all affected clients, any amount left over will be applied in a non-equal manner with shrink_down.

Any amount that was unable to be applied to the clients is returned.

shrink_main

shrink_main()

Shrink main pane.

Will shrink the main pane, increasing the size of clients in the secondary pane.

shrink_up

shrink_up(cidx, amt)

Shrink the window up.

Will shrink all secondary clients above the specified index in order. Each client will attempt to shrink as much as it is able before the next client is resized.

Any amount that was unable to be applied to the clients is returned.

shrink_up_shared

shrink_up_shared(cidx, amt)

Shrink the shared space.

Will shrink all secondary clients above the specified index by an equal share of the provided amount. After applying the shared amount to all affected clients, any amount left over will be applied in a non-equal manner with shrink_up.

Any amount that was unable to be applied to the clients is returned.

shuffle_down

shuffle_down()

Shuffle the client down the stack.

shuffle_up

shuffle_up()

Shuffle the client up the stack.

swap

swap(window1: Window, window2: Window) -> None

Swap two windows.

swap_left

swap_left()

Swap current window with closest window to the left.

swap_main

swap_main()

Swap current window to main pane.

swap_right

swap_right()

Swap current window with closest window to the right.

MonadWide

MonadWide(**config)

Bases: MonadTall

Emulate the behavior of XMonad's horizontal tiling scheme.

This layout attempts to emulate the behavior of XMonad wide tiling scheme.

Main-Pane:

A main pane that contains a single window takes up a horizontal portion of the screen_rect based on the ratio setting. This ratio can be adjusted with the grow_main and shrink_main or, while the main pane is in focus, grow and shrink.

---------------------
|                   |
|                   |
|                   |
|___________________|
|                   |
|                   |
---------------------

Using the flip method will switch which vertical side the main pane will occupy. The main pane is considered the "top" of the stack.

---------------------
|                   |
|___________________|
|                   |
|                   |
|                   |
|                   |
---------------------

Secondary-panes:

Occupying the rest of the screen_rect are one or more secondary panes. The secondary panes will share the horizontal space of the screen_rect however they can be resized at will with the grow and shrink methods. The other secondary panes will adjust their sizes to smoothly fill all of the space.

---------------------          ---------------------
|                   |          |                   |
|                   |          |                   |
|                   |          |                   |
|___________________|          |___________________|
|     |       |     |          |   |           |   |
|     |       |     |          |   |           |   |
---------------------          ---------------------

Panes can be moved with the shuffle_up and shuffle_down methods. As mentioned the main pane is considered the top of the stack; moving up is counter-clockwise and moving down is clockwise.

The opposite is true if the layout is "flipped".

---------------------          ---------------------
|                   |          |  2  |   3   |  4  |
|         1         |          |_____|_______|_____|
|                   |          |                   |
|___________________|          |                   |
|     |       |     |          |        1          |
|  2  |   3   |  4  |          |                   |
---------------------          ---------------------

Normalizing/Resetting:

To restore all secondary client windows to their default size ratios use the normalize method.

To reset all client windows to their default sizes, including the primary window, use the reset method.

Maximizing:

To toggle a client window between its minimum and maximum sizes simply use the maximize on a focused client.

Suggested Bindings:

Key([modkey], "h", lazy.layout.left()),
Key([modkey], "l", lazy.layout.right()),
Key([modkey], "j", lazy.layout.down()),
Key([modkey], "k", lazy.layout.up()),
Key([modkey, "shift"], "h", lazy.layout.swap_left()),
Key([modkey, "shift"], "l", lazy.layout.swap_right()),
Key([modkey, "shift"], "j", lazy.layout.shuffle_down()),
Key([modkey, "shift"], "k", lazy.layout.shuffle_up()),
Key([modkey], "i", lazy.layout.grow()),
Key([modkey], "m", lazy.layout.shrink()),
Key([modkey], "n", lazy.layout.reset()),
Key([modkey, "shift"], "n", lazy.layout.normalize()),
Key([modkey], "o", lazy.layout.maximize()),
Key([modkey, "shift"], "space", lazy.layout.flip()),

Methods:

  • add_client

    Add client to layout.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Clone layout for other groups.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Position client based on order and sizes.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • flip

    Flip the layout horizontally.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • get_shrink_margin

    Return how many remaining pixels a client can shrink.

  • grow

    Grow current window.

  • grow_down_shared

    Grow lower secondary clients.

  • grow_main

    Grow main pane.

  • grow_up_shared

    Grow higher secondary clients.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • left

    Focus on the closest window to the left of the current window.

  • maximize

    Grow the currently focused client to the max size.

  • normalize

    Evenly distribute screen-space among secondary clients.

  • remove

    Remove client from layout.

  • reset

    Reset Layout.

  • right

    Focus on the closest window to the right of the current window.

  • select

    Return a selected object.

  • set_ratio

    Directly set the main pane ratio.

  • show

    Called when layout is being shown.

  • shrink

    Shrink current window.

  • shrink_down

    Shrink current window down.

  • shrink_down_shared

    Shrink secondary clients.

  • shrink_main

    Shrink main pane.

  • shrink_up

    Shrink the window up.

  • shrink_up_shared

    Shrink the shared space.

  • shuffle_down

    Shuffle the client down the stack.

  • shuffle_up

    Shuffle the client up the stack.

  • swap

    Swap two windows.

  • swap_left

    Swap current window with closest window to the down.

  • swap_main

    Swap current window to main pane.

  • swap_right

    Swap current window with closest window to the up.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Add client to layout.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Clone layout for other groups.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Position client based on order and sizes.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

flip

flip()

Flip the layout horizontally.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

get_shrink_margin

get_shrink_margin(cidx)

Return how many remaining pixels a client can shrink.

grow

grow()

Grow current window.

Will grow the currently focused client reducing the size of those around it. Growing will stop when no other secondary clients can reduce their size any further.

grow_down_shared

grow_down_shared(cidx, amt)

Grow lower secondary clients.

Will grow all secondary clients below the specified index by an equal share of the provided amount.

grow_main

grow_main()

Grow main pane.

Will grow the main pane, reducing the size of clients in the secondary pane.

grow_up_shared

grow_up_shared(cidx, amt)

Grow higher secondary clients.

Will grow all secondary clients above the specified index by an equal share of the provided amount.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

left

left()

Focus on the closest window to the left of the current window.

maximize

maximize()

Grow the currently focused client to the max size.

normalize

normalize(redraw=True)

Evenly distribute screen-space among secondary clients.

remove

remove(client: Window) -> Window | None

Remove client from layout.

reset

reset(ratio=None, redraw=True)

Reset Layout.

right

right()

Focus on the closest window to the right of the current window.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

set_ratio

set_ratio(ratio)

Directly set the main pane ratio.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

shrink

shrink()

Shrink current window.

Will shrink the currently focused client reducing the size of those around it. Shrinking will stop when the client has reached the minimum size.

shrink_down

shrink_down(cidx, amt)

Shrink current window down.

Will shrink all secondary clients below the specified index in order. Each client will attempt to shrink as much as it is able before the next client is resized.

Any amount that was unable to be applied to the clients is returned.

shrink_down_shared

shrink_down_shared(cidx, amt)

Shrink secondary clients.

Will shrink all secondary clients below the specified index by an equal share of the provided amount. After applying the shared amount to all affected clients, any amount left over will be applied in a non-equal manner with shrink_down.

Any amount that was unable to be applied to the clients is returned.

shrink_main

shrink_main()

Shrink main pane.

Will shrink the main pane, increasing the size of clients in the secondary pane.

shrink_up

shrink_up(cidx, amt)

Shrink the window up.

Will shrink all secondary clients above the specified index in order. Each client will attempt to shrink as much as it is able before the next client is resized.

Any amount that was unable to be applied to the clients is returned.

shrink_up_shared

shrink_up_shared(cidx, amt)

Shrink the shared space.

Will shrink all secondary clients above the specified index by an equal share of the provided amount. After applying the shared amount to all affected clients, any amount left over will be applied in a non-equal manner with shrink_up.

Any amount that was unable to be applied to the clients is returned.

shuffle_down

shuffle_down()

Shuffle the client down the stack.

shuffle_up

shuffle_up()

Shuffle the client up the stack.

swap

swap(window1: Window, window2: Window) -> None

Swap two windows.

swap_left

swap_left()

Swap current window with closest window to the down.

swap_main

swap_main()

Swap current window to main pane.

swap_right

swap_right()

Swap current window with closest window to the up.

RatioTile

RatioTile(**config)

Bases: _SimpleLayoutBase

Tries to tile all windows in the width/height ratio passed in.

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(w: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(win, screen)

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

remove

remove(w: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(window1: Window, window2: Window) -> None

Swap the two given clients c1 and c2.

ScreenSplit

ScreenSplit(**config)

Bases: Layout

A layout that allows you to split the screen into separate areas, each of which can be assigned its own layout.

This layout is intended to be used on large monitors where separate layouts may be desirable. However, unlike creating virtual screens, this layout retains the full screen configuration meaning that full screen windows will continue to fill the entire screen.

Each split is defined as a dictionary with the following keys:

  • name: this is used with the ScreenSplit widget (see below)
  • rect: a tuple of (x, y, width, height) with each value being between 0 and 1. These are relative values based on the screen's dimensions e.g. a value of (0.5, 0, 0.5, 1) would define an area starting at the top middle of the screen and extending to the bottom left corner.
  • layout: the layout to occupy the defined split.
  • matches: (optional) list of Match objects which define which windows will open in the defined split.

Different splits can be selected by using the following lazy.layout.next_split() and lazy.layout.previous_split() commands.

To identify which split is active, users can use the ScreenSplit widget will show the name of the split and the relevant layout. Scrolling up and down on the widget will change the active split.

Note

While keybindings will be passed to the active split's layout, bindings using the .when(layout=...) syntax will not be applied as the primary layout is ScreenSplit.

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • move_window_to_next_split

    Move current window to next split.

  • move_window_to_previous_split

    Move current window to previous split.

  • next

    Move to next client.

  • next_split

    Move to next split.

  • previous

    Move to previous client.

  • previous_split

    Move to previous client.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(win: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> ScreenSplit

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands()

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(win: Window) -> Window

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(win: Window) -> Window

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

move_window_to_next_split

move_window_to_next_split() -> None

Move current window to next split.

move_window_to_previous_split

move_window_to_previous_split() -> None

Move current window to previous split.

next

next() -> None

Move to next client.

next_split

next_split() -> None

Move to next split.

previous

previous() -> None

Move to previous client.

previous_split

previous_split() -> None

Move to previous client.

remove

remove(win: Window) -> None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(_rect) -> None

Called when layout is being shown.

swap

swap(c1: Window, c2: Window) -> None

Swap the two given clients c1 and c2.

Slice

Slice(**config)

Bases: Layout

Slice layout.

This layout cuts piece of screen_rect and places a single window on that piece, and delegates other window placement to other layout

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • delegate_layout

    Delegates layouting actual windows.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • move_to_slice

    Moves the current window to the slice.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(win)

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str)

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands()

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(win, screen_rect)

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

delegate_layout

delegate_layout(windows, mapping)

Delegates layouting actual windows.

Parameters:

  • windows

    Windows to layout.

  • mapping

    Mapping from layout to ScreenRect for each layout.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(win)

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(win: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(win: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

move_to_slice

move_to_slice()

Moves the current window to the slice.

remove

remove(win: Window) -> Window

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(c1: Window, c2: Window) -> None

Swap the two given clients c1 and c2.

Spiral

Spiral(**config)

Bases: _SimpleLayoutBase

A mathematical layout.

Renders windows in a spiral form by splitting the screen based on a selected ratio. The direction of the split is changed every time in a defined order resulting in a spiral formation.

The main window can be sized with lazy.layout.grow_main() and lazy.layout.shrink_main(). All other windows are sized by lazy.layout.increase_ratio() and lazy.layout.decrease_ratio().

NB if main_pane_ratio is not set then it will also be adjusted according to ratio. However, as soon shrink_main() or grow_main() have been called once then the master pane will only change size following further calls to those methods.

Users are able to choose the location of the main (i.e. largest) pane and the direction of the rotation.

Some examples:

main_pane="left", clockwise=True

----------------------
|1        |2         |
|         |          |
|         |          |
|         |----------|
|         |5 |6 |3   |
|         |-----|    |
|         |4    |    |
----------------------

main_pane="top", clockwise=False

----------------------
|1                   |
|                    |
|                    |
|--------------------|
|2        |5    |4   |
|         |----------|
|         |3         |
----------------------

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • decrease_ratio

    Decrease spiral ratio.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • get_spiral

    Calculates positions of windows in the spiral.

  • grow_main

    Grow the main window.

  • has_invalid_size

    Checks if window would have an invalid size.

  • hide

    Called when layout is being hidden.

  • increase_ratio

    Increase spiral ratio.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • remove

    Called whenever a window is removed from the group.

  • reset

    Reset ratios to values set in config.

  • select

    Return a selected object.

  • set_master_ratio

    Set the ratio for the main window.

  • set_ratio

    Set the ratio for all windows.

  • show

    Called when layout is being shown.

  • shrink_main

    Shrink the main window.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(win, screen)

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

decrease_ratio

decrease_ratio()

Decrease spiral ratio.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

get_spiral

get_spiral(x, y, width, height) -> list[Rect]

Calculates positions of windows in the spiral.

Returns a list of tuples (x, y, w, h) for positioning windows.

grow_main

grow_main()

Grow the main window.

has_invalid_size

has_invalid_size(win: Rect) -> bool

Checks if window would have an invalid size.

A window that would have negative height or width (after adjusting for margins and borders) will return True.

hide

hide() -> None

Called when layout is being hidden.

increase_ratio

increase_ratio()

Increase spiral ratio.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

remove

remove(w: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

reset

reset()

Reset ratios to values set in config.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

set_master_ratio

set_master_ratio(ratio: float)

Set the ratio for the main window.

set_ratio

set_ratio(ratio: float)

Set the ratio for all windows.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

shrink_main

shrink_main()

Shrink the main window.

swap

swap(window1: Window, window2: Window) -> None

Swap the two given clients c1 and c2.

Stack

Stack(**config)

Bases: Layout

A layout composed of stacks of windows.

The stack layout divides the screen_rect horizontally into a set of stacks. Commands allow you to switch between stacks, to next and previous windows within a stack, and to split a stack to show all windows in the stack, or unsplit it to show only the current window.

Unlike the columns layout the number of stacks is fixed.

Methods:

  • add

    Add another stack to the layout.

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • client_to_next

    Send the current client to the next stack.

  • client_to_previous

    Send the current client to the previous stack.

  • client_to_stack

    Send the current client to stack n, where n is an integer offset. If

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • delete

    Delete the current stack from the layout.

  • doc

    Returns the documentation for a specified command name.

  • down

    Switch to the next window in this stack.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • next

    Focus next stack.

  • previous

    Focus previous stack.

  • remove

    Called whenever a window is removed from the group.

  • rotate

    Rotate order of the stacks.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • shuffle_down

    Shuffle the order of this stack down.

  • shuffle_up

    Shuffle the order of this stack up.

  • swap

    Swap the two given clients c1 and c2.

  • toggle_split

    Toggle vertical split on the current stack.

  • up

    Switch to the previous window in this stack.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add

add()

Add another stack to the layout.

add_client

add_client(client: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

client_to_next

client_to_next()

Send the current client to the next stack.

client_to_previous

client_to_previous()

Send the current client to the previous stack.

client_to_stack

client_to_stack(n)

Send the current client to stack n, where n is an integer offset. If is too large or less than 0, it is wrapped modulo the number of stacks.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

delete

delete()

Delete the current stack from the layout.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

down

down()

Switch to the next window in this stack.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(client: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(client: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

next

next() -> None

Focus next stack.

previous

previous() -> None

Focus previous stack.

remove

remove(client: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

rotate

rotate()

Rotate order of the stacks.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

shuffle_down

shuffle_down()

Shuffle the order of this stack down.

shuffle_up

shuffle_up()

Shuffle the order of this stack up.

swap

swap(c1: Window, c2: Window) -> None

Swap the two given clients c1 and c2.

toggle_split

toggle_split()

Toggle vertical split on the current stack.

up

up()

Switch to the previous window in this stack.

Tile

Tile(**config)

Bases: _SimpleLayoutBase

A layout with two stacks of windows dividing the screen.

The Tile layout divides the screen_rect horizontally into two stacks. The maximum amount of "master" windows can be configured; surplus windows will be displayed in the slave stack on the right. Within their stacks, the windows will be tiled vertically. The windows can be rotated in their entirety by calling up() or down() or, if shift_windows is set to True, individually.

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client, offset_to_current=1)

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

remove

remove(client: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(window1: Window, window2: Window) -> None

Swap the two given clients c1 and c2.

TreeTab

TreeTab(**config)

Bases: Layout

Tree Tab Layout.

This layout works just like Max but displays tree of the windows at the left border of the screen_rect, which allows you to overview all opened windows. It's designed to work with uzbl-browser but works with other windows too.

The panel at the left border contains sections, each of which contains windows. Initially the panel looks like flat lists inside its section, and looks like trees if some of the windows are "moved" left or right.

For example, it looks like below with two sections initially:

+------------+
|Section Foo |
+------------+
| Window A   |
+------------+
| Window B   |
+------------+
| Window C   |
+------------+
|Section Bar |
+------------+

And then it will look like below if "Window B" is moved right and "Window C" is moved right too:

+------------+
|Section Foo |
+------------+
| Window A   |
+------------+
|  Window B  |
+------------+
|   Window C |
+------------+
|Section Bar |
+------------+

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • add_section

    Add named section to tree.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • del_section

    Remove named section from tree.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • next

    Switch down in the window list.

  • previous

    Switch up in the window list.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • sort_windows

    Sorts window to sections using sorter function.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(win)

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

add_section

add_section(name)

Add named section to tree.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

del_section

del_section(name)

Remove named section from tree.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(win)

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(client: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(client: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

next

next() -> None

Switch down in the window list.

previous

previous() -> None

Switch up in the window list.

remove

remove(win: Window) -> None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

sort_windows

sort_windows(
    sorter: Callable, create_sections: bool = True
)

Sorts window to sections using sorter function.

Parameters:

  • sorter (Callable) –

    Function accepting a single argument, and returning a string. The function should return the name of the section where the window should be.

  • create_sections (bool, default: True ) –

    If this parameter is True (default), and the sorter returns "unknown", the section name will be created dynamically.

swap

swap(c1: Window, c2: Window) -> None

Swap the two given clients c1 and c2.

VerticalTile

VerticalTile(**config)

Bases: _SimpleLayoutBase

Tiling layout that works nice on vertically mounted monitors.

The available height gets divided by the number of panes, if no pane is maximized. If one pane has been maximized, the available height gets split in master- and secondary area. The maximized pane (master pane) gets the full height of the master area and the other panes (secondary panes) share the remaining space. The master area (at default 75%) can grow and shrink via keybindings.

-----------------                -----------------  ---
|               |                |               |   |
|       1       |  <-- Panes     |               |   |
|               |        |       |               |   |
|---------------|        |       |               |   |
|               |        |       |               |   |
|       2       |  <-----+       |       1       |   |  Master Area
|               |        |       |               |   |
|---------------|        |       |               |   |
|               |        |       |               |   |
|       3       |  <-----+       |               |   |
|               |        |       |               |   |
|---------------|        |       |---------------|  ---
|               |        |       |       2       |   |
|       4       |  <-----+       |---------------|   |  Secondary Area
|               |                |       3       |   |
-----------------                -----------------  ---

Normal behavior. No One maximized pane in the master area maximized pane. No and two secondary panes in the specific areas. secondary area.

-----------------------------------  In some cases VerticalTile can be
|                                 |  useful on horizontal mounted
|                1                |  monitors two.
|                                 |  For example if you want to have a
|---------------------------------|  webbrowser and a shell below it.
|                                 |
|                2                |
|                                 |
-----------------------------------

Suggested keybindings:

Key([modkey], 'j', lazy.layout.down()),
Key([modkey], 'k', lazy.layout.up()),
Key([modkey], 'Tab', lazy.layout.next()),
Key([modkey, 'shift'], 'Tab', lazy.layout.next()),
Key([modkey, 'shift'], 'j', lazy.layout.shuffle_down()),
Key([modkey, 'shift'], 'k', lazy.layout.shuffle_up()),
Key([modkey], 'm', lazy.layout.maximize()),
Key([modkey], 'n', lazy.layout.normalize()),

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(window)

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(window, screen_rect)

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(client: Window) -> None

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

remove

remove(window: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(window1: Window, window2: Window) -> None

Swap the two given clients c1 and c2.

Zoomy

Zoomy(**config)

Bases: _SimpleLayoutBase

A layout with single active windows, and few other previews at the right.

Methods:

  • add_client

    Called whenever a window is added to the group.

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • blur

    Called whenever focus is gone from this layout.

  • clone

    Duplicate a layout.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • configure

    Configure the layout.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • focus

    Called whenever the focus changes.

  • focus_first

    Called when the first client in Layout shall be focused.

  • focus_last

    Called when the last client in Layout shall be focused.

  • focus_next

    Called when the next client in Layout shall be focused.

  • focus_previous

    Called when the previous client in Layout shall be focused.

  • function

    Call a function with current object as argument.

  • hide

    Called when layout is being hidden.

  • info

    Returns a dictionary of layout information.

  • items

    Build a list of contained items for the given item class.

  • remove

    Called whenever a window is removed from the group.

  • select

    Return a selected object.

  • show

    Called when layout is being shown.

  • swap

    Swap the two given clients c1 and c2.

Attributes:

  • group (_Group) –

    Returns the group this layout is attached to.

group property

group: _Group

Returns the group this layout is attached to.

Layouts start out unattached, and are attached when the group is configured and each layout is cloned for every group.

add_client

add_client(client: Window) -> None

Called whenever a window is added to the group.

Called whether the layout is current or not. The layout should just add the window to its internal datastructures, without mapping or configuring.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

blur

blur() -> None

Called whenever focus is gone from this layout.

clone

clone(group: _Group) -> Self

Duplicate a layout.

Make a copy of this layout. This is done to provide each group with a unique instance of every layout.

Parameters:

  • group (_Group) –

    Group to attach new layout instance to.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

configure

configure(client: Window, screen_rect: ScreenRect) -> None

Configure the layout.

This method should:

  • Configure the dimensions and borders of a window using the .place() method.
  • Call either .hide() or .unhide() on the window.

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

focus

focus(win)

Called whenever the focus changes.

focus_first

focus_first() -> Window | None

Called when the first client in Layout shall be focused.

This method should:

  • Return the first client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_last

focus_last() -> Window | None

Called when the last client in Layout shall be focused.

This method should:

  • Return the last client in Layout, if any.
  • Not focus the client itself, this is done by caller.

focus_next

focus_next(window: Window) -> Window | None

Called when the next client in Layout shall be focused.

This method should:

  • Return the next client in Layout, if any.
  • Return None if the next client would be the first client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

focus_previous

focus_previous(window: Window) -> Window | None

Called when the previous client in Layout shall be focused.

This method should:

  • Return the previous client in Layout, if any.
  • Return None if the previous client would be the last client.
  • Not focus the client itself, this is done by caller.

Do not implement a full cycle here, because the Groups cycling relies on returning None here if the end of Layout is hit, such that Floating clients are included in cycle.

Parameters:

  • win (Window) –

    The currently focused client.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

hide

hide() -> None

Called when layout is being hidden.

info

info() -> dict[str, Any]

Returns a dictionary of layout information.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

remove

remove(client: Window) -> Window | None

Called whenever a window is removed from the group.

Called whether the layout is current or not. The layout should just de-register the window from its data structures, without unmapping the window.

Returns the "next" window that should gain focus or None.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

show

show(screen_rect: ScreenRect) -> None

Called when layout is being shown.

swap

swap(window1: Window, window2: Window) -> None

Swap the two given clients c1 and c2.