Skip to content

Commit

Permalink
Change layout engine YAML config to snake case (#1053)
Browse files Browse the repository at this point in the history
Changed the layout engine YAML config to snake case, for consistency with nearly everything else in the YAML config.
  • Loading branch information
dalyIsaac authored Oct 13, 2024
1 parent 6aaeb1c commit 78c8c3f
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 71 deletions.
64 changes: 32 additions & 32 deletions docs/configure/core/layout-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,59 @@ A "layout engine" or <xref:Whim.ILayoutEngine> in Whim is responsible for arrang

## Available layout engines

| Engine | TL;DR |
| ----------------------------------------- | ------------------------------------------------------------------------ |
| [`FocusLayoutEngine`](#focuslayoutengine) | One window at a time |
| [`SliceLayoutEngine`](#slicelayoutengine) | `Awesome`/`dwm`-style dynamic tiling (primary/stack, multi-column, etc.) |
| [`TreeLayoutEngine`](#treelayoutengine) | `i3`-style dynamic tiling (arbitrary grids) |
| Engine | TL;DR |
| ----------------- | ------------------------------------------------------------------------ |
| [`focus`](#focus) | One window at a time |
| [`slice`](#slice) | `Awesome`/`dwm`-style dynamic tiling (primary/stack, multi-column, etc.) |
| [`tree`](#tree) | `i3`-style dynamic tiling (arbitrary grids) |

## Example Usage

```yaml
layout_engines:
entries:
- type: TreeLayoutEngine
- type: tree
initial_direction: right

- type: SliceLayoutEngine
- type: slice
variant:
type: row

- type: SliceLayoutEngine
- type: slice
variant:
type: column

- type: SliceLayoutEngine
- type: slice
variant:
type: primary_stack

- type: SliceLayoutEngine
- type: slice
variant:
type: secondary_primary_stack

- type: SliceLayoutEngine
- type: slice
variant:
type: multi_column_stack
columns: [2, 1, 0]

- type: SliceLayoutEngine
- type: slice
variant:
type: secondary_primary_stack
primary_capacity: 1
secondary_capacity: 2

- type: FocusLayoutEngine
- type: focus
maximize: false
```
## `FocusLayoutEngine`
## `focus`

The `FocusLayoutEngine` is a layout engine that displays one window at a time.
The `focus` layout engine displays one window at a time.

```yaml
layout_engines:
entries:
- type: FocusLayoutEngine
- type: focus
maximize: false
```

Expand All @@ -66,15 +66,15 @@ To reorder windows, calling `whim.core.swap_window_in_direction.(left|right|up|d

Windows which are not focused are minimized to the taskbar.

![FocusLayoutEngine demo](../../images/focus-layout-demo.gif)
![Focus demo](../../images/focus-layout-demo.gif)

## `SliceLayoutEngine`
## `slice`

`SliceLayoutEngine` is an `Awesome`/`dwm`-style layout engine, which arranges following a deterministic algorithm filling a grid configured in the config file.
The `slice` layout engine, inspired by `Awesome` and `dwm`, arranges windows in a configurable grid according to deterministic algorithm.

The YAML/JSON configuration supports built-in layouts, such as primary/stack, multi-column, and secondary primary stack. Arbitrary layouts can be created by nesting areas in the C# configuration - see [Defining different `SliceLayouts`](../../script/core/layout-engines.md#defining-different-slicelayouts)

Commands for the `SliceLayoutEngine` can be found on the [Slice Layout](../plugins/slice-layout.md#commands) plugin page.
Commands for the `slice` layout engine can be found on the [Slice Layout](../plugins/slice-layout.md#commands) plugin page.

### Layout Variants

Expand All @@ -86,7 +86,7 @@ Commands for the `SliceLayoutEngine` can be found on the [Slice Layout](../plugi
```yaml
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant: column
```

Expand All @@ -98,7 +98,7 @@ Commands for the `SliceLayoutEngine` can be found on the [Slice Layout](../plugi
```yaml
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant: row
```

Expand All @@ -110,7 +110,7 @@ Commands for the `SliceLayoutEngine` can be found on the [Slice Layout](../plugi
```yaml
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant: primary_stack
```

Expand All @@ -124,7 +124,7 @@ Commands for the `SliceLayoutEngine` can be found on the [Slice Layout](../plugi
```yaml
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant: multi_column_stack
columns: [2, 1, 0]
```
Expand All @@ -140,30 +140,30 @@ Commands for the `SliceLayoutEngine` can be found on the [Slice Layout](../plugi
```yaml
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant: secondary_primary_stack
primary_capacity: 1
secondary_capacity: 2
```

![SliceLayoutEngine demo](../../images/slice-layout-demo.gif)
![Slice demo](../../images/slice-layout-demo.gif)

## `TreeLayoutEngine`
## `tree`

<xref:Whim.TreeLayout.TreeLayoutEngine> is a layout that allows users to create arbitrary grid layouts, similar to `i3`. Unlike [`SliceLayoutEngine`](#slicelayoutengine), windows can can be added in any location at runtime.
The `tree` layout engine is a layout that allows users to create arbitrary grid layouts, similar to `i3`. Unlike the [`slice`](#slice) layout engine, windows can can be added in any location at runtime.

The `TreeLayoutEngine` supports an `initial_direction` property, which specifies the direction of the first split. The available directions are `left`, `right`, `up`, and `down`.
The `tree` supports an `initial_direction` property, which specifies the direction of the first split. The available directions are `left`, `right`, `up`, and `down`.

```yaml
layout_engines:
entries:
- type: TreeLayoutEngine
- type: tree
initial_direction: right
```

![TreeLayoutEngine demo](../../images/tree-layout-demo.gif)
![Tree demo](../../images/tree-layout-demo.gif)

Commands for the `TreeLayoutEngine` can be found on the [Tree Layout](../plugins/tree-layout.md#commands) plugin page.
Commands for the `tree` layout engine can be found on the [Tree Layout](../plugins/tree-layout.md#commands) plugin page.

## `FloatingLayoutEngine`

Expand Down
16 changes: 8 additions & 8 deletions src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class YamlLayoutEngineLoaderTests
"""
layout_engines:
entries:
- type: FocusLayoutEngine
- type: focus
""",
false,
true
Expand All @@ -25,7 +25,7 @@ public class YamlLayoutEngineLoaderTests
"layout_engines": {
"entries": [
{
"type": "FocusLayoutEngine"
"type": "focus"
}
]
}
Expand All @@ -38,7 +38,7 @@ public class YamlLayoutEngineLoaderTests
"""
layout_engines:
entries:
- type: FocusLayoutEngine
- type: focus
maximize: true
""",
true,
Expand All @@ -50,7 +50,7 @@ public class YamlLayoutEngineLoaderTests
"layout_engines": {
"entries": [
{
"type": "FocusLayoutEngine",
"type": "focus",
"maximize": true
}
]
Expand All @@ -64,7 +64,7 @@ public class YamlLayoutEngineLoaderTests
"""
layout_engines:
entries:
- type: FocusLayoutEngine
- type: focus
maximize: false
""",
false,
Expand All @@ -76,7 +76,7 @@ public class YamlLayoutEngineLoaderTests
"layout_engines": {
"entries": [
{
"type": "FocusLayoutEngine",
"type": "focus",
"maximize": false
}
]
Expand Down Expand Up @@ -113,7 +113,7 @@ public void Load_FocusLayoutEngine(string config, bool maximize, bool isYaml, IC
"""
layout_engines:
entries:
- type: FocusLayoutEngine
- type: focus
maximize: "bob"
""",
true
Expand All @@ -124,7 +124,7 @@ public void Load_FocusLayoutEngine(string config, bool maximize, bool isYaml, IC
"layout_engines": {
"entries": [
{
"type": "FocusLayoutEngine",
"type": "focus",
"maximize": "bob"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class YamlLayoutEngineLoader_SliceLayoutEngineTests
"""
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant:
type: column
""",
Expand All @@ -27,7 +27,7 @@ public class YamlLayoutEngineLoader_SliceLayoutEngineTests
"layout_engines": {
"entries": [
{
"type": "SliceLayoutEngine",
"type": "slice",
"variant": {
"type": "column"
}
Expand Down Expand Up @@ -65,7 +65,7 @@ public void Load_ColumnLayoutEngine(string config, bool isYaml, IContext ctx, IS
"""
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant:
type: row
""",
Expand All @@ -77,7 +77,7 @@ public void Load_ColumnLayoutEngine(string config, bool isYaml, IContext ctx, IS
"layout_engines": {
"entries": [
{
"type": "SliceLayoutEngine",
"type": "slice",
"variant": {
"type": "row"
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public void Load_RowLayoutEngine(string config, bool isYaml, IContext ctx, ISlic
"""
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant:
type: primary_stack
""",
Expand All @@ -127,7 +127,7 @@ public void Load_RowLayoutEngine(string config, bool isYaml, IContext ctx, ISlic
"layout_engines": {
"entries": [
{
"type": "SliceLayoutEngine",
"type": "slice",
"variant": {
"type": "primary_stack"
}
Expand Down Expand Up @@ -165,7 +165,7 @@ public void Load_PrimaryStackLayoutEngine(string config, bool isYaml, IContext c
"""
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant:
type: multi_column_stack
columns: [1, 2, 0, 3]
Expand All @@ -179,7 +179,7 @@ public void Load_PrimaryStackLayoutEngine(string config, bool isYaml, IContext c
"layout_engines": {
"entries": [
{
"type": "SliceLayoutEngine",
"type": "slice",
"variant": {
"type": "multi_column_stack",
"columns": [1, 2, 0, 3]
Expand Down Expand Up @@ -228,7 +228,7 @@ ISliceLayoutPlugin plugin
"""
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant:
type: secondary_primary_stack
primary_capacity: 3
Expand All @@ -244,7 +244,7 @@ ISliceLayoutPlugin plugin
"layout_engines": {
"entries": [
{
"type": "SliceLayoutEngine",
"type": "slice",
"variant": {
"type": "secondary_primary_stack",
"primary_capacity": 3,
Expand All @@ -263,7 +263,7 @@ ISliceLayoutPlugin plugin
"""
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant:
type: secondary_primary_stack
""",
Expand All @@ -277,7 +277,7 @@ ISliceLayoutPlugin plugin
"layout_engines": {
"entries": [
{
"type": "SliceLayoutEngine",
"type": "slice",
"variant": {
"type": "secondary_primary_stack"
}
Expand Down Expand Up @@ -327,7 +327,7 @@ ISliceLayoutPlugin plugin
"""
layout_engines:
entries:
- type: SliceLayoutEngine
- type: slice
variant:
type: invalid
""",
Expand All @@ -339,7 +339,7 @@ ISliceLayoutPlugin plugin
"layout_engines": {
"entries": [
{
"type": "SliceLayoutEngine",
"type": "slice",
"variant": {
"type": "invalid"
}
Expand Down
Loading

0 comments on commit 78c8c3f

Please sign in to comment.