swayipc_command_builder/commands/
sway_move.rs

1use super::*;
2
3impl Command<Move> {
4    pub fn left(self) -> Command<Valid<Move<Direction>>> {
5        self.push_str("left").transmute()
6    }
7
8    pub fn right(self) -> Command<Valid<Move<Direction>>> {
9        self.push_str("right").transmute()
10    }
11
12    pub fn up(self) -> Command<Valid<Move<Direction>>> {
13        self.push_str("up").transmute()
14    }
15
16    pub fn down(self) -> Command<Valid<Move<Direction>>> {
17        self.push_str("down").transmute()
18    }
19
20    pub fn absolute(self) -> Command<Valid<Move<Direction>>> {
21        self.push_str("absolute").transmute()
22    }
23
24    pub fn no_auto_back_and_forth(self) -> Command<Move<NoAuto>> {
25        self.push_str("--no-auto-back-and-forth").transmute()
26    }
27
28    pub fn position(self) -> Command<Move<Position>> {
29        self.push_str("position").transmute()
30    }
31
32    pub fn window(self) -> Command<Move<WinCon>> {
33        self.push_str("window").transmute()
34    }
35
36    pub fn container(self) -> Command<Move<WinCon>> {
37        self.push_str("container").transmute()
38    }
39
40    pub fn workspace(self) -> Command<Move<Workspace>> {
41        self.push_str("workspace").transmute()
42    }
43}
44
45impl Command<Move<Workspace>> {
46    pub fn to(self) -> Command<Move<Workspace<To>>> {
47        self.push_str("to").transmute()
48    }
49}
50
51impl Command<Move<Workspace<To>>> {
52    pub fn output(self) -> Command<Move<WinCon<To<Output>>>> {
53        self.push_str("output").transmute()
54    }
55}
56
57impl Command<Move<Absolute>> {
58    pub fn position(self) -> Command<Move<Absolute<Position>>> {
59        self.push_str("position").transmute()
60    }
61}
62
63impl Command<Move<Absolute<Position>>> {
64    pub fn pos_x(self, x: usize) -> Command<Move<Absolute<Position<X<With>>>>> {
65        self.push_str(x.to_string()).transmute()
66    }
67
68    pub fn center(self) -> Command<Valid> {
69        self.push_str("center").transmute()
70    }
71}
72
73impl Command<Move<Absolute<Position<X<With>>>>> {
74    pub fn in_px(self) -> Command<Move<Absolute<Position<X<With<Y>>>>>> {
75        self.push_str("px").transmute()
76    }
77
78    pub fn in_ppt(self) -> Command<Move<Absolute<Position<X<With<Y>>>>>> {
79        self.push_str("ppt").transmute()
80    }
81}
82
83impl Command<Move<Absolute<Position<X<With<Y>>>>>> {
84    pub fn pos_y(self, y: usize) -> Command<Move<Absolute<Position<X<With<Y<With>>>>>>> {
85        self.push_str(y.to_string()).transmute()
86    }
87}
88
89impl Command<Move<Absolute<Position<X<With<Y<With>>>>>>> {
90    pub fn in_px(self) -> Command<Valid> {
91        self.push_str("px").transmute()
92    }
93
94    pub fn in_ppt(self) -> Command<Valid> {
95        self.push_str("ppt").transmute()
96    }
97}
98
99impl Command<Move<Position>> {
100    pub fn pos_x(self, x: usize) -> Command<Move<Absolute<Position<X<With>>>>> {
101        self.push_str(x.to_string()).transmute()
102    }
103
104    pub fn center(self) -> Command<Valid> {
105        self.push_str("center").transmute()
106    }
107
108    pub fn mouse(self) -> Command<Valid> {
109        self.push_str("mouse").transmute()
110    }
111
112    pub fn cursor(self) -> Command<Valid> {
113        self.push_str("cursor").transmute()
114    }
115
116    pub fn pointer(self) -> Command<Valid> {
117        self.push_str("pointer").transmute()
118    }
119}
120
121impl Command<Valid<Move<Direction>>> {
122    pub fn by(self, px: usize) -> Command<Valid> {
123        self.push_str(px.to_string()).push_str("px").transmute()
124    }
125}
126
127impl Command<Move<NoAuto>> {
128    pub fn window(self) -> Command<Move<NoAuto<WinCon>>> {
129        self.push_str("window").transmute()
130    }
131
132    pub fn container(self) -> Command<Move<NoAuto<WinCon>>> {
133        self.push_str("container").transmute()
134    }
135}
136
137impl Command<Move<NoAuto<WinCon>>> {
138    pub fn to(self) -> Command<Move<WinCon<NoAuto<To>>>> {
139        self.transmute()
140    }
141}
142
143impl Command<Move<WinCon<NoAuto<To>>>> {
144    pub fn workspace(self) -> Command<Move<WinCon<NoAuto<To<Workspace>>>>> {
145        self.push_str("workspace").transmute()
146    }
147}
148
149impl Command<Move<WinCon<NoAuto<To<Workspace>>>>> {
150    pub fn with(self) -> Command<Move<WinCon<To<Workspace<To<With>>>>>> {
151        self.transmute()
152    }
153}
154
155impl Command<Move<WinCon<To<Workspace>>>> {
156    pub fn with(self) -> Command<Move<WinCon<To<Workspace<To<With>>>>>> {
157        self.transmute()
158    }
159
160    pub fn current(self) -> Command<Valid> {
161        self.push_str("current").transmute()
162    }
163
164    pub fn next(self) -> Command<Valid> {
165        self.push_str("next").transmute()
166    }
167
168    pub fn prev(self) -> Command<Valid> {
169        self.push_str("prev").transmute()
170    }
171
172    pub fn next_on_output(self) -> Command<Valid> {
173        self.push_str("next_on_output").transmute()
174    }
175
176    pub fn prev_on_output(self) -> Command<Valid> {
177        self.push_str("prev_on_output").transmute()
178    }
179
180    pub fn back_and_forth(self) -> Command<Valid> {
181        self.push_str("back_and_forth").transmute()
182    }
183}
184
185impl Command<Move<WinCon<To<Workspace<To<With>>>>>> {
186    pub fn name(self, name: impl AsRef<str>) -> Command<Valid> {
187        self.push_str(name).transmute()
188    }
189
190    pub fn number(self, id: usize) -> Command<Valid> {
191        self.push_str("number").push_str(id.to_string()).transmute()
192    }
193}
194
195impl Command<Move<WinCon>> {
196    pub fn to(self) -> Command<Move<WinCon<To>>> {
197        self.transmute()
198    }
199}
200
201impl Command<Move<WinCon<To>>> {
202    pub fn mark(self, mark: impl AsRef<str>) -> Command<Valid> {
203        self.push_str("mark").push_str(mark).transmute()
204    }
205
206    pub fn scratchpad(self) -> Command<Valid> {
207        self.push_str("scratchpad").transmute()
208    }
209
210    pub fn workspace(self) -> Command<Move<WinCon<To<Workspace>>>> {
211        self.push_str("workspace").transmute()
212    }
213
214    pub fn output(self) -> Command<Move<WinCon<To<Output>>>> {
215        self.push_str("output").transmute()
216    }
217}
218
219impl Command<Move<WinCon<To<Output>>>> {
220    pub fn left(self) -> Command<Valid> {
221        self.push_str("left").transmute()
222    }
223
224    pub fn right(self) -> Command<Valid> {
225        self.push_str("right").transmute()
226    }
227
228    pub fn up(self) -> Command<Valid> {
229        self.push_str("up").transmute()
230    }
231
232    pub fn down(self) -> Command<Valid> {
233        self.push_str("down").transmute()
234    }
235
236    pub fn current(self) -> Command<Move<WinCon<To<Output>>>> {
237        self.push_str("current").transmute()
238    }
239
240    pub fn with(self) -> Command<Move<WinCon<To<Output<With>>>>> {
241        self.transmute()
242    }
243}
244
245impl Command<Move<WinCon<To<Output<With>>>>> {
246    pub fn name(self, name: impl AsRef<str>) -> Command<Valid> {
247        self.push_str(name).transmute()
248    }
249
250    pub fn id(self, id: usize) -> Command<Valid> {
251        self.push_str(id.to_string()).transmute()
252    }
253}