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.
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
¶
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
¶
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_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.
items
¶
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.