leftwm_core/
command.rs

1pub use crate::handlers::command_handler::ReleaseScratchPadOption;
2use crate::models::{Handle, ScratchPadName, TagId, WindowHandle};
3use leftwm_layouts::geometry::Direction as FocusDirection;
4use serde::{Deserialize, Serialize};
5
6/// Command represents a command received from the command pipe.
7/// It will be handled in the main event loop.
8#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
9pub enum Command<H: Handle> {
10    CloseWindow,
11    SwapScreens,
12    SoftReload,
13    HardReload,
14    AttachScratchPad {
15        #[serde(bound = "")]
16        window: Option<WindowHandle<H>>,
17        scratchpad: ScratchPadName,
18    },
19    ReleaseScratchPad {
20        #[serde(bound = "")]
21        window: ReleaseScratchPadOption<H>,
22        tag: Option<TagId>,
23    },
24    PrevScratchPadWindow {
25        scratchpad: ScratchPadName,
26    },
27    NextScratchPadWindow {
28        scratchpad: ScratchPadName,
29    },
30    ToggleScratchPad(ScratchPadName),
31    ToggleFullScreen,
32    ToggleMaximized,
33    ToggleSticky,
34    ToggleAbove,
35    GoToTag {
36        tag: TagId,
37        swap: bool,
38    },
39    ReturnToLastTag,
40    FloatingToTile,
41    TileToFloating,
42    ToggleFloating,
43    MoveWindowUp,
44    MoveWindowDown,
45    MoveWindowTop {
46        swap: bool,
47    },
48    MoveWindowAt(FocusDirection),
49    SwapWindowTop {
50        swap: bool,
51    },
52    FocusNextTag {
53        behavior: FocusDeltaBehavior,
54    },
55    FocusPreviousTag {
56        behavior: FocusDeltaBehavior,
57    },
58    FocusWindow(String),
59    FocusWindowUp,
60    FocusWindowDown,
61    FocusWindowTop {
62        swap: bool,
63    },
64    FocusWindowAt(FocusDirection),
65    FocusWorkspaceNext,
66    FocusWorkspacePrevious,
67    SendWindowToTag {
68        #[serde(bound = "")]
69        window: Option<WindowHandle<H>>,
70        tag: TagId,
71    },
72    MoveWindowToNextTag {
73        follow: bool,
74    },
75    MoveWindowToPreviousTag {
76        follow: bool,
77    },
78    MoveWindowToLastWorkspace,
79    MoveWindowToNextWorkspace,
80    MoveWindowToPreviousWorkspace,
81    NextLayout,
82    PreviousLayout,
83    SetLayout(String),
84    RotateTag,
85    IncreaseMainWidth(i32), // deprecated: use IncreaseMainSize instead
86    DecreaseMainWidth(i32), // deprecated: use DecreaseMainSize instead
87    IncreaseMainSize(i32),
88    DecreaseMainSize(i32),
89    IncreaseMainCount(),
90    DecreaseMainCount(),
91    SetMarginMultiplier(f32),
92    SendWorkspaceToTag(usize, usize),
93    CloseAllOtherWindows,
94    Other(String),
95}
96
97#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
98pub enum FocusDeltaBehavior {
99    Default,
100    IgnoreUsed,
101    IgnoreEmpty,
102}