layout-machi/README.md

113 lines
3.3 KiB
Markdown
Raw Normal View History

2019-07-04 23:32:05 +02:00
# layout-machi
2019-07-05 05:11:36 +02:00
A manual layout for Awesome with a rapid interactive editor.
2019-07-04 23:32:05 +02:00
## Why?
2019-07-04 23:43:49 +02:00
TL;DR --- I want the control of my layout.
2019-07-04 23:43:24 +02:00
2019-07-04 23:32:05 +02:00
1. Dynamic tiling is an overkill, since tiling is only useful for persistent windows, and people extensively use hibernate/sleep these days.
2. I don't want to have all windows moving around whenever a new window shows up.
2019-07-04 23:39:05 +02:00
3. I want to have a flexible layout such that I can quickly adjust to whatever I need.
2019-07-04 23:32:05 +02:00
## Use the layout
2019-07-07 20:22:01 +02:00
Use `layout = layout_machi.layout.create()` to instantiate the layout.
2019-07-04 23:32:05 +02:00
2019-07-07 20:22:01 +02:00
## Editor
2019-07-04 23:32:05 +02:00
2019-07-06 06:10:04 +02:00
Call `editor = layout_machi.editor.create()` to create an editor that can either
2019-07-04 23:32:05 +02:00
- Interactively edit layout by calling `editor.start_interactive()`
- Set the layout with batched commands by calling `editor.set_by_cmd(cmd)`, where cmd is a string
2019-07-04 23:32:05 +02:00
`data` is an object for storing the history of the editing, initially `{}`.
### The layout editing command
2019-07-06 06:10:04 +02:00
The editing starts with the open area of the entire workarea, takes commands to split the current area into multiple sub-areas, then recursively edits each of them.
The editor is keyboard driven, each command is a key with at most 2 digits as parameters (A, B) before the command.
2019-07-05 05:27:01 +02:00
Undefined parameters are (mostly) treated as 1.
2019-07-04 23:32:05 +02:00
1. `Up`/`Down`: restore to the history command sequence
2. `h`/`v`: split the current region horizontally/vertically into 2 regions. The split will respect the ratio A:B.
2019-07-05 05:27:01 +02:00
3. `w`: Take two parameters (A, B), and split the current region equally into A columns and B rows. If no parameter is defined, behave the same as `Space` without parameters.
2019-07-05 16:26:37 +02:00
4. `s`: shift the current editing region with other open regions. If A is defined, shift for A times.
2019-07-04 23:32:05 +02:00
5. `Space` or `-`: Without parameters, close the current region and move to the next open region. With parameters, set the maximum depth of splitting (default is 2).
6. `Enter`/`.`: close all open regions. When all regions are closed, press `Enter` will save the layout and exit the editor.
2019-07-04 23:32:05 +02:00
7. `Backspace`: undo the last command.
8. `Escape`: exit the editor without saving the layout.
For examples:
2019-07-04 23:32:05 +02:00
h-v
```
11 22
11 22
11
2019-07-04 23:32:05 +02:00
11 33
11 33
```
hvv (or 22w)
```
11 33
11 33
22 44
22 44
```
2019-07-04 23:55:10 +02:00
3-13h2v--2h-12v
2019-07-05 05:20:30 +02:00
Details:
- `3-`: set the maximum editing depth to 3
- `13h`: horizontally split the initial region (entire desktop) to the ratio of 1:3
- For the left part:
- `2v`: vertically split the region to the ratio of 2:1
- `--`: ignore further editing the splitted regions
- For the right part:
- `2h`: horizontally split the region to the ratio of 2:1
- `-`: ignore the left part of the splitted regions
- `12v`: split the right part vertically to the ratio of 1:2
Tada!
2019-07-04 23:55:10 +02:00
```
11 3333 44
11 3333 44
11 3333
11 3333 55
3333 55
22 3333 55
22 3333 55
```
2019-07-05 01:09:17 +02:00
### Persistent history
2019-07-06 06:13:31 +02:00
By default, the last 100 command sequences are stored in `~/.machi_history`.
2019-07-06 06:10:04 +02:00
To change that, please refer to `editor.lua`. (XXX more documents)
2019-07-05 23:13:59 +02:00
2019-07-07 20:22:01 +02:00
## Switcher
Calling `layout_machi.switcher.start()` will create a switcher that can (1) move window/focus into other regions by direction keys, and (2) switch windows in the same regions using `Tab` key.
2019-07-05 01:09:17 +02:00
## Other functions
2019-07-06 06:19:41 +02:00
`layout_machi.editor.fit_region(c, cycle)` will fit a floating client into the closest region.
If `cycle` is true, it then moves the window by cycling all regions.
2019-07-04 23:32:05 +02:00
2019-07-05 22:14:40 +02:00
## TODO
2019-07-05 23:13:59 +02:00
- Tabs on regions?
2019-07-05 22:14:40 +02:00
2019-07-04 23:32:05 +02:00
## License
Apache 2.0 --- See LICENSE