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