]> git.sur5r.net Git - i3/i3/blob - parser-specs/commands.spec
Merge branch 'release-4.16.1'
[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', 'toggle'
90     -> BORDER_WIDTH
91   border_style = 'none'
92     -> call cmd_border($border_style, 0)
93   '1pixel'
94     -> call cmd_border("pixel", 1)
95
96 state BORDER_WIDTH:
97   end
98     -> call cmd_border($border_style, -1)
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, 0)
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   'height'
258       -> RESIZE_HEIGHT_GET_NUMBER
259   'width'
260       ->
261   width = number
262       -> RESIZE_WIDTH
263
264 state RESIZE_WIDTH:
265   mode_width = 'px', 'ppt'
266       ->
267   end
268       -> call cmd_resize_set(&width, $mode_width, 0, 0)
269   'height'
270       -> RESIZE_HEIGHT_GET_NUMBER
271   height = number
272       -> RESIZE_HEIGHT
273
274 state RESIZE_HEIGHT_GET_NUMBER:
275   height = number
276       -> RESIZE_HEIGHT
277
278 state RESIZE_HEIGHT:
279   mode_height = 'px', 'ppt'
280       ->
281   end
282       -> call cmd_resize_set(&width, $mode_width, &height, $mode_height)
283
284 # rename workspace <name> to <name>
285 # rename workspace to <name>
286 state RENAME:
287   'workspace'
288       -> RENAME_WORKSPACE
289
290 state RENAME_WORKSPACE:
291   'to'
292       -> RENAME_WORKSPACE_LIKELY_TO
293   old_name = word
294       -> RENAME_WORKSPACE_TO
295
296 state RENAME_WORKSPACE_LIKELY_TO:
297   'to '
298       -> RENAME_WORKSPACE_LIKELY_TO_NEW_NAME
299   new_name = word
300       -> call cmd_rename_workspace(NULL, $new_name)
301
302 state RENAME_WORKSPACE_LIKELY_TO_NEW_NAME:
303   new_name = string
304       -> call cmd_rename_workspace("to", $new_name)
305   end
306       -> call cmd_rename_workspace(NULL, "to")
307
308 state RENAME_WORKSPACE_TO:
309   'to'
310       -> RENAME_WORKSPACE_TO_NEW_NAME
311
312 state RENAME_WORKSPACE_TO_NEW_NAME:
313   new_name = string
314       -> call cmd_rename_workspace($old_name, $new_name)
315
316 # move <direction> [<pixels> [px]]
317 # move [window|container] [to] workspace [<str>|next|prev|next_on_output|prev_on_output|current]
318 # move [window|container] [to] output <str>
319 # move [window|container] [to] mark <str>
320 # move [window|container] [to] scratchpad
321 # move workspace to [output] <str>
322 # move scratchpad
323 # move [window|container] [to] [absolute] position [ [<pixels> [px] <pixels> [px]] | center ]
324 # move [window|container] [to] position mouse|cursor|pointer
325 state MOVE:
326   'window'
327       ->
328   'container'
329       ->
330   'to'
331       ->
332   no_auto_back_and_forth = '--no-auto-back-and-forth'
333       ->
334   'workspace'
335       -> MOVE_WORKSPACE
336   'output'
337       -> MOVE_TO_OUTPUT
338   'mark'
339       -> MOVE_TO_MARK
340   'scratchpad'
341       -> call cmd_move_scratchpad()
342   direction = 'left', 'right', 'up', 'down'
343       -> MOVE_DIRECTION
344   method = 'position'
345       -> MOVE_TO_POSITION
346   method = 'absolute'
347       -> MOVE_TO_ABSOLUTE_POSITION
348
349 state MOVE_DIRECTION:
350   pixels = number
351       -> MOVE_DIRECTION_PX
352   end
353       -> call cmd_move_direction($direction, 10)
354
355 state MOVE_DIRECTION_PX:
356   'px'
357       -> call cmd_move_direction($direction, &pixels)
358   end
359       -> call cmd_move_direction($direction, &pixels)
360
361 state MOVE_WORKSPACE:
362   'to '
363       -> MOVE_WORKSPACE_TO_OUTPUT
364   workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
365       -> call cmd_move_con_to_workspace($workspace)
366   'back_and_forth'
367       -> call cmd_move_con_to_workspace_back_and_forth()
368   'number'
369       -> MOVE_WORKSPACE_NUMBER
370   workspace = string
371       -> call cmd_move_con_to_workspace_name($workspace, $no_auto_back_and_forth)
372
373 state MOVE_WORKSPACE_NUMBER:
374   number = string
375       -> call cmd_move_con_to_workspace_number($number, $no_auto_back_and_forth)
376
377 state MOVE_TO_OUTPUT:
378   output = string
379       -> call cmd_move_con_to_output($output)
380
381 state MOVE_TO_MARK:
382   mark = string
383       -> call cmd_move_con_to_mark($mark)
384
385 state MOVE_WORKSPACE_TO_OUTPUT:
386   'output'
387       ->
388   output = string
389       -> call cmd_move_workspace_to_output($output)
390
391 state MOVE_TO_ABSOLUTE_POSITION:
392   'position'
393       -> MOVE_TO_POSITION
394
395 state MOVE_TO_POSITION:
396   'center'
397       -> call cmd_move_window_to_center($method)
398   'mouse', 'cursor', 'pointer'
399       -> call cmd_move_window_to_mouse()
400   coord_x = number
401       -> MOVE_TO_POSITION_X
402
403 state MOVE_TO_POSITION_X:
404   'px'
405       ->
406   coord_y = number
407       -> MOVE_TO_POSITION_Y
408
409 state MOVE_TO_POSITION_Y:
410   'px', end
411       -> call cmd_move_window_to_position(&coord_x, &coord_y)
412
413 # mode <string>
414 state MODE:
415   mode = string
416       -> call cmd_mode($mode)
417
418 state NOP:
419   comment = string
420       -> call cmd_nop($comment)
421   end
422       -> call cmd_nop(NULL)
423
424 state SCRATCHPAD:
425   'show'
426       -> call cmd_scratchpad_show()
427
428 # swap [container] [with] id <window>
429 # swap [container] [with] con_id <con_id>
430 # swap [container] [with] mark <mark>
431 state SWAP:
432   'container'
433       ->
434   'with'
435       ->
436   mode = 'id', 'con_id', 'mark'
437       -> SWAP_ARGUMENT
438
439 state SWAP_ARGUMENT:
440   arg = string
441       -> call cmd_swap($mode, $arg)
442
443 state TITLE_FORMAT:
444   format = string
445       -> call cmd_title_format($format)
446
447 # bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]
448 state BAR:
449   bar_type = 'hidden_state'
450       -> BAR_HIDDEN_STATE
451   bar_type = 'mode'
452       -> BAR_MODE
453
454 state BAR_HIDDEN_STATE:
455   bar_value = 'hide', 'show', 'toggle'
456       -> BAR_W_ID
457
458 state BAR_MODE:
459   bar_value = 'dock', 'hide', 'invisible', 'toggle'
460       -> BAR_W_ID
461
462 state BAR_W_ID:
463   bar_id = word
464       ->
465   end
466       -> call cmd_bar($bar_type, $bar_value, $bar_id)