1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
use bitflags;
use Error;
use crate::;
/// The layer the surface is rendered on. Multiple surfaces can share a layer, and ordering within
/// a single layer is undefined.
bitflags!
/// Keyboard interactivity mode for the layer_shell surfaces.
/// Configures a Wayland layer-shell surface, such as a panel, dock, or wallpaper.
///
/// Set this on [`WindowKind::LayerShell`](crate::WindowKind::LayerShell) when you open a window.
/// Chain setters on [`LayerShellOptions::default`] to configure the surface. Pass `None` to
/// clear the exclusive zone, exclusive edge, or margins.
///
/// The compositor applies the namespace, layer, anchor and margins. Opening the window fails
/// with [`LayerShellNotSupportedError`] when the compositor doesn't support the layer-shell
/// protocol. Layer shell exists only on Wayland, so this module is available only on Linux
/// builds with the `wayland` feature.
///
/// # Examples
///
/// ```
/// # #[cfg(all(target_os = "linux", feature = "wayland"))]
/// # fn main() {
/// use gpui::{
/// layer_shell::{Anchor, KeyboardInteractivity, Layer, LayerShellOptions},
/// px,
/// };
///
/// // A 40 px bar along the bottom edge, stretched across the screen.
/// let options = LayerShellOptions::default()
/// .namespace("panel")
/// .layer(Layer::Top)
/// .anchor(Anchor::LEFT | Anchor::RIGHT | Anchor::BOTTOM)
/// .exclusive_zone(px(40.0))
/// .keyboard_interactivity(KeyboardInteractivity::None);
///
/// assert_eq!(options.namespace, "panel");
/// assert_eq!(options.layer, Layer::Top);
/// assert_eq!(options.exclusive_zone, Some(px(40.0)));
/// # }
/// # #[cfg(not(all(target_os = "linux", feature = "wayland")))]
/// # fn main() {}
/// ```
/// An error indicating that an action failed because the compositor doesn't support the required
/// layer_shell protocol.
;