swayipc_command_builder/commands/
mod.rs

1use super::command::{AddFilter, Chained, Command, Finalize};
2use super::states::*;
3
4mod assign;
5mod border;
6mod default_border;
7mod floating;
8mod floating_modifier;
9mod floating_size;
10mod focus;
11mod focus_follows_mouse;
12mod focus_on_window_activation;
13mod focus_wrapping;
14mod fullscreen;
15mod gaps;
16mod hide_edge_borders;
17mod inhibit_idle;
18mod layout;
19mod mark;
20mod max_render_time;
21mod mouse_wraping;
22mod opacity;
23mod popup_during_fullscreen;
24mod rename;
25mod resize;
26mod scratchpad;
27mod shortcuts_inhibitor;
28mod show_marks;
29mod smart_borders;
30mod smart_gaps;
31mod split;
32mod sticky;
33mod swap;
34mod sway_move;
35mod client;
36mod tiling_drag;
37mod title_align;
38mod titlebar_padding;
39mod unbindswitch;
40mod unmark;
41mod urgent;
42mod workspace;
43mod workspace_auto_back_and_forth;
44
45impl<T: Chained> Command<T> {
46    pub fn for_window(self, criteria: impl AsRef<str>) -> Command<ForWindow> {
47        self.push_str("for_window").push_str(criteria).transmute()
48    }
49}
50
51impl<T: AddFilter> Command<T> {
52    pub fn filter(self, criteria: impl AsRef<str>) -> Command<Filter> {
53        self.push_str(criteria).transmute()
54    }
55}
56
57impl<T: Finalize> Command<T> {
58    //TODO: bar
59
60    pub fn border(self) -> Command<Border> {
61        self.push_str("border").transmute()
62    }
63
64    //TODO: create_output
65
66    pub fn exit(self) -> Command<Valid> {
67        self.push_str("exit").transmute()
68    }
69
70    pub fn floating(self) -> Command<Floating> {
71        self.push_str("floating").transmute()
72    }
73
74    pub fn focus(self) -> Command<Valid<Focus>> {
75        self.push_str("focus").transmute()
76    }
77
78    //TODO: force_display_urgency_hint
79
80    pub fn fullscreen(self) -> Command<Fullscreen> {
81        self.push_str("fullscreen").transmute()
82    }
83
84    pub fn gaps(self) -> Command<Gaps> {
85        self.push_str("gaps").transmute()
86    }
87
88    pub fn inhibit_idle(self) -> Command<InhibitIdle> {
89        self.push_str("inhibit_idle").transmute()
90    }
91
92    pub fn layout(self) -> Command<Layout> {
93        self.push_str("layout").transmute()
94    }
95
96    pub fn max_render_time(self) -> Command<MaxRenderTime> {
97        self.push_str("max_render_time").transmute()
98    }
99
100    pub fn sway_move(self) -> Command<Move> {
101        self.push_str("move").transmute()
102    }
103
104    pub fn nop(self) -> Command<Valid> {
105        self.push_str("nop").transmute()
106    }
107
108    pub fn reload(self) -> Command<Valid> {
109        self.push_str("reload").transmute()
110    }
111
112    pub fn rename(self) -> Command<Rename> {
113        self.push_str("rename").transmute()
114    }
115
116    pub fn resize(self) -> Command<Resize> {
117        self.push_str("resize").transmute()
118    }
119
120    pub fn scratchpad(self) -> Command<Scratchpad> {
121        self.push_str("scratchpad").transmute()
122    }
123
124    pub fn shortcuts_inhibitor(self) -> Command<ShortcutsInhibitor> {
125        self.push_str("shortcuts_inhibitor").transmute()
126    }
127
128    pub fn split(self) -> Command<Split> {
129        self.push_str("split").transmute()
130    }
131
132    pub fn sticky(self) -> Command<Sticky> {
133        self.push_str("sticky").transmute()
134    }
135
136    pub fn swap(self) -> Command<Swap> {
137        self.push_str("swap").transmute()
138    }
139
140    pub fn title_format(self, title_format: impl AsRef<str>) -> Command<Valid> {
141        self.push_str("title_format")
142            .push_str(title_format)
143            .transmute()
144    }
145
146    pub fn assign(self, criteria: impl AsRef<str>) -> Command<Assign> {
147        self.push_str("assign").push_str(criteria).transmute()
148    }
149
150    //TODO: bindsym
151
152    //TODO: bindcode
153
154    //TODO: bindswitch
155
156    pub fn client(self) -> Command<Client> {
157        self.push_str("client").push_char('.').transmute()
158    }
159
160    pub fn default_border(self) -> Command<DefaultBorder> {
161        self.push_str("default_border").transmute()
162    }
163
164    pub fn default_floating_border(self) -> Command<DefaultBorder> {
165        self.push_str("default_floating_border").transmute()
166    }
167
168    pub fn exec(self, exec: impl AsRef<str>) -> Command<Valid> {
169        self.push_str("exec").push_str(exec).transmute()
170    }
171
172    pub fn exec_always(self, exec_always: impl AsRef<str>) -> Command<Valid> {
173        self.push_str("exec_always")
174            .push_str(exec_always)
175            .transmute()
176    }
177
178    pub fn floating_maximum_size(self) -> Command<FloatingSize> {
179        self.push_str("floating_maximum_size").transmute()
180    }
181
182    pub fn floating_minimum_size(self) -> Command<FloatingSize> {
183        self.push_str("floating_minimum_size").transmute()
184    }
185
186    pub fn floating_modifier(self) -> Command<FloatingModifier> {
187        self.push_str("floating_modifier").transmute()
188    }
189
190    pub fn focus_follows_mouse(self) -> Command<FocusFollowMouse> {
191        self.push_str("focus_follows_mouse").transmute()
192    }
193
194    pub fn focus_on_window_activation(self) -> Command<FocusOnWindowActivation> {
195        self.push_str("focus_on_window_activation").transmute()
196    }
197
198    pub fn focus_wrapping(self) -> Command<FocusWrapping> {
199        self.push_str("focus_wrapping").transmute()
200    }
201
202    //TODO: font
203
204    pub fn titlebar_border_thickness(self, px: usize) -> Command<Valid> {
205        self.push_str("titlebar_border_thickness")
206            .push_str(px.to_string())
207            .transmute()
208    }
209
210    pub fn titlebar_padding(self) -> Command<TitlebarPadding> {
211        self.push_str("titlebar_padding").transmute()
212    }
213
214    pub fn hide_edge_borders(self) -> Command<HideEdgeBorders> {
215        self.push_str("hide_edge_borders").transmute()
216    }
217
218    //TODO: input
219
220    //TODO: seat
221
222    pub fn kill(self) -> Command<Gaps> {
223        self.push_str("kill").transmute()
224    }
225
226    pub fn smart_borders(self) -> Command<SmartBoarders> {
227        self.push_str("smart_borders").transmute()
228    }
229
230    pub fn smart_gaps(self) -> Command<SmartGaps> {
231        self.push_str("smart_gaps").transmute()
232    }
233
234    pub fn mark(self) -> Command<Mark> {
235        self.push_str("mark").transmute()
236    }
237
238    //TODO: add missing subcommands
239    pub fn mode(self, mode: impl AsRef<str>) -> Command<Valid> {
240        self.push_str("mode").push_str(mode).transmute()
241    }
242
243    pub fn mouse_warping(self) -> Command<MouseWraping> {
244        self.push_str("mouse_warping").transmute()
245    }
246
247    pub fn no_focus(self, criteria: impl AsRef<str>) -> Command<Valid> {
248        self.push_str("no_focus").push_str(criteria).transmute()
249    }
250
251    //TODO: output
252
253    pub fn popup_during_fullscreen(self) -> Command<PopupDuringFullscreen> {
254        self.push_str("popup_during_fullscreen").transmute()
255    }
256
257    pub fn set(self, key: impl AsRef<str>, value: impl AsRef<str>) -> Command<Valid> {
258        self.push_str(key).push_str(value).transmute()
259    }
260
261    pub fn show_marks(self) -> Command<ShowMarks> {
262        self.push_str("show_marks").transmute()
263    }
264
265    pub fn opacity(self) -> Command<Opacity> {
266        self.push_str("opacity").transmute()
267    }
268
269    pub fn tiling_drag(self) -> Command<TilingDrag> {
270        self.push_str("smart_borders").transmute()
271    }
272
273    pub fn tiling_drag_threshold(self, threshold: usize) -> Command<TilingDrag> {
274        self.push_str("tiling_drag_threshold")
275            .push_str(threshold.to_string())
276            .transmute()
277    }
278
279    pub fn title_align(self) -> Command<TitleAlign> {
280        self.push_str("title_align").transmute()
281    }
282
283    pub fn unbindswitch(self) -> Command<Unbindswitch> {
284        self.push_str("unbindswitch").transmute()
285    }
286
287    //TODO: unbindsym
288
289    //TODO: unbindcode
290
291    pub fn unmark(self) -> Command<Unmark> {
292        self.push_str("unmark").transmute()
293    }
294
295    pub fn urgent(self) -> Command<Urgent> {
296        self.push_str("urgent").transmute()
297    }
298
299    pub fn workspace(self) -> Command<Workspace> {
300        self.push_str("workspace").transmute()
301    }
302
303    pub fn workspace_auto_back_and_forth(self) -> Command<WorkspaceAutoBackAndForth> {
304        self.push_str("workspace_auto_back_and_forth").transmute()
305    }
306}