-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathaction.rs
268 lines (215 loc) · 6.61 KB
/
action.rs
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
// SPDX-License-Identifier: MPL-2.0
#![allow(deprecated)] // Derives on deprecated variants produce warnings...
use serde::{Deserialize, Serialize};
/// An operation which may be bound to a keyboard shortcut.
#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum Action {
/// Close the active window
Close,
/// Show a debug overlay, if enabled in the compositor build
Debug,
/// Disable a default shortcut binding
Disable,
/// Change focus to the window or workspace in the given direction
Focus(FocusDirection),
/// Change focus to the last workspace
LastWorkspace,
/// Maximize the active window
Maximize,
#[deprecated]
/// Migrate the active workspace to the next output
MigrateWorkspaceToNextOutput,
/// Migrate the active workspace to the output in the given direction
MigrateWorkspaceToOutput(Direction),
#[deprecated]
/// Migrate the active workspace to the previous output
MigrateWorkspaceToPreviousOutput,
/// Minimize the active window
Minimize,
/// Move a window in the given direction
Move(Direction),
/// Move a window to the last workspace
MoveToLastWorkspace,
#[deprecated]
/// Move a window to the next output
MoveToNextOutput,
/// Move a window to the next workspace
MoveToNextWorkspace,
/// Move a window to the given output
MoveToOutput(Direction),
#[deprecated]
/// Move a window to the previous output
MoveToPreviousOutput,
/// Move a window to the previous workspace
MoveToPreviousWorkspace,
/// Move a window to the given workspace
MoveToWorkspace(u8),
#[deprecated]
/// Change focus to the next output
NextOutput,
/// Change focus to the next workspace
NextWorkspace,
/// Change the orientation of a tiling group
Orientation(Orientation),
#[deprecated]
/// Change focus to the previous output
PreviousOutput,
/// Change focus to the previous workspace
PreviousWorkspace,
/// Resize the active window in a given direction
Resizing(ResizeDirection),
/// Move a window to the last workspace
SendToLastWorkspace,
#[deprecated]
/// Move a window to the next output
SendToNextOutput,
/// Move a window to the next workspace
SendToNextWorkspace,
/// Move a window to the output in the given direction
SendToOutput(Direction),
#[deprecated]
/// Move a window to the previous output
SendToPreviousOutput,
/// Move a window to the previous workspace
SendToPreviousWorkspace,
/// Move a window to the given workspace
SendToWorkspace(u8),
/// Swap positions of the active window with another
SwapWindow,
/// Move to an output in the given direction
SwitchOutput(Direction),
/// Perform a common system operation
System(System),
/// Execute a command with any given arguments
Spawn(String),
/// Stop the compositor
Terminate,
/// Toggle the orientation of a tiling group
ToggleOrientation,
/// Toggle window stacking for the active window
ToggleStacking,
/// Toggle the sticky state of the active window
ToggleSticky,
/// Toggle tiling mode of the active workspace
ToggleTiling,
/// Toggle between tiling and floating window states for the active window
ToggleWindowFloating,
/// Change focus to the given workspace ID
Workspace(u8),
/// Enter Magnification / Increase the zoom level by the configured interval
ZoomIn,
/// Leave Magnification / Decrease the zoom level by the configured interval
ZoomOut,
}
/// Common system operations which may be controlled by system commands
#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum System {
/// Opens the application library
AppLibrary,
/// Decreases screen brightness
BrightnessDown,
/// Increases screen brightness
BrightnessUp,
/// Opens the home folder in a system default file browser
HomeFolder,
/// Switch the currently-active input source
InputSourceSwitch,
/// Decreases keyboard brightness
KeyboardBrightnessDown,
/// Increases keyboard brightness
KeyboardBrightnessUp,
/// Opens the launcher
Launcher,
/// Locks the screen
LockScreen,
/// Logs out
LogOut,
/// Mutes the active audio output
Mute,
/// Mutes the active microphone
MuteMic,
/// Plays and Pauses audio
PlayPause,
/// Goes to the next track
PlayNext,
/// Goes to the previous track
PlayPrev,
/// Takes a screenshot
Screenshot,
/// Opens the system default terminal
Terminal,
/// Lowers the volume of the active audio output
VolumeLower,
/// Raises the volume of the active audio output
VolumeRaise,
/// Opens the system default web browser
WebBrowser,
/// Opens the (alt+tab) window switcher
WindowSwitcher,
/// Opens the (alt+shift+tab) window switcher
WindowSwitcherPrevious,
/// Opens the workspace overview
WorkspaceOverview,
}
/// Defines the direction of an operation
#[derive(Copy, Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum Direction {
Left,
Right,
Up,
Down,
}
impl std::ops::Not for Direction {
type Output = Self;
fn not(self) -> Self::Output {
match self {
Direction::Left => Direction::Right,
Direction::Right => Direction::Left,
Direction::Up => Direction::Down,
Direction::Down => Direction::Up,
}
}
}
/// Defines the direction to focus towards
#[derive(Copy, Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum FocusDirection {
Left,
Right,
Up,
Down,
In,
Out,
}
/// Defines the direction to resize towards
#[derive(Copy, Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum ResizeDirection {
Inwards,
Outwards,
}
/// Defines the edge of a window to resize from
#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum ResizeEdge {
Bottom,
BottomLeft,
BottomRight,
Left,
Right,
Top,
TopLeft,
TopRight,
}
/// Tiling orientation for a tiling window group
#[derive(Copy, Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum Orientation {
Horizontal,
Vertical,
}
impl std::ops::Not for Orientation {
type Output = Self;
fn not(self) -> Self::Output {
match self {
Orientation::Horizontal => Orientation::Vertical,
Orientation::Vertical => Orientation::Horizontal,
}
}
}