swayipc_types/
reply.rs

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