Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ pub enum WindowSwitchDirection {
Back,
#[display("f")]
Forward,
#[display("{}", _0)]
Index(i32),
}

/// This enum is used for identifying monitors
Expand Down Expand Up @@ -543,10 +545,32 @@ pub enum DispatchType<'a> {
ChangeGroupActive(WindowSwitchDirection),
/// Locks the groups
LockGroups(LockType),
/// Locks the currently focused group
LockActiveGroup(LockType),
/// Moves the active window into a group in a specified direction
MoveIntoGroup(Direction),
/// Moves the active window into or out of a group in a specified direction
MoveWindowOrGroup(Direction),
/// Moves the active window out of a group.
MoveOutOfGroup,
/// Swaps the active window with the next or previous in a group
MoveGroupWindow(WindowSwitchDirection),
/// Prohibit the active window from becoming or being inserted into group
DenyWindowFromGroup(BinaryState),
/// Temporarily enable or disable ignore_group_lock
SetIgnoreGroupLock(BinaryState),
}

/// Enum used for options with a binary on/off state
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, Display, PartialEq, Eq, PartialOrd, Ord)]
pub enum BinaryState {
#[display("on")]
On,
#[display("off")]
Off,
#[display("toggle")]
Toggle,
}

/// Enum used with [DispatchType::LockGroups], to determine how to lock/unlock
Expand Down Expand Up @@ -732,8 +756,13 @@ pub(crate) fn gen_dispatch_str(cmd: DispatchType, dispatch: bool) -> crate::Resu
ToggleGroup => "togglegroup".to_string(),
ChangeGroupActive(dir) => format!("changegroupactive{sep}{dir}"),
LockGroups(how) => format!("lockgroups{sep}{how}"),
LockActiveGroup(how) => format!("lockactivegroups{sep}{how}"),
MoveIntoGroup(dir) => format!("moveintogroup{sep}{dir}"),
MoveWindowOrGroup(dir) => format!("movewindoworgroup{sep}{dir}"),
MoveOutOfGroup => "moveoutofgroup".to_string(),
MoveGroupWindow(dir) => format!("movegroupwindow{sep}{dir}"),
DenyWindowFromGroup(state) => format!("denywindowfromgroup{sep}{state}"),
SetIgnoreGroupLock(state) => format!("setignoregrouplock{sep}{state}"),
};

if let SetCursor(_, _) = cmd {
Expand Down