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,
Split(Axis),
ToggleFloating,
SetFloating(bool),
ToggleFullscreen,
SetFullscreen(bool),
ToggleMono,
SetMono(bool),
ToggleSplit,
SetSplit(Axis),
Forward(bool),
EnableWindowManagement(bool),
SetFloatAboveFullscreen(bool),

View file

@ -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,

View file

@ -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();