swayipc_types/
reply.rs

1use serde::{Deserialize, Serialize};
2
3#[non_exhaustive]
4#[derive(Clone, Debug, Deserialize, Serialize)]
5pub struct CommandOutcome {
6    /// A boolean indicating whether the command was successful.
7    pub success: bool,
8    /// An error object if the command failed, and None otherwise.
9    #[serde(flatten)]
10    pub error: Option<CommandError>,
11}
12
13#[non_exhaustive]
14#[derive(Clone, Debug, Deserialize, Serialize)]
15pub struct CommandError {
16    /// A boolean indicating whether the reason the command failed was because
17    /// the command was unknown or not able to be parsed.
18    pub parse_error: bool,
19    /// A human readable error message.
20    #[serde(rename = "error")]
21    pub message: String,
22}
23
24#[non_exhaustive]
25#[derive(Clone, Debug, Deserialize, Serialize)]
26pub struct Workspace {
27    pub id: i64,
28    /// The workspace number or -1 for workspaces that do not start with a
29    /// number.
30    pub num: i32,
31    /// The name of the workspace.
32    pub name: String,
33    #[serde(default)]
34    pub layout: String,
35    /// Whether the workspace is currently visible on any output.
36    pub visible: bool,
37    /// Whether the workspace is currently focused by the default seat (seat0).
38    pub focused: bool,
39    /// Whether a view on the workspace has the urgent flag set.
40    pub urgent: bool,
41    pub representation: Option<String>,
42    #[serde(default)]
43    pub orientation: String,
44    /// The bounds of the workspace. It consists of x, y, width, and height.
45    pub rect: Rect,
46    /// The name of the output that the workspace is on.
47    pub output: String,
48    #[serde(default)]
49    pub focus: Vec<i64>,
50}
51
52#[non_exhaustive]
53#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
54pub struct Success {
55    /// A boolean value indicating whether the operation was successful or not.
56    pub success: bool,
57}
58
59#[non_exhaustive]
60#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
61pub struct Mode {
62    pub width: i32,
63    pub height: i32,
64    pub refresh: i32,
65}
66
67#[non_exhaustive]
68#[derive(Clone, Debug, Deserialize, Serialize)]
69pub struct Output {
70    pub id: Option<i64>, // Sway doesn't give disabled outputs ids
71    /// The name of the output. On DRM, this is the connector.
72    pub name: String,
73    /// The make of the output.
74    pub make: String,
75    /// The model of the output.
76    pub model: String,
77    /// The output's serial number as a hexa‐ decimal string.
78    pub serial: String,
79    /// Whether this output is active/enabled.
80    pub active: bool,
81    /// Whether this output is on/off (via DPMS).
82    pub dpms: bool,
83    /// For i3 compatibility, this will be false. It does not make sense in
84    /// Wayland.
85    pub primary: bool,
86    /// The scale currently in use on the output or -1 for disabled outputs.
87    pub scale: Option<f64>,
88    /// The subpixel hinting current in use on the output. This can be rgb, bgr,
89    /// vrgb, vbgr, or none.
90    pub subpixel_hinting: Option<String>,
91    /// The transform currently in use for the output. This can be normal, 90,
92    /// 180, 270, flipped-90, flipped-180, or flipped-270.
93    pub transform: Option<String>,
94    /// The workspace currently visible on the output or null for disabled
95    /// outputs.
96    pub current_workspace: Option<String>,
97    /// An array of supported mode objects. Each object contains width, height,
98    /// and refresh.
99    #[serde(default)]
100    pub modes: Vec<Mode>,
101    /// An object representing the current mode containing width, height, and
102    /// refresh.
103    pub current_mode: Option<Mode>,
104    /// The bounds for the output consisting of x, y, width, and height.
105    pub rect: Rect,
106    #[serde(default)]
107    pub focus: Vec<i64>,
108    #[serde(default)]
109    pub focused: bool,
110}
111
112#[non_exhaustive]
113#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
114pub struct Libinput {
115    /// Whether events are being sent by the device. It can be enabled,
116    /// disabled, or disabled_on_external_mouse.
117    pub send_events: Option<SendEvents>,
118    /// Whether tap to click is enabled.  It can be enabled or disabled.
119    pub tap: Option<EnabledOrDisabled>,
120    /// The finger to button mapping in use.  It can be lmr or lrm.
121    pub tap_button_mapping: Option<ButtonMapping>,
122    /// Whether tap-and-drag is enabled. It can be enabled or disabled.
123    pub tap_drag: Option<EnabledOrDisabled>,
124    /// Whether drag-lock is enabled. It can be enabled, disabled or enabled_sticky.
125    pub tap_drag_lock: Option<DragLock>,
126    /// The pointer-acceleration in use.
127    pub accel_speed: Option<f64>,
128    /// Whether natural scrolling is enabled. It can be enabled or disabled.
129    pub natural_scroll: Option<EnabledOrDisabled>,
130    /// Whether left-handed mode is enabled. It can be enabled or disabled.
131    pub left_handed: Option<EnabledOrDisabled>,
132    /// The click method in use. It can be none, button_areas, or clickfinger.
133    pub click_method: Option<ClickMethod>,
134    /// Whether middle emulation is enabled.  It can be enabled or disabled.
135    pub middle_emulation: Option<EnabledOrDisabled>,
136    /// The scroll method in use. It can be none, two_finger, edge, or
137    /// on_button_down.
138    pub scroll_method: Option<ScrollMethod>,
139    /// The scroll button to use when scroll_method is on_button_down.  This
140    /// will be given as an input event code.
141    pub scroll_button: Option<i32>,
142    /// Whether disable-while-typing is enabled. It can be enabled or disabled.
143    pub dwt: Option<EnabledOrDisabled>,
144    /// An array of 6 floats representing the calibration matrix for absolute
145    /// devices such as touchscreens.
146    pub calibration_matrix: Option<[f32; 6]>,
147}
148
149#[non_exhaustive]
150#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
151#[serde(rename_all = "snake_case")]
152pub enum SendEvents {
153    Enabled,
154    Disabled,
155    DisabledOnExternalMouse,
156}
157
158#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
159#[serde(rename_all = "lowercase")]
160pub enum EnabledOrDisabled {
161    Enabled,
162    Disabled,
163}
164
165#[non_exhaustive]
166#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
167#[serde(rename_all = "snake_case")]
168pub enum ClickMethod {
169    ButtonAreas,
170    Clickfinger,
171    None,
172}
173
174#[non_exhaustive]
175#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
176#[serde(rename_all = "snake_case")]
177pub enum ScrollMethod {
178    TwoFinger,
179    Edge,
180    OnButtonDown,
181    None,
182}
183
184#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
185#[serde(rename_all = "lowercase")]
186pub enum ButtonMapping {
187    LMR,
188    LRM,
189}
190
191#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
192#[serde(rename_all = "snake_case")]
193pub enum DragLock {
194    Enabled,
195    Disabled,
196    EnabledSticky,
197}
198
199#[non_exhaustive]
200#[derive(Clone, Debug, Deserialize, Serialize)]
201pub struct Input {
202    /// The identifier for the input device.
203    pub identifier: String,
204    /// The human readable name for the device.
205    pub name: String,
206    /// The device type.  Currently this can be keyboard, pointer, touch,
207    /// tablet_tool, tablet_pad, or switch.
208    #[serde(rename = "type")]
209    pub input_type: String,
210    /// (Only keyboards) The name of the active keyboard layout in use.
211    pub xkb_active_layout_name: Option<String>,
212    /// (Only keyboards) A list a layout names configured for the keyboard.
213    #[serde(default)]
214    pub xkb_layout_names: Vec<String>,
215    /// (Only keyboards) The index of the active keyboard layout in use.
216    pub xkb_active_layout_index: Option<i32>,
217    /// (Only libinput devices) An object describing the current device
218    /// settings. See below for more information.
219    pub libinput: Option<Libinput>,
220    /// (Only libinput devices) The vendor code for the input device.
221    pub vendor: Option<i32>,
222    /// (Only libinput devices) The product code for the input device.
223    pub product: Option<i32>,
224}
225
226#[non_exhaustive]
227#[derive(Clone, Debug, Deserialize, Serialize)]
228pub struct Seat {
229    /// The unique name for the seat.
230    pub name: String,
231    /// The number of capabilities that the seat has.
232    pub capabilities: i32,
233    /// The id of the node currently focused by the seat or 0 when the seat is
234    /// not currently focused by a node (i.e. a surface layer or xwayland
235    /// unmanaged has focus).
236    pub focus: i64,
237    /// An array of input devices that are attached to the seat. Currently, this
238    /// is an array of objects that are identical to those returned by
239    /// GET_INPUTS.
240    #[serde(default)]
241    pub devices: Vec<Input>,
242}
243
244#[non_exhaustive]
245#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
246pub struct Rect {
247    pub x: i32,
248    pub y: i32,
249    pub width: i32,
250    pub height: i32,
251}
252
253#[non_exhaustive]
254#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
255pub struct WindowProperties {
256    pub title: Option<String>,
257    pub instance: Option<String>,
258    pub class: Option<String>,
259    pub window_role: Option<String>,
260    pub window_type: Option<String>,
261    pub transient_for: Option<i32>,
262}
263
264#[non_exhaustive]
265#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
266#[serde(rename_all = "lowercase")]
267pub enum UserIdleInhibitType {
268    Focus,
269    Fullscreen,
270    Open,
271    Visible,
272    None,
273}
274
275#[non_exhaustive]
276#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
277#[serde(rename_all = "lowercase")]
278pub enum ApplicationIdleInhibitType {
279    Enabled,
280    None,
281}
282
283#[non_exhaustive]
284#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
285pub struct IdleInhibitors {
286    pub application: ApplicationIdleInhibitType,
287    pub user: UserIdleInhibitType,
288}
289
290#[non_exhaustive]
291#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
292#[serde(rename_all = "snake_case")]
293pub enum NodeType {
294    Root,
295    Output,
296    Workspace,
297    Con,
298    FloatingCon,
299    Dockarea, // i3-specific
300}
301
302#[non_exhaustive]
303#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
304#[serde(rename_all = "lowercase")]
305pub enum NodeBorder {
306    Normal,
307    Pixel,
308    Csd,
309    None,
310}
311
312#[non_exhaustive]
313#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
314#[serde(rename_all = "lowercase")]
315pub enum NodeLayout {
316    SplitH,
317    SplitV,
318    Stacked,
319    Tabbed,
320    Output,
321    Dockarea, // i3-specific
322    None,
323}
324
325#[non_exhaustive]
326#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
327#[serde(rename_all = "snake_case")]
328pub enum Floating {
329    AutoOn,
330    AutoOff,
331    UserOn,
332    UserOff,
333}
334
335#[non_exhaustive]
336#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
337#[serde(rename_all = "lowercase")]
338pub enum ScratchpadState {
339    None,
340    Fresh,
341    Changed,
342}
343
344#[non_exhaustive]
345#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
346pub struct Node {
347    /// The internal unique ID for this node.
348    pub id: i64,
349    /// The name of the node such as the output name or window title. For the
350    /// scratchpad, this will be __i3_scratch for compatibility with i3.
351    pub name: Option<String>,
352    /// The node type. It can be root, output, workspace, con, or floating_con.
353    #[serde(rename = "type")]
354    pub node_type: NodeType,
355    /// The border style for the node. It can be normal, none, pixel, or csd.
356    pub border: NodeBorder,
357    /// Number of pixels used for the border width.
358    pub current_border_width: i32,
359    /// The node's layout.  It can either be splith, splitv, stacked, tabbed, or
360    /// output.
361    pub layout: NodeLayout,
362    /// The percentage of the node's parent that it takes up or null for the
363    /// root and other special nodes such as the scratchpad.
364    pub percent: Option<f64>,
365    /// The absolute geometry of the node.  The window decorations are excluded
366    /// from this, but borders are included.
367    pub rect: Rect,
368    /// The geometry of the contents inside the node. The window decorations are
369    /// excluded from this calculation, but borders are included.
370    pub window_rect: Rect,
371    /// The geometry of the decorations for the node relative to the parent
372    /// node.
373    pub deco_rect: Rect,
374    /// The natural geometry of the contents if it were to size itself.
375    pub geometry: Rect,
376    /// Whether the node or any of its descendants has the urgent hint set.
377    /// Note: This may not exist when compiled without xwayland support.
378    pub urgent: bool,
379    /// Whether the node is currently focused by the default seat (seat0).
380    pub focused: bool,
381    /// Array of child node IDs in the current focus order.
382    pub focus: Vec<i64>,
383    /// Floating state of container, i3 specific property
384    pub floating: Option<Floating>,
385    /// The tiling children nodes for the node.
386    #[serde(default)]
387    pub nodes: Vec<Node>,
388    /// The floating children nodes for the node.
389    pub floating_nodes: Vec<Node>,
390    /// Whether the node is sticky (shows on all workspaces).
391    pub sticky: bool,
392    /// (Only workspaces) A string representation of the layout of the workspace
393    /// that can be used as an aid in submitting reproduction steps for bug
394    /// reports.
395    pub representation: Option<String>,
396    /// (Only views) The fullscreen mode of the node. 0 means
397    /// none, 1 means full workspace, and 2 means global fullscreen.
398    pub fullscreen_mode: Option<u8>,
399    /// (Only views) For an xdg-shell and xwayland view, whether the window is in the scratchpad.
400    /// Otherwise, null.
401    pub scratchpad_state: Option<ScratchpadState>,
402    /// (Only views) For an xdg-shell view, the name of the application, if set.
403    /// Otherwise, null.
404    pub app_id: Option<String>,
405    /// (Only views) The PID of the application that owns the view.
406    pub pid: Option<i32>,
407    /// (Only xwayland views) The X11 window ID for the xwayland view.
408    pub window: Option<i64>,
409    pub num: Option<i32>, //workspace number if `node_type` == `NodeType::Workspace`
410    /// (Only xwayland views) An object containing the title, class, instance,
411    /// window_role, window_type, and transient_for for the view.
412    pub window_properties: Option<WindowProperties>,
413    /// List of marks assigned to the node.
414    #[serde(default)]
415    pub marks: Vec<String>,
416    /// (Only views) Whether the view is inhibiting the idle state.
417    pub inhibit_idle: Option<bool>,
418    /// (Only views) An object containing the state of the application and user
419    /// idle inhibitors.  application can be enabled or none.  user can be
420    /// focus, fullscreen, open, visible or none.
421    pub idle_inhibitors: Option<IdleInhibitors>,
422    /// (Only views) The shell of the view, such as xdg_shell or xwayland.
423    pub shell: Option<ShellType>,
424    /// (Only views) Whether the node is visible.
425    pub visible: Option<bool>,
426    /// (Only workspaces) Name of the output the node is located on.
427    pub output: Option<String>,
428}
429
430#[non_exhaustive]
431#[derive(Clone, Debug, Deserialize, Serialize)]
432#[serde(rename_all = "lowercase")]
433pub struct ColorableBarPart {
434    /// The color to use for the bar background on unfocused outputs.
435    pub background: String,
436    /// The color to use for the status line text on unfocused outputs.
437    pub statusline: String,
438    /// The color to use for the separator text on unfocused outputs.
439    pub separator: String,
440    /// The color to use for the background of the bar on the focused output.
441    pub focused_background: String,
442    /// The color to use for the status line text on the focused output.
443    pub focused_statusline: String,
444    /// The color to use for the separator text on the focused output.
445    pub focused_separator: String,
446    /// The color to use for the text of the focused workspace button.
447    pub focused_workspace_text: String,
448    /// The color to use for the background of the focused workspace button.
449    pub focused_workspace_bg: String,
450    /// The color to use for the border of the focused workspace button.
451    pub focused_workspace_border: String,
452    /// The color to use for the text of the workspace buttons for the visible
453    /// workspaces on unfocused outputs.
454    pub active_workspace_text: String,
455    /// The color to use for the background of the workspace buttons for the
456    /// visible workspaces on unfocused outputs.
457    pub active_workspace_bg: String,
458    /// The color to use for the border of the workspace buttons for the visible
459    /// workspaces on unfocused outputs.
460    pub active_workspace_border: String,
461    /// The color to use for the text of the workspace buttons for workspaces
462    /// that are not visible.
463    pub inactive_workspace_text: String,
464    /// The color to use for the background of the workspace buttons for
465    /// workspaces that are not visible.
466    pub inactive_workspace_bg: String,
467    /// The color to use for the border of the workspace buttons for workspaces
468    /// that are not visible.
469    pub inactive_workspace_border: String,
470    /// The color to use for the text of the workspace buttons for workspaces
471    /// that contain an urgent view.
472    pub urgent_workspace_text: String,
473    /// The color to use for the background of the workspace buttons for
474    /// workspaces that contain an urgent view.
475    pub urgent_workspace_bg: String,
476    /// The color to use for the border of the workspace buttons for workspaces
477    /// that contain an urgent view.
478    pub urgent_workspace_border: String,
479    /// The color to use for the text of the binding mode indicator.
480    pub binding_mode_text: String,
481    /// The color to use for the background of the binding mode indicator.
482    pub binding_mode_bg: String,
483    /// The color to use for the border of the binding mode indicator.
484    pub binding_mode_border: String,
485}
486
487#[non_exhaustive]
488#[derive(Clone, Debug, Deserialize, Serialize)]
489pub struct BarConfig {
490    /// The bar ID.
491    pub id: String,
492    /// The mode for the bar. It can be dock, hide, or invisible.
493    pub mode: BarMode,
494    /// The bar's position.  It can currently either be bottom or top.
495    pub position: Position,
496    /// The command which should be run to generate the status line.
497    pub status_command: Option<String>,
498    /// The font to use for the text on the bar.
499    pub font: String,
500    /// Whether to display the workspace buttons on the bar.
501    pub workspace_buttons: bool,
502    /// Whether to display the current binding mode on the bar.
503    pub binding_mode_indicator: bool,
504    /// For i3 compatibility, this will be the boolean value false.
505    pub verbose: bool,
506    /// An object containing the #RRGGBBAA colors to use for the bar. See below
507    /// for more information.
508    pub colors: ColorableBarPart,
509    /// An object representing the gaps for the bar consisting of top, right,
510    /// bottom, and left.
511    pub gaps: Gaps,
512    /// The absolute height to use for the bar or 0 to automatically size based
513    /// on the font.
514    pub bar_height: usize,
515    /// The vertical padding to use for the status line.
516    pub status_padding: usize,
517    /// The horizontal padding to use for the status line when at the end of an
518    /// output.
519    pub status_edge_padding: usize,
520}
521
522#[non_exhaustive]
523#[derive(Clone, Debug, Deserialize, Serialize)]
524pub struct BindingState {
525    /// The currently active binding mode, as a string.
526    pub name: String,
527}
528
529#[non_exhaustive]
530#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
531#[serde(rename_all = "lowercase")]
532pub enum BarMode {
533    Dock,
534    Hide,
535    Invisible,
536}
537
538#[non_exhaustive]
539#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
540pub struct Gaps {
541    pub top: usize,
542    pub bottom: usize,
543    pub right: usize,
544    pub left: usize,
545}
546
547#[non_exhaustive]
548#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
549#[serde(rename_all = "lowercase")]
550pub enum Position {
551    Bottom,
552    Top,
553}
554
555#[non_exhaustive]
556#[derive(Clone, Debug, Deserialize, Serialize)]
557pub struct Version {
558    /// The major version of the sway process.
559    pub major: i32,
560    /// The minor version of the sway process.
561    pub minor: i32,
562    /// The patch version of the sway process.
563    pub patch: i32,
564    /// A human readable version string that will likely contain more useful
565    /// information such as the git commit short hash and git branch.
566    pub human_readable: String,
567    /// The path to the loaded config file.
568    pub loaded_config_file_name: String,
569}
570
571#[non_exhaustive]
572#[derive(Clone, Debug, Deserialize, Serialize)]
573pub struct Config {
574    /// A single string property containing the contents of the config.
575    pub config: String,
576}
577
578#[non_exhaustive]
579#[derive(Clone, Debug, Deserialize, Serialize)]
580pub enum Event {
581    /// Sent whenever an event involving a workspace occurs such as
582    /// initialization of a new workspace or a different workspace gains focus.
583    Workspace(Box<WorkspaceEvent>),
584    /// Sent whenever an output is added, removed, or its configuration is changed.
585    Output(OutputEvent),
586    /// Sent whenever the binding mode changes.
587    Mode(ModeEvent),
588    /// Sent whenever an event involving a view occurs such as being reparented,
589    /// focused, or closed.
590    Window(Box<WindowEvent>),
591    /// Sent whenever a bar config changes.
592    BarConfigUpdate(Box<BarConfig>),
593    /// Sent when a configured binding is executed.
594    Binding(BindingEvent),
595    /// Sent when the ipc shuts down because sway is exiting.
596    Shutdown(ShutdownEvent),
597    /// Sent when an ipc client sends a SEND_TICK message.
598    Tick(TickEvent),
599    /// Send when the visibility of a bar should change due to a modifier.
600    BarStateUpdate(BarStateUpdateEvent),
601    /// Sent when something related to input devices changes.
602    Input(Box<InputEvent>),
603}
604
605#[non_exhaustive]
606#[derive(Clone, Debug, Deserialize, Serialize)]
607pub struct InputEvent {
608    /// What has changed.
609    pub change: InputChange,
610    /// An object representing the input that is identical the ones GET_INPUTS
611    /// gives.
612    pub input: Input,
613}
614
615#[non_exhaustive]
616#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
617#[serde(rename_all = "snake_case")]
618pub enum InputChange {
619    /// The input device became available.
620    Added,
621    /// The input device is no longer available.
622    Removed,
623    /// (Keyboards only) The keymap for the keyboard has changed.
624    XkbKeymap,
625    /// (Keyboards only) The effective layout in the keymap has changed.
626    XkbLayout,
627    /// (libinput device only) A libinput config option for the device changed.
628    LibinputConfig,
629}
630
631#[non_exhaustive]
632#[derive(Clone, Debug, Deserialize, Serialize)]
633pub struct BarStateUpdateEvent {
634    /// The bar ID effected.
635    pub id: String,
636    /// Whether the bar should be made visible due to a modifier being pressed.
637    pub visible_by_modifier: bool,
638}
639
640#[non_exhaustive]
641#[derive(Clone, Debug, Deserialize, Serialize)]
642pub struct TickEvent {
643    /// Whether this event was triggered by subscribing to the tick events.
644    pub first: bool,
645    /// The payload given with a SEND_TICK message, if any.  Otherwise, an empty
646    /// string.
647    pub payload: String,
648}
649
650#[non_exhaustive]
651#[derive(Clone, Debug, Deserialize, Serialize)]
652pub struct WorkspaceEvent {
653    /// The type of change that occurred.
654    pub change: WorkspaceChange,
655    /// An object representing the workspace effected or null for reload
656    /// changes.
657    pub current: Option<Node>, //Only None if WorkspaceChange::Reload
658    /// For a focus change, this is will be an object representing the workspace
659    /// being switched from. Otherwise, it is null.
660    pub old: Option<Node>, //Only None if WorkspaceChange::Reload
661}
662
663#[non_exhaustive]
664#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
665#[serde(rename_all = "lowercase")]
666pub enum OutputChange {
667    /// We don't know what exactly changed.
668    Unspecified,
669}
670
671#[non_exhaustive]
672#[derive(Clone, Debug, Deserialize, Serialize)]
673pub struct OutputEvent {
674    /// The type of change that occurred.
675    pub change: OutputChange,
676}
677
678#[non_exhaustive]
679#[derive(Clone, Debug, Deserialize, Serialize)]
680pub struct ModeEvent {
681    /// The binding mode that became active.
682    pub change: String,
683    /// Whether the mode should be parsed as pango markup.
684    pub pango_markup: bool,
685}
686
687#[non_exhaustive]
688#[derive(Clone, Debug, Deserialize, Serialize)]
689pub struct WindowEvent {
690    /// The type of change that occurred.
691    pub change: WindowChange,
692    /// An object representing the view effected.
693    pub container: Node,
694}
695
696#[non_exhaustive]
697#[derive(Clone, Debug, Deserialize, Serialize)]
698pub struct BindingEvent {
699    /// The change that occurred for the binding. Currently this will only be
700    /// run.
701    pub change: BindingChange,
702    /// Details about the binding event.
703    pub binding: BindingEventOps,
704}
705
706#[non_exhaustive]
707#[derive(Clone, Debug, Deserialize, Serialize)]
708pub struct BindingEventOps {
709    /// The command associated with the binding.
710    pub command: String,
711    /// An array of strings that correspond to each modifier key for the
712    /// binding.
713    #[serde(default)]
714    pub event_state_mask: Vec<String>,
715    /// For keyboard bindcodes, this is the key code for the binding. For mouse
716    /// bindings, this is the X11 button number, if there is an equivalent. In
717    /// all other cases, this will be 0.
718    pub input_code: u8,
719    /// For keyboard bindsyms, this is the bindsym for the binding. Otherwise,
720    /// this will be null.
721    pub symbol: Option<String>,
722    /// The input type that triggered the binding. This is either keyboard or
723    /// mouse.
724    pub input_type: InputType,
725}
726
727#[non_exhaustive]
728#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
729pub struct ShutdownEvent {
730    /// The reason for the shutdown.
731    pub change: ShutdownChange,
732}
733
734#[non_exhaustive]
735#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
736#[serde(rename_all = "lowercase")]
737pub enum WorkspaceChange {
738    /// The workspace was created.
739    Init,
740    /// The workspace is empty and is being destroyed since it is not visible.
741    Empty,
742    /// The workspace was focused.  See the old property for the previous focus.
743    Focus,
744    /// The workspace was moved to a different output.
745    Move,
746    /// The workspace was renamed.
747    Rename,
748    /// A view on the workspace has had their urgency hint set or all urgency
749    /// hints for views on the workspace have been cleared.
750    Urgent,
751    /// The configuration file has been reloaded.
752    Reload,
753}
754
755#[non_exhaustive]
756#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
757#[serde(rename_all = "snake_case")]
758pub enum WindowChange {
759    /// The view was created.
760    New,
761    /// The view was closed.
762    Close,
763    /// The view was focused.
764    Focus,
765    /// The view's title has changed.
766    Title,
767    /// The view's fullscreen mode has changed.
768    FullscreenMode,
769    /// The view has been reparented in the tree.
770    Move,
771    /// The view has become floating or is no longer floating.
772    Floating,
773    /// The view's urgency hint has changed status.
774    Urgent,
775    /// A mark has been added or.
776    Mark,
777}
778
779#[non_exhaustive]
780#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
781#[serde(rename_all = "lowercase")]
782pub enum InputType {
783    Keyboard,
784    Mouse,
785}
786
787#[non_exhaustive]
788#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
789#[serde(rename_all = "lowercase")]
790pub enum BindingChange {
791    Run,
792}
793
794#[non_exhaustive]
795#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
796#[serde(rename_all = "lowercase")]
797pub enum ShutdownChange {
798    Exit,
799}
800
801#[non_exhaustive]
802#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
803#[serde(rename_all = "snake_case")]
804pub enum ShellType {
805    XdgShell,
806    Xwayland,
807    Unknown,
808}