1
0
Fork 0
forked from wry/wry

toml-config: add set/unset variants of toggle actions

This commit is contained in:
Julian Orth 2025-05-01 21:41:21 +02:00
parent c5818dcd32
commit bc6a9ad94d
6 changed files with 72 additions and 0 deletions

View file

@ -53,9 +53,13 @@ pub enum SimpleCommand {
ReloadConfigToml, ReloadConfigToml,
Split(Axis), Split(Axis),
ToggleFloating, ToggleFloating,
SetFloating(bool),
ToggleFullscreen, ToggleFullscreen,
SetFullscreen(bool),
ToggleMono, ToggleMono,
SetMono(bool),
ToggleSplit, ToggleSplit,
SetSplit(Axis),
Forward(bool), Forward(bool),
EnableWindowManagement(bool), EnableWindowManagement(bool),
SetFloatAboveFullscreen(bool), SetFloatAboveFullscreen(bool),

View file

@ -104,12 +104,20 @@ impl ActionParser<'_> {
"split-horizontal" => Split(Horizontal), "split-horizontal" => Split(Horizontal),
"split-vertical" => Split(Vertical), "split-vertical" => Split(Vertical),
"toggle-split" => ToggleSplit, "toggle-split" => ToggleSplit,
"tile-horizontal" => SetSplit(Horizontal),
"tile-vertical" => SetSplit(Vertical),
"toggle-mono" => ToggleMono, "toggle-mono" => ToggleMono,
"show-single" => SetMono(true),
"show-all" => SetMono(false),
"toggle-fullscreen" => ToggleFullscreen, "toggle-fullscreen" => ToggleFullscreen,
"enter-fullscreen" => SetFullscreen(true),
"exit-fullscreen" => SetFullscreen(false),
"focus-parent" => FocusParent, "focus-parent" => FocusParent,
"close" => Close, "close" => Close,
"disable-pointer-constraint" => DisablePointerConstraint, "disable-pointer-constraint" => DisablePointerConstraint,
"toggle-floating" => ToggleFloating, "toggle-floating" => ToggleFloating,
"float" => SetFloating(true),
"tile" => SetFloating(false),
"quit" => Quit, "quit" => Quit,
"reload-config-toml" => ReloadConfigToml, "reload-config-toml" => ReloadConfigToml,
"reload-config-so" => ReloadConfigSo, "reload-config-so" => ReloadConfigSo,

View file

@ -86,14 +86,18 @@ impl Action {
SimpleCommand::Move(dir) => B::new(move || s.move_(dir)), SimpleCommand::Move(dir) => B::new(move || s.move_(dir)),
SimpleCommand::Split(axis) => B::new(move || s.create_split(axis)), SimpleCommand::Split(axis) => B::new(move || s.create_split(axis)),
SimpleCommand::ToggleSplit => B::new(move || s.toggle_split()), 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::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::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::FocusParent => B::new(move || s.focus_parent()),
SimpleCommand::Close => B::new(move || s.close()), SimpleCommand::Close => B::new(move || s.close()),
SimpleCommand::DisablePointerConstraint => { SimpleCommand::DisablePointerConstraint => {
B::new(move || s.disable_pointer_constraint()) B::new(move || s.disable_pointer_constraint())
} }
SimpleCommand::ToggleFloating => B::new(move || s.toggle_floating()), SimpleCommand::ToggleFloating => B::new(move || s.toggle_floating()),
SimpleCommand::SetFloating(b) => B::new(move || s.set_floating(b)),
SimpleCommand::Quit => B::new(quit), SimpleCommand::Quit => B::new(quit),
SimpleCommand::ReloadConfigToml => { SimpleCommand::ReloadConfigToml => {
let persistent = state.persistent.clone(); let persistent = state.persistent.clone();

View file

@ -1357,12 +1357,20 @@
"split-horizontal", "split-horizontal",
"split-vertical", "split-vertical",
"toggle-split", "toggle-split",
"tile-horizontal",
"tile-vertical",
"toggle-mono", "toggle-mono",
"show-single",
"show-all",
"toggle-fullscreen", "toggle-fullscreen",
"enter-fullscreen",
"exit-fullscreen",
"focus-parent", "focus-parent",
"close", "close",
"disable-pointer-constraint", "disable-pointer-constraint",
"toggle-floating", "toggle-floating",
"float",
"tile",
"quit", "quit",
"reload-config-toml", "reload-config-toml",
"reload-config-to", "reload-config-to",

View file

@ -2991,14 +2991,38 @@ The string should have one of the following values:
Toggle the split of the currently focused container between vertical and Toggle the split of the currently focused container between vertical and
horizontal. 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-mono`:
Toggle the currently focused container between showing a single and all children. 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-fullscreen`:
Toggle the currently focused window between fullscreen and windowed. 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-parent`:
Focus the parent of the currently focused window. 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. Toggle the currently focused window between floating and tiled.
- `float`:
Makes the currently focused window floating.
- `tile`:
Makes the currently focused window tiled.
- `quit`: - `quit`:
Terminate the compositor. Terminate the compositor.

View file

@ -726,11 +726,23 @@ SimpleActionName:
description: | description: |
Toggle the split of the currently focused container between vertical and Toggle the split of the currently focused container between vertical and
horizontal. 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 - value: toggle-mono
description: | description: |
Toggle the currently focused container between showing a single and all children. 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 - value: toggle-fullscreen
description: Toggle the currently focused window between fullscreen and windowed. 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 - value: focus-parent
description: Focus the parent of the currently focused window. description: Focus the parent of the currently focused window.
- value: close - value: close
@ -743,6 +755,10 @@ SimpleActionName:
The constraint will be re-enabled when the pointer re-enters the window. The constraint will be re-enabled when the pointer re-enters the window.
- value: toggle-floating - value: toggle-floating
description: Toggle the currently focused window between floating and tiled. 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 - value: quit
description: Terminate the compositor. description: Terminate the compositor.
- value: reload-config-toml - value: reload-config-toml