Skip to content

Commit 1bed84d

Browse files
authored
Merge pull request #361 from sashetophizika/dwindle
feat: added dwindle layout dispatchers
2 parents 928fe40 + 2183140 commit 1bed84d

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/dispatch.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,17 @@ impl std::fmt::Display for SignalType {
352352
}
353353
}
354354

355+
#[derive(Debug, Clone, Copy, Display)]
356+
/// This enum holds the params to the [DispatchType::MoveToRoot] dispatcher
357+
pub enum MoveToRootParam {
358+
/// Maximize the window in its current subtree
359+
#[display("")]
360+
Stable,
361+
/// Swap the window with the other subtree
362+
#[display("unstable")]
363+
Unstable,
364+
}
365+
355366
/// This enum holds the zheight variants
356367
#[derive(Debug, Clone, Copy, Display)]
357368
pub enum ZOrder {
@@ -484,8 +495,14 @@ pub enum DispatchType<'a> {
484495

485496
// LAYOUT DISPATCHERS
486497
// DWINDLE
487-
/// Toggles the split (top/side) of the current window. `preserve_split` must be enabled for toggling to work.
498+
/// Toggles the split (top/side) of the current window. `preserve_split` must be enabled for toggling to work
488499
ToggleSplit,
500+
/// Swaps the two halves of the split of the current window
501+
SwapSplit,
502+
/// One-time override for the split direction (only works on tiled windows)
503+
PreSelect(Direction),
504+
/// Moves the selected window (active window if unspecified) to the root of its workspace tree
505+
MoveToRoot(Option<WindowIdentifier<'a>>, MoveToRootParam),
489506

490507
// MASTER
491508
/// Swaps the current window with master.
@@ -709,7 +726,11 @@ pub(crate) fn gen_dispatch_str(cmd: DispatchType, dispatch: bool) -> crate::Resu
709726
SignalWindow(win, sig) => format!("signalwindow{sep}{win},{sig}"),
710727
FocusUrgentOrLast => "focusurgentorlast".to_string(),
711728
FocusCurrentOrLast => "focuscurrentorlast".to_string(),
712-
ToggleSplit => "togglesplit".to_string(),
729+
ToggleSplit => format!("layoutmsg{sep}togglesplit"),
730+
SwapSplit => format!("layoutmsg{sep}swapsplit"),
731+
PreSelect(dir) => format!("layoutmsg{sep}preselect {dir}"),
732+
MoveToRoot(Some(win), param) => format!("layoutmsg{sep}movetoroot {win} {param}"),
733+
MoveToRoot(None, _) => format!("layoutmsg{sep}movetoroot"),
713734
SwapWithMaster(param) => format!("layoutmsg{sep}swapwithmaster {param}"),
714735
FocusMaster(param) => format!("layoutmsg{sep}focusmaster {param}"),
715736
CycleNextMaster(param) => format!("layoutmsg{sep}cyclenext {param}"),

0 commit comments

Comments
 (0)