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_defaults
¶
add_defaults(defaults)
Add defaults to this object, overwriting any which already exist.
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
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
¶
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_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.
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.
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
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.
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.