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