Skip to content

Commit 851d46b

Browse files
added TagWindow dispatcher
1 parent 928fe40 commit 851d46b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/dispatch.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ pub enum WindowMove<'a> {
279279
Direction(Direction),
280280
}
281281

282+
/// This enum hold the actions that can be applied to a tag
283+
#[derive(Debug, Clone, Display)]
284+
#[allow(missing_docs)]
285+
pub enum TagAction {
286+
#[display("+")]
287+
Add,
288+
#[display("-")]
289+
Remove,
290+
#[display("")]
291+
Toggle,
292+
}
293+
282294
/// This enum holds the signals
283295
#[derive(Debug, Clone, Copy)]
284296
pub enum SignalType {
@@ -444,6 +456,8 @@ pub enum DispatchType<'a> {
444456
SwapNext(CycleDirection),
445457
/// This dispatcher swaps windows using a specified direction
446458
SwapWindow(Direction),
459+
/// Apply tag to current or the first window matching
460+
TagWindow(TagAction, &'a str, Option<WindowIdentifier<'a>>),
447461
/// This dispatcher focuses a specified window
448462
FocusWindow(WindowIdentifier<'a>),
449463
/// This dispatcher focuses a specified monitor
@@ -681,6 +695,8 @@ pub(crate) fn gen_dispatch_str(cmd: DispatchType, dispatch: bool) -> crate::Resu
681695
CycleWindow(dir) => format!("cyclenext{sep}{dir}"),
682696
SwapNext(dir) => format!("swapnext{sep}{dir}"),
683697
SwapWindow(dir) => format!("swapwindow{sep}{dir}"),
698+
TagWindow(act, tag, Some(win)) => format!("tagwindow{sep}{act}{tag} {win}"),
699+
TagWindow(act, tag, None) => format!("tagwindow{sep}{act}{tag}"),
684700
FocusWindow(win) => format!("focuswindow{sep}{win}"),
685701
FocusMonitor(mon) => format!("focusmonitor{sep}{mon}"),
686702
ChangeSplitRatio(fv) => format!("splitratio {fv}"),

0 commit comments

Comments
 (0)