]> git.sur5r.net Git - i3/i3/blob - parser-specs/commands.spec
Support "resize set W H"
[i3/i3] / parser-specs / commands.spec
1 # vim:ts=2:sw=2:expandtab
2 #
3 # i3 - an improved dynamic tiling window manager
4 # © 2009 Michael Stapelberg and contributors (see also: LICENSE)
5 #
6 # parser-specs/commands.spec: Specification file for generate-command-parser.pl
7 # which will generate the appropriate header files for our C parser.
8 #
9 # Use :source highlighting.vim in vim to get syntax highlighting
10 # for this file.
11
12 state INITIAL:
13   # We have an end token here for all the commands which just call some
14   # function without using an explicit 'end' token.
15   end ->
16   '[' -> call cmd_criteria_init(); CRITERIA
17   'move' -> MOVE
18   'exec' -> EXEC
19   'exit' -> call cmd_exit()
20   'restart' -> call cmd_restart()
21   'reload' -> call cmd_reload()
22   'shmlog' -> SHMLOG
23   'debuglog' -> DEBUGLOG
24   'border' -> BORDER
25   'layout' -> LAYOUT
26   'append_layout' -> APPEND_LAYOUT
27   'workspace' -> WORKSPACE
28   'focus' -> FOCUS
29   'kill' -> KILL
30   'open' -> call cmd_open()
31   'fullscreen' -> FULLSCREEN
32   'split' -> SPLIT
33   'floating' -> FLOATING
34   'mark' -> MARK
35   'unmark' -> UNMARK
36   'resize' -> RESIZE
37   'rename' -> RENAME
38   'nop' -> NOP
39   'scratchpad' -> SCRATCHPAD
40   'title_format' -> TITLE_FORMAT
41   'mode' -> MODE
42   'bar' -> BAR
43
44 state CRITERIA:
45   ctype = 'class'       -> CRITERION
46   ctype = 'instance'    -> CRITERION
47   ctype = 'window_role' -> CRITERION
48   ctype = 'con_id'      -> CRITERION
49   ctype = 'id'          -> CRITERION
50   ctype = 'window_type' -> CRITERION
51   ctype = 'con_mark'    -> CRITERION
52   ctype = 'title'       -> CRITERION
53   ctype = 'urgent'      -> CRITERION
54   ctype = 'workspace'   -> CRITERION
55   ']' -> call cmd_criteria_match_windows(); INITIAL
56
57 state CRITERION:
58   '=' -> CRITERION_STR
59
60 state CRITERION_STR:
61   cvalue = word
62       -> call cmd_criteria_add($ctype, $cvalue); CRITERIA
63
64 # exec [--no-startup-id] <command>
65 state EXEC:
66   nosn = '--no-startup-id'
67       ->
68   command = string
69       -> call cmd_exec($nosn, $command)
70
71 # shmlog <size>|toggle|on|off
72 state SHMLOG:
73   # argument may be a number
74   argument = string
75     -> call cmd_shmlog($argument)
76
77 # debuglog toggle|on|off
78 state DEBUGLOG:
79   argument = 'toggle', 'on', 'off'
80     -> call cmd_debuglog($argument)
81
82 # border normal|pixel [<n>]
83 # border none|1pixel|toggle
84 state BORDER:
85   border_style = 'normal', 'pixel'
86     -> BORDER_WIDTH
87   border_style = 'none', 'toggle'
88     -> call cmd_border($border_style, "0")
89   border_style = '1pixel'
90     -> call cmd_border($border_style, "1")
91
92 state BORDER_WIDTH:
93   end
94     -> call cmd_border($border_style, "2")
95   border_width = word
96     -> call cmd_border($border_style, $border_width)
97
98 # layout default|stacked|stacking|tabbed|splitv|splith
99 # layout toggle [split|all]
100 state LAYOUT:
101   layout_mode = 'default', 'stacked', 'stacking', 'tabbed', 'splitv', 'splith'
102       -> call cmd_layout($layout_mode)
103   'toggle'
104       -> LAYOUT_TOGGLE
105
106 # layout toggle [split|all]
107 state LAYOUT_TOGGLE:
108   end
109       -> call cmd_layout_toggle($toggle_mode)
110   toggle_mode = 'split', 'all'
111       -> call cmd_layout_toggle($toggle_mode)
112
113 # append_layout <path>
114 state APPEND_LAYOUT:
115   path = string -> call cmd_append_layout($path)
116
117 # workspace next|prev|next_on_output|prev_on_output
118 # workspace back_and_forth
119 # workspace <name>
120 # workspace number <number>
121 state WORKSPACE:
122   direction = 'next_on_output', 'prev_on_output', 'next', 'prev'
123       -> call cmd_workspace($direction)
124   'back_and_forth'
125       -> call cmd_workspace_back_and_forth()
126   'number'
127       -> WORKSPACE_NUMBER
128   workspace = string 
129       -> call cmd_workspace_name($workspace)
130
131 state WORKSPACE_NUMBER:
132   workspace = string
133       -> call cmd_workspace_number($workspace)
134
135 # focus left|right|up|down
136 # focus output <output>
137 # focus tiling|floating|mode_toggle
138 # focus parent|child
139 # focus
140 state FOCUS:
141   direction = 'left', 'right', 'up', 'down'
142       -> call cmd_focus_direction($direction)
143   'output'
144       -> FOCUS_OUTPUT
145   window_mode = 'tiling', 'floating', 'mode_toggle'
146       -> call cmd_focus_window_mode($window_mode)
147   level = 'parent', 'child'
148       -> call cmd_focus_level($level)
149   end
150       -> call cmd_focus()
151
152 state FOCUS_OUTPUT:
153   output = string
154       -> call cmd_focus_output($output)
155
156 # kill [window|client]
157 state KILL:
158   kill_mode = 'window', 'client'
159       -> call cmd_kill($kill_mode)
160   end
161       -> call cmd_kill($kill_mode)
162
163 # fullscreen enable|toggle [global]
164 # fullscreen disable
165 # fullscreen [global]
166 state FULLSCREEN:
167   action = 'disable'
168       -> call cmd_fullscreen($action, "output")
169   action = 'enable', 'toggle'
170       -> FULLSCREEN_MODE
171   action = ''
172       -> FULLSCREEN_COMPAT
173
174 state FULLSCREEN_MODE:
175   mode = 'global'
176       -> call cmd_fullscreen($action, $mode)
177   end
178       -> call cmd_fullscreen($action, "output")
179
180 state FULLSCREEN_COMPAT:
181   mode = 'global'
182       -> call cmd_fullscreen("toggle", $mode)
183   end
184       -> call cmd_fullscreen("toggle", "output")
185
186 # split v|h|vertical|horizontal
187 state SPLIT:
188   direction = 'horizontal', 'vertical', 'v', 'h'
189       -> call cmd_split($direction)
190
191 # floating enable|disable|toggle
192 state FLOATING:
193   floating = 'enable', 'disable', 'toggle'
194       -> call cmd_floating($floating)
195
196 # mark [--toggle] <mark>
197 state MARK:
198   toggle = '--toggle'
199       ->
200   mark = string
201       -> call cmd_mark($mark, $toggle)
202
203 # unmark [mark]
204 state UNMARK:
205   end
206       -> call cmd_unmark($mark)
207   mark = string
208       -> call cmd_unmark($mark)
209
210 # resize
211 state RESIZE:
212   way = 'grow', 'shrink'
213       -> RESIZE_DIRECTION
214   set = 'set'
215       -> RESIZE_SET
216
217 state RESIZE_DIRECTION:
218   direction = 'up', 'down', 'left', 'right', 'width', 'height'
219       -> RESIZE_PX
220
221 state RESIZE_PX:
222   resize_px = word
223       -> RESIZE_TILING
224   end
225       -> call cmd_resize($way, $direction, "10", "10")
226
227 state RESIZE_TILING:
228   'px'
229       ->
230   'or'
231       -> RESIZE_TILING_OR
232   end
233       -> call cmd_resize($way, $direction, $resize_px, "10")
234
235 state RESIZE_TILING_OR:
236   resize_ppt = word
237       -> RESIZE_TILING_FINAL
238
239 state RESIZE_TILING_FINAL:
240   'ppt', end
241       -> call cmd_resize($way, $direction, $resize_px, $resize_ppt)
242
243 state RESIZE_SET:
244   width = word
245       -> RESIZE_WIDTH
246
247 state RESIZE_WIDTH:
248   'px'
249       ->
250   height = word
251       -> RESIZE_HEIGHT
252
253 state RESIZE_HEIGHT:
254   'px', end
255       -> call cmd_size($width, $height)
256
257 # rename workspace <name> to <name>
258 # rename workspace to <name>
259 state RENAME:
260   'workspace'
261       -> RENAME_WORKSPACE
262
263 state RENAME_WORKSPACE:
264   old_name = 'to'
265       -> RENAME_WORKSPACE_LIKELY_TO
266   old_name = word
267       -> RENAME_WORKSPACE_TO
268
269 state RENAME_WORKSPACE_LIKELY_TO:
270   'to'
271       -> RENAME_WORKSPACE_NEW_NAME
272   new_name = word
273       -> call cmd_rename_workspace(NULL, $new_name)
274
275 state RENAME_WORKSPACE_TO:
276   'to'
277       -> RENAME_WORKSPACE_NEW_NAME
278
279 state RENAME_WORKSPACE_NEW_NAME:
280   end
281       -> call cmd_rename_workspace(NULL, "to")
282   new_name = string
283       -> call cmd_rename_workspace($old_name, $new_name)
284
285 # move <direction> [<pixels> [px]]
286 # move [window|container] [to] workspace [<str>|next|prev|next_on_output|prev_on_output|current]
287 # move [window|container] [to] output <str>
288 # move [window|container] [to] mark <str>
289 # move [window|container] [to] scratchpad
290 # move workspace to [output] <str>
291 # move scratchpad
292 # move [window|container] [to] [absolute] position [ [<pixels> [px] <pixels> [px]] | center ]
293 # move [window|container] [to] position mouse|cursor|pointer
294 state MOVE:
295   'window'
296       ->
297   'container'
298       ->
299   'to'
300       ->
301   'workspace'
302       -> MOVE_WORKSPACE
303   'output'
304       -> MOVE_TO_OUTPUT
305   'mark'
306       -> MOVE_TO_MARK
307   'scratchpad'
308       -> call cmd_move_scratchpad()
309   direction = 'left', 'right', 'up', 'down'
310       -> MOVE_DIRECTION
311   method = 'position'
312       -> MOVE_TO_POSITION
313   method = 'absolute'
314       -> MOVE_TO_ABSOLUTE_POSITION
315
316 state MOVE_DIRECTION:
317   pixels = word
318       -> MOVE_DIRECTION_PX
319   end
320       -> call cmd_move_direction($direction, "10")
321
322 state MOVE_DIRECTION_PX:
323   'px'
324       -> call cmd_move_direction($direction, $pixels)
325   end
326       -> call cmd_move_direction($direction, $pixels)
327
328 state MOVE_WORKSPACE:
329   'to '
330       -> MOVE_WORKSPACE_TO_OUTPUT
331   workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
332       -> call cmd_move_con_to_workspace($workspace)
333   'back_and_forth'
334       -> call cmd_move_con_to_workspace_back_and_forth()
335   'number'
336       -> MOVE_WORKSPACE_NUMBER
337   workspace = string
338       -> call cmd_move_con_to_workspace_name($workspace)
339
340 state MOVE_WORKSPACE_NUMBER:
341   number = string
342       -> call cmd_move_con_to_workspace_number($number)
343
344 state MOVE_TO_OUTPUT:
345   output = string
346       -> call cmd_move_con_to_output($output)
347
348 state MOVE_TO_MARK:
349   mark = string
350       -> call cmd_move_con_to_mark($mark)
351
352 state MOVE_WORKSPACE_TO_OUTPUT:
353   'output'
354       ->
355   output = string
356       -> call cmd_move_workspace_to_output($output)
357
358 state MOVE_TO_ABSOLUTE_POSITION:
359   'position'
360       -> MOVE_TO_POSITION
361
362 state MOVE_TO_POSITION:
363   'center'
364       -> call cmd_move_window_to_center($method)
365   'mouse', 'cursor', 'pointer'
366       -> call cmd_move_window_to_mouse()
367   coord_x = word
368       -> MOVE_TO_POSITION_X
369
370 state MOVE_TO_POSITION_X:
371   'px'
372       ->
373   coord_y = word
374       -> MOVE_TO_POSITION_Y
375
376 state MOVE_TO_POSITION_Y:
377   'px', end
378       -> call cmd_move_window_to_position($method, $coord_x, $coord_y)
379
380 # mode <string>
381 state MODE:
382   mode = string
383       -> call cmd_mode($mode)
384
385 state NOP:
386   comment = string
387       -> call cmd_nop($comment)
388   end
389       -> call cmd_nop(NULL)
390
391 state SCRATCHPAD:
392   'show'
393       -> call cmd_scratchpad_show()
394
395 state TITLE_FORMAT:
396   format = string
397       -> call cmd_title_format($format)
398
399 # bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]
400 state BAR:
401   bar_type = 'hidden_state'
402       -> BAR_HIDDEN_STATE
403   bar_type = 'mode'
404       -> BAR_MODE
405
406 state BAR_HIDDEN_STATE:
407   bar_value = 'hide', 'show', 'toggle'
408       -> BAR_W_ID
409
410 state BAR_MODE:
411   bar_value = 'dock', 'hide', 'invisible', 'toggle'
412       -> BAR_W_ID
413
414 state BAR_W_ID:
415   bar_id = word
416       ->
417   end
418       -> call cmd_bar($bar_type, $bar_value, $bar_id)