A daemon that handles sway/i3 layout management on a per-workspace basis
Project description
layman
layman is a daemon that handles layout management on a per-workspace basis. Each WorkspaceLayoutManager (WLM) is
responsible for managing all of the tiling windows on a given workspace.
WLMs are intended to have a simpler set of events than those provided though i3ipc-python, since the scope is limited to a single workspace. See the User Created Layouts section for how to add a new layout.
Usage: layman.py [options]
Options:
-h, --help show this help message and exit
-c .config/layman/config.toml, --config=.config/layman/config.toml
Path to user config file.
Installation
I intend to provide installation through PyPi using pip, however the original name of this project swlm was forbidden for
being too similar to another package, swmm. After rebranding to layman, the name is still forbidden for an unkown reason.
Until this is resolved, please use the instructions below.
For Arch users, layman-git is available on the AUR courtesy of matclab
Installing from source
git clone https://github.com/frap129/layman
pip install ~/path/to/layman
to package and install layman. If you do not want to have to reinstall after a change, add --editable to the pip command
Configuration
layman is configured using the config file at $HOME/.config/layman/config.toml. The [layman] table configures
options for layman, and defaults options for WLMs. Specific outputs and workspaces can be configured using
[output.VALUE] or [workspace.VALUE] header, where VALUE is the name of the output or the workspace number.
Any options configured will override the values set in the [layman] table for that output or workspace. For an example
configuration, see the config.toml file in the root of this repo.
Note, values configured for outputs will only apply to workspaces created on that output.
The config can be reloaded at runtime with nop layman reload set on a bindsym. Note that this reloads the config, but
not the layout managers. Config changes for existing layouts won't take affect until the managers is reset with
nop layman layout <layout short name>.
Layout Managers
The layout manager controlling a workspace can be changed using the command nop layman layout <LAYOUT>. In order to
handle window movement in layouts that don't use standard up/down/left/right, a WLM can override these commands with better
defaults, and layman will fall back the regular command for WLMs that don't. To use the WLM provided movement commands,
replace your move <direction> bindsyms with
# Override move binds
bindsym $mod+Shift+Left nop layman move left
bindsym $mod+Shift+Down nop layman move down
bindsym $mod+Shift+Up nop layman move up
bindsym $mod+Shift+Right nop layman move right
The src/mananagers/ directoy contains files that each hold an implementation of a WLM, with WorkspaceLayoutManager.py
containing the parent class from which all WLMs are derived.
none
The none layout manager does not manage any windows. It exists as a reference implementation, and to allow users
to disable layout management on a given workspace.
Binding:
bindym <your bind here> nop layman layout none # disable layout management on a workspace
Autotiling
Based on nwg-piotr's autotiling,
the Autotiling layout manager alternates between splith and splitv based on a windows height/width ratio.
Config options:
depthLimit: Max number of nested splits [0 means no limit]
Binding:
bindym <your bind here> nop layman layout Autotiling # set focused workspace's layout manager to Autotiling
Grid
Like autotiling, Grid splits window based on width/height ratio. It differs from Autotiling by always splttting the largest existing window, rather than the currently focused window. If multiple windows have the same size, Grid tries to split the left-most and top-most "largest" window. This results in a grid-like pattern.
Binding:
bindym <your bind here> nop layman layout Grid # set focused workspace's layout manager to Grid
MasterStack
MasterStack is inspired by dwm/dwl/river, but is my own take on it. It implements a master window with a stack
on the side. When a new window is created, it replaces master and master is placed on top of the stack.
If the master window is deleted, the top of the stack replaces master. The layout of the stack container can be
splitv, tabbed, or stacking. The layout of the stack can be toggled using a keybind.
MasterStack also implements a keybind for swapping. When swapping, the focused window is swapped with master. If
the focused window is master, it gets swapped with the top of the stack. MasterStack also implements rotation.
When rotating left, master is moved to the bottom of the stack, and the top of the stack becomes master.
Rotating right moves master to the top of the stack, and the bottom of the stack becomes master.
MasterStack provides overrides for move <directon> binds.
Known bugs:
- Sometimes existing windows get missed when arranging an existing layout
Config options:
masterWidth: Int to control the percent width of master window [1-99]
stackLayout: String to control the layout of the stack ["splitv", "tabbed", "stacking"]
stackSide: String to control which side of the screen the stack is on ["right", "left"]
Bindings:
bindym <your bind here> nop layman layout MasterStack # set focused workspace's layout manager to MasterStack
bindym <your bind here> nop layman swap master # swap focused window with master
bindym <your bind here> nop layman rotate cw # rotate layout cw 1 window
bindym <your bind here> nop layman rotate ccw # rotate layout ccw 1 window
bindym <your bind here> nop layman move up # move focused winodw up 1 position in the stack
bindym <your bind here> nop layman move down # move focused window down one position in the stack
bindym <your bind here> nop layman stack toggle # toggles stack layout through splitv, tabbed, and stacking
bindym <your bind here> nop layman stackside toggle # toggles stack side between left and right
User Created Layouts
You can create layouts that get picked up and managed by layman without modifying layman itself. Any python file placed
in the same directory as the config file will be automatically imported by layman at startup, and any time the
configuration is reloaded. To get started writing your own layouts, take a look at src/mangers/WorkspaceLayoutManger.py
in this repo. This is the base class from which your layout must inherit, and provides a number of hooks and functions
for handling window events. src/managers/AutotilingLayoutManager.py is a simple example of how to implement a WLM.
When making a WLM, make sure that it has a unique shortname.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file layman-0.1.0-py3-none-any.whl.
File metadata
- Download URL: layman-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23c189d62cad9e20aa193a372b6c5da320b7828f0ecbeffa34d848f213668111
|
|
| MD5 |
0609ba0be9fac4f14c81f09f5fb05bb3
|
|
| BLAKE2b-256 |
c85e10df3b5c029c1a16502cde41fb00c9437c155c2ade6680af325823048ae8
|