From bc6a9ad94d2f8c8a1e148b1750b85e1707c83f68 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Thu, 1 May 2025 21:41:21 +0200 Subject: [PATCH] toml-config: add set/unset variants of toggle actions --- toml-config/src/config.rs | 4 +++ toml-config/src/config/parsers/action.rs | 8 ++++++ toml-config/src/lib.rs | 4 +++ toml-spec/spec/spec.generated.json | 8 ++++++ toml-spec/spec/spec.generated.md | 32 ++++++++++++++++++++++++ toml-spec/spec/spec.yaml | 16 ++++++++++++ 6 files changed, 72 insertions(+) diff --git a/toml-config/src/config.rs b/toml-config/src/config.rs index eedd0076..7b4a91c5 100644 --- a/toml-config/src/config.rs +++ b/toml-config/src/config.rs @@ -53,9 +53,13 @@ pub enum SimpleCommand { ReloadConfigToml, Split(Axis), ToggleFloating, + SetFloating(bool), ToggleFullscreen, + SetFullscreen(bool), ToggleMono, + SetMono(bool), ToggleSplit, + SetSplit(Axis), Forward(bool), EnableWindowManagement(bool), SetFloatAboveFullscreen(bool), diff --git a/toml-config/src/config/parsers/action.rs b/toml-config/src/config/parsers/action.rs index 1bc66f55..4457f42b 100644 --- a/toml-config/src/config/parsers/action.rs +++ b/toml-config/src/config/parsers/action.rs @@ -104,12 +104,20 @@ impl ActionParser<'_> { "split-horizontal" => Split(Horizontal), "split-vertical" => Split(Vertical), "toggle-split" => ToggleSplit, + "tile-horizontal" => SetSplit(Horizontal), + "tile-vertical" => SetSplit(Vertical), "toggle-mono" => ToggleMono, + "show-single" => SetMono(true), + "show-all" => SetMono(false), "toggle-fullscreen" => ToggleFullscreen, + "enter-fullscreen" => SetFullscreen(true), + "exit-fullscreen" => SetFullscreen(false), "focus-parent" => FocusParent, "close" => Close, "disable-pointer-constraint" => DisablePointerConstraint, "toggle-floating" => ToggleFloating, + "float" => SetFloating(true), + "tile" => SetFloating(false), "quit" => Quit, "reload-config-toml" => ReloadConfigToml, "reload-config-so" => ReloadConfigSo, diff --git a/toml-config/src/lib.rs b/toml-config/src/lib.rs index aa136e4e..f19cc546 100644 --- a/toml-config/src/lib.rs +++ b/toml-config/src/lib.rs @@ -86,14 +86,18 @@ impl Action { SimpleCommand::Move(dir) => B::new(move || s.move_(dir)), SimpleCommand::Split(axis) => B::new(move || s.create_split(axis)), SimpleCommand::ToggleSplit => B::new(move || s.toggle_split()), + SimpleCommand::SetSplit(b) => B::new(move || s.set_split(b)), SimpleCommand::ToggleMono => B::new(move || s.toggle_mono()), + SimpleCommand::SetMono(b) => B::new(move || s.set_mono(b)), SimpleCommand::ToggleFullscreen => B::new(move || s.toggle_fullscreen()), + SimpleCommand::SetFullscreen(b) => B::new(move || s.set_fullscreen(b)), SimpleCommand::FocusParent => B::new(move || s.focus_parent()), SimpleCommand::Close => B::new(move || s.close()), SimpleCommand::DisablePointerConstraint => { B::new(move || s.disable_pointer_constraint()) } SimpleCommand::ToggleFloating => B::new(move || s.toggle_floating()), + SimpleCommand::SetFloating(b) => B::new(move || s.set_floating(b)), SimpleCommand::Quit => B::new(quit), SimpleCommand::ReloadConfigToml => { let persistent = state.persistent.clone(); diff --git a/toml-spec/spec/spec.generated.json b/toml-spec/spec/spec.generated.json index 23d55c17..1f05aa76 100644 --- a/toml-spec/spec/spec.generated.json +++ b/toml-spec/spec/spec.generated.json @@ -1357,12 +1357,20 @@ "split-horizontal", "split-vertical", "toggle-split", + "tile-horizontal", + "tile-vertical", "toggle-mono", + "show-single", + "show-all", "toggle-fullscreen", + "enter-fullscreen", + "exit-fullscreen", "focus-parent", "close", "disable-pointer-constraint", "toggle-floating", + "float", + "tile", "quit", "reload-config-toml", "reload-config-to", diff --git a/toml-spec/spec/spec.generated.md b/toml-spec/spec/spec.generated.md index c12423dd..aeca6373 100644 --- a/toml-spec/spec/spec.generated.md +++ b/toml-spec/spec/spec.generated.md @@ -2991,14 +2991,38 @@ The string should have one of the following values: Toggle the split of the currently focused container between vertical and horizontal. +- `tile-horizontal`: + + Sets the split of the currently focused container to horizontal. + +- `tile-vertical`: + + Sets the split of the currently focused container to vertical. + - `toggle-mono`: Toggle the currently focused container between showing a single and all children. +- `show-single`: + + Makes the currently focused container show a single child. + +- `show-all`: + + Makes the currently focused container show all children. + - `toggle-fullscreen`: Toggle the currently focused window between fullscreen and windowed. +- `enter-fullscreen`: + + Makes the currently focused window fullscreen. + +- `exit-fullscreen`: + + Makes the currently focused window windowed. + - `focus-parent`: Focus the parent of the currently focused window. @@ -3018,6 +3042,14 @@ The string should have one of the following values: Toggle the currently focused window between floating and tiled. +- `float`: + + Makes the currently focused window floating. + +- `tile`: + + Makes the currently focused window tiled. + - `quit`: Terminate the compositor. diff --git a/toml-spec/spec/spec.yaml b/toml-spec/spec/spec.yaml index 86b3c7e5..50761da3 100644 --- a/toml-spec/spec/spec.yaml +++ b/toml-spec/spec/spec.yaml @@ -726,11 +726,23 @@ SimpleActionName: description: | Toggle the split of the currently focused container between vertical and horizontal. + - value: tile-horizontal + description: Sets the split of the currently focused container to horizontal. + - value: tile-vertical + description: Sets the split of the currently focused container to vertical. - value: toggle-mono description: | Toggle the currently focused container between showing a single and all children. + - value: show-single + description: Makes the currently focused container show a single child. + - value: show-all + description: Makes the currently focused container show all children. - value: toggle-fullscreen description: Toggle the currently focused window between fullscreen and windowed. + - value: enter-fullscreen + description: Makes the currently focused window fullscreen. + - value: exit-fullscreen + description: Makes the currently focused window windowed. - value: focus-parent description: Focus the parent of the currently focused window. - value: close @@ -743,6 +755,10 @@ SimpleActionName: The constraint will be re-enabled when the pointer re-enters the window. - value: toggle-floating description: Toggle the currently focused window between floating and tiled. + - value: float + description: Makes the currently focused window floating. + - value: tile + description: Makes the currently focused window tiled. - value: quit description: Terminate the compositor. - value: reload-config-toml