leftwm_core/
display_action.rs

1use crate::models::Handle;
2use crate::models::TagId;
3use crate::models::Window;
4use crate::models::WindowHandle;
5use crate::models::WindowState;
6use crate::utils::modmask_lookup::Button;
7use serde::{Deserialize, Serialize};
8
9/// These are responses from the Window manager.
10/// The display server should act on these actions.
11#[allow(clippy::large_enum_variant)]
12#[derive(Serialize, Deserialize, Clone, Debug)]
13pub enum DisplayAction<H: Handle> {
14    /// Nicely ask a window if it would please close at its convenience.
15    #[serde(bound = "")]
16    KillWindow(WindowHandle<H>),
17
18    /// Get triggered after a new window is discovered and WE are
19    /// managing it.
20    #[serde(bound = "")]
21    AddedWindow(WindowHandle<H>, bool, bool),
22
23    /// Makes sure the mouse is over a given window.
24    #[serde(bound = "")]
25    MoveMouseOver(WindowHandle<H>, bool),
26
27    /// Makes sure the mouse is over a given point.
28    MoveMouseOverPoint((i32, i32)),
29
30    /// Change a windows state.
31    #[serde(bound = "")]
32    SetState(WindowHandle<H>, bool, WindowState),
33
34    /// Sets the "z-index" order of the windows
35    /// first in the array is top most
36    #[serde(bound = "")]
37    SetWindowOrder(Vec<WindowHandle<H>>),
38
39    /// Raises a given window.
40    #[serde(bound = "")]
41    MoveToTop(WindowHandle<H>),
42
43    /// Tell the DS we no longer care about the this window and other
44    /// cleanup.
45    #[serde(bound = "")]
46    DestroyedWindow(WindowHandle<H>),
47
48    /// Tell a window that it is to become focused.
49    #[serde(bound = "")]
50    WindowTakeFocus {
51        window: Window<H>,
52        previous_window: Option<Window<H>>,
53    },
54
55    /// Remove focus on any visible window by focusing the root window.
56    #[serde(bound = "")]
57    Unfocus(Option<WindowHandle<H>>, bool),
58
59    /// To the window under the cursor to take the focus.
60    FocusWindowUnderCursor,
61
62    #[serde(bound = "")]
63    ReplayClick(WindowHandle<H>, Button),
64
65    /// Tell the DM we are ready to resize this window.
66    #[serde(bound = "")]
67    ReadyToResizeWindow(WindowHandle<H>),
68
69    /// Tell the DM we are ready to move this window.
70    #[serde(bound = "")]
71    ReadyToMoveWindow(WindowHandle<H>),
72
73    /// Used to let the WM know of the current displayed tag changes.
74    SetCurrentTags(Option<TagId>),
75
76    /// Used to let the WM know of the tag for a given window.
77    #[serde(bound = "")]
78    SetWindowTag(WindowHandle<H>, Option<TagId>),
79
80    /// Tell the DM to return to normal mode if it is not (ie resize a
81    /// window or moving a window).
82    NormalMode,
83
84    /// Configure a xlib window.
85    #[serde(bound = "")]
86    ConfigureXlibWindow(Window<H>),
87}