client_events.go RawHistoryFolder
1package ports
2
3// ClientEvent carries wayland → core notifications.
4type ClientEvent interface{ clientEvent() }
5
6// WindowMapped carries wayland → core mapping.
7type WindowMapped struct {
8 ID WindowID
9 AppID string
10 // Slot is the SlotEnv value of the client process, empty if none.
11 Slot string
12 // PID is the client process, 0 when unknown.
13 PID int
14 // Floating windows are dialogs (a parent) or fixed-size windows such
15 // as splash screens: core shows them over the columns at their own
16 // size, Width×Height logical (0 when unknown).
17 Floating bool
18 Width, Height int
19 // Parent is the window a dialog belongs to (xdg_toplevel.set_parent or
20 // xdg-foreign), 0 when none. A dialog of a fullscreen window shows over
21 // it.
22 Parent WindowID
23 // Remap is set when the toplevel mapped before and was unmapped (a tray
24 // app restored): window rules only place its first map.
25 Remap bool
26 // Modal is set for a dialog that blocks its parent (xdg_dialog_v1):
27 // focusing the parent focuses the dialog.
28 Modal bool
29}
30
31// SlotEnv is the environment variable neferwl sets on processes it spawns
32// for a slot. The client's value maps its windows to the slot.
33const SlotEnv = "NEFERWL_SLOT"
34
35func (WindowMapped) clientEvent() {}
36
37// InputRegionChanged replaces the surface-local hit area for a mapped surface.
38// All means the full hit rectangle; otherwise Rects is the exact union.
39type InputRegionChanged struct {
40 ID WindowID
41 All bool
42 Rects []Rect
43}
44
45func (InputRegionChanged) clientEvent() {}
46
47// WindowUnmapped carries wayland → core removal.
48type WindowUnmapped struct{ ID WindowID }
49
50func (WindowUnmapped) clientEvent() {}
51
52// ShortcutsInhibit carries wayland → core that a window asks for (Active)
53// or stops asking for all keys, compositor binds included, while it has
54// keyboard focus (zwp_keyboard_shortcuts_inhibit_v1).
55type ShortcutsInhibit struct {
56 Window WindowID
57 Active bool
58}
59
60func (ShortcutsInhibit) clientEvent() {}
61
62// IdleInhibit carries wayland → core that a window keeps (Active) or
63// stops keeping the session from going idle (zwp_idle_inhibit_v1).
64type IdleInhibit struct {
65 Window WindowID
66 Active bool
67}
68
69func (IdleInhibit) clientEvent() {}
70
71// OutputPower carries wayland → core a client turning a display off or
72// back on (zwlr_output_power_v1).
73type OutputPower struct {
74 Output string
75 On bool
76}
77
78func (OutputPower) clientEvent() {}
79
80// ResizeEdges are the window edges a pointer resize moves, as bit flags
81// (the xdg_toplevel resize_edge values).
82type ResizeEdges uint32
83
84const (
85 ResizeTop ResizeEdges = 1
86 ResizeBottom ResizeEdges = 2
87 ResizeLeft ResizeEdges = 4
88 ResizeRight ResizeEdges = 8
89)
90
91// WindowMoveRequest carries wayland → core xdg_toplevel move and resize
92// requests answering the client's current press: core starts a pointer
93// drag of the window with the held button.
94type WindowMoveRequest struct {
95 ID WindowID
96 Resize bool
97 Edges ResizeEdges
98}
99
100func (WindowMoveRequest) clientEvent() {}
101
102// WindowFullscreenRequest carries wayland → core fullscreen requests.
103// External is set when another client (a taskbar, through foreign
104// toplevel) asks for it, not the window itself.
105type WindowFullscreenRequest struct {
106 ID WindowID
107 Fullscreen bool
108 External bool
109}
110
111func (WindowFullscreenRequest) clientEvent() {}
112
113// WindowActivate carries wayland → core a valid xdg-activation request:
114// show the window's workspace and focus it.
115type WindowActivate struct{ ID WindowID }
116
117func (WindowActivate) clientEvent() {}
118
119// WindowAppID carries wayland → core an app ID set after the window mapped.
120type WindowAppID struct {
121 ID WindowID
122 AppID string
123}
124
125func (WindowAppID) clientEvent() {}
126
127// WindowParent carries the new parent of a mapped dialog (0: none), after
128// set_parent or an xdg-foreign import changed or ended the relationship.
129type WindowParent struct {
130 ID, Parent WindowID
131}
132
133func (WindowParent) clientEvent() {}
134
135// WindowModal carries a mapped dialog's new modal state (xdg_dialog_v1).
136type WindowModal struct {
137 ID WindowID
138 Modal bool
139}
140
141func (WindowModal) clientEvent() {}
142
143// WindowResized carries wayland → core the new size of a floating window.
144type WindowResized struct {
145 ID WindowID
146 Width, Height int
147}
148
149func (WindowResized) clientEvent() {}