From 78c8c3ff7e48a657da81cbd2ebc849cf4682b06e Mon Sep 17 00:00:00 2001 From: Isaac Daly Date: Sun, 13 Oct 2024 15:30:56 +1100 Subject: [PATCH] Change layout engine YAML config to snake case (#1053) Changed the layout engine YAML config to snake case, for consistency with nearly everything else in the YAML config. --- docs/configure/core/layout-engines.md | 64 +++++++++---------- .../Layouts/YamlLayoutEngineLoaderTests.cs | 16 ++--- ...youtEngineLoader_SliceLayoutEngineTests.cs | 28 ++++---- ...ayoutEngineLoader_TreeLayoutEngineTests.cs | 20 +++--- .../YamlLoader_LoadWorkspacesTests.cs | 8 +-- src/Whim.Yaml/schema.json | 6 +- 6 files changed, 71 insertions(+), 71 deletions(-) diff --git a/docs/configure/core/layout-engines.md b/docs/configure/core/layout-engines.md index 927577ac3..e61b47a20 100644 --- a/docs/configure/core/layout-engines.md +++ b/docs/configure/core/layout-engines.md @@ -4,59 +4,59 @@ A "layout engine" or 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 ``` @@ -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 @@ -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 ``` @@ -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 ``` @@ -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 ``` @@ -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] ``` @@ -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` - 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` diff --git a/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoaderTests.cs b/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoaderTests.cs index 4765fc622..68ad30d70 100644 --- a/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoaderTests.cs +++ b/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoaderTests.cs @@ -14,7 +14,7 @@ public class YamlLayoutEngineLoaderTests """ layout_engines: entries: - - type: FocusLayoutEngine + - type: focus """, false, true @@ -25,7 +25,7 @@ public class YamlLayoutEngineLoaderTests "layout_engines": { "entries": [ { - "type": "FocusLayoutEngine" + "type": "focus" } ] } @@ -38,7 +38,7 @@ public class YamlLayoutEngineLoaderTests """ layout_engines: entries: - - type: FocusLayoutEngine + - type: focus maximize: true """, true, @@ -50,7 +50,7 @@ public class YamlLayoutEngineLoaderTests "layout_engines": { "entries": [ { - "type": "FocusLayoutEngine", + "type": "focus", "maximize": true } ] @@ -64,7 +64,7 @@ public class YamlLayoutEngineLoaderTests """ layout_engines: entries: - - type: FocusLayoutEngine + - type: focus maximize: false """, false, @@ -76,7 +76,7 @@ public class YamlLayoutEngineLoaderTests "layout_engines": { "entries": [ { - "type": "FocusLayoutEngine", + "type": "focus", "maximize": false } ] @@ -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 @@ -124,7 +124,7 @@ public void Load_FocusLayoutEngine(string config, bool maximize, bool isYaml, IC "layout_engines": { "entries": [ { - "type": "FocusLayoutEngine", + "type": "focus", "maximize": "bob" } ] diff --git a/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_SliceLayoutEngineTests.cs b/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_SliceLayoutEngineTests.cs index 64824434e..f821124bb 100644 --- a/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_SliceLayoutEngineTests.cs +++ b/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_SliceLayoutEngineTests.cs @@ -15,7 +15,7 @@ public class YamlLayoutEngineLoader_SliceLayoutEngineTests """ layout_engines: entries: - - type: SliceLayoutEngine + - type: slice variant: type: column """, @@ -27,7 +27,7 @@ public class YamlLayoutEngineLoader_SliceLayoutEngineTests "layout_engines": { "entries": [ { - "type": "SliceLayoutEngine", + "type": "slice", "variant": { "type": "column" } @@ -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 """, @@ -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" } @@ -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 """, @@ -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" } @@ -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] @@ -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] @@ -228,7 +228,7 @@ ISliceLayoutPlugin plugin """ layout_engines: entries: - - type: SliceLayoutEngine + - type: slice variant: type: secondary_primary_stack primary_capacity: 3 @@ -244,7 +244,7 @@ ISliceLayoutPlugin plugin "layout_engines": { "entries": [ { - "type": "SliceLayoutEngine", + "type": "slice", "variant": { "type": "secondary_primary_stack", "primary_capacity": 3, @@ -263,7 +263,7 @@ ISliceLayoutPlugin plugin """ layout_engines: entries: - - type: SliceLayoutEngine + - type: slice variant: type: secondary_primary_stack """, @@ -277,7 +277,7 @@ ISliceLayoutPlugin plugin "layout_engines": { "entries": [ { - "type": "SliceLayoutEngine", + "type": "slice", "variant": { "type": "secondary_primary_stack" } @@ -327,7 +327,7 @@ ISliceLayoutPlugin plugin """ layout_engines: entries: - - type: SliceLayoutEngine + - type: slice variant: type: invalid """, @@ -339,7 +339,7 @@ ISliceLayoutPlugin plugin "layout_engines": { "entries": [ { - "type": "SliceLayoutEngine", + "type": "slice", "variant": { "type": "invalid" } diff --git a/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_TreeLayoutEngineTests.cs b/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_TreeLayoutEngineTests.cs index fae08940d..dcbcd56e2 100644 --- a/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_TreeLayoutEngineTests.cs +++ b/src/Whim.Yaml.Tests/Layouts/YamlLayoutEngineLoader_TreeLayoutEngineTests.cs @@ -15,7 +15,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests """ layout_engines: entries: - - type: TreeLayoutEngine + - type: tree initial_direction: left """, true, @@ -27,7 +27,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests "layout_engines": { "entries": [ { - "type": "TreeLayoutEngine", + "type": "tree", "initial_direction": "left" } ] @@ -41,7 +41,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests """ layout_engines: entries: - - type: TreeLayoutEngine + - type: tree initial_direction: right """, true, @@ -53,7 +53,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests "layout_engines": { "entries": [ { - "type": "TreeLayoutEngine", + "type": "tree", "initial_direction": "right" } ] @@ -67,7 +67,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests """ layout_engines: entries: - - type: TreeLayoutEngine + - type: tree initial_direction: up """, true, @@ -79,7 +79,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests "layout_engines": { "entries": [ { - "type": "TreeLayoutEngine", + "type": "tree", "initial_direction": "up" } ] @@ -93,7 +93,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests """ layout_engines: entries: - - type: TreeLayoutEngine + - type: tree initial_direction: down """, true, @@ -105,7 +105,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests "layout_engines": { "entries": [ { - "type": "TreeLayoutEngine", + "type": "tree", "initial_direction": "down" } ] @@ -120,7 +120,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests """ layout_engines: entries: - - type: TreeLayoutEngine + - type: tree """, true, Direction.Right @@ -131,7 +131,7 @@ public class YamlLayoutEngineLoader_TreeLayoutEngineTests "layout_engines": { "entries": [ { - "type": "TreeLayoutEngine" + "type": "tree" } ] } diff --git a/src/Whim.Yaml.Tests/YamlLoader/YamlLoader_LoadWorkspacesTests.cs b/src/Whim.Yaml.Tests/YamlLoader/YamlLoader_LoadWorkspacesTests.cs index 88041d3b7..14dd0b64f 100644 --- a/src/Whim.Yaml.Tests/YamlLoader/YamlLoader_LoadWorkspacesTests.cs +++ b/src/Whim.Yaml.Tests/YamlLoader/YamlLoader_LoadWorkspacesTests.cs @@ -20,8 +20,8 @@ public class YamlLoader_LoadWorkspacesTests - name: workspace3 layout_engines: entries: - - type: FocusLayoutEngine - - type: SliceLayoutEngine + - type: focus + - type: slice variant: type: column """, @@ -43,10 +43,10 @@ public class YamlLoader_LoadWorkspacesTests "layout_engines": { "entries": [ { - "type": "FocusLayoutEngine" + "type": "focus" }, { - "type": "SliceLayoutEngine", + "type": "slice", "variant": { "type": "column" } diff --git a/src/Whim.Yaml/schema.json b/src/Whim.Yaml/schema.json index 27e5bda64..4360e2112 100644 --- a/src/Whim.Yaml/schema.json +++ b/src/Whim.Yaml/schema.json @@ -160,7 +160,7 @@ "required": ["type"], "additionalProperties": false, "properties": { - "type": { "const": "FocusLayoutEngine" }, + "type": { "const": "focus" }, "maximize": { "type": "boolean", "description": "Whether the focused window should be maximized", @@ -175,7 +175,7 @@ "required": ["type", "variant"], "additionalProperties": false, "properties": { - "type": { "const": "SliceLayoutEngine" }, + "type": { "const": "slice" }, "variant": { "anyOf": [ { @@ -263,7 +263,7 @@ "required": ["type"], "additionalProperties": false, "properties": { - "type": { "const": "TreeLayoutEngine" }, + "type": { "const": "tree" }, "initial_direction": { "anyOf": [ {