]> git.sur5r.net Git - i3/i3/blob - parser-specs/commands.spec
Merge branch 'master' into 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   '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
215 state RESIZE_DIRECTION:
216   direction = 'up', 'down', 'left', 'right', 'width', 'height'
217       -> RESIZE_PX
218
219 state RESIZE_PX:
220   resize_px = word
221       -> RESIZE_TILING
222   end
223       -> call cmd_resize($way, $direction, "10", "10")
224
225 state RESIZE_TILING:
226   'px'
227       ->
228   'or'
229       -> RESIZE_TILING_OR
230   end
231       -> call cmd_resize($way, $direction, $resize_px, "10")
232
233 state RESIZE_TILING_OR:
234   resize_ppt = word
235       -> RESIZE_TILING_FINAL
236
237 state RESIZE_TILING_FINAL:
238   'ppt', end
239       -> call cmd_resize($way, $direction, $resize_px, $resize_ppt)
240
241 # rename workspace <name> to <name>
242 # rename workspace to <name>
243 state RENAME:
244   'workspace'
245       -> RENAME_WORKSPACE
246
247 state RENAME_WORKSPACE:
248   old_name = 'to'
249       -> RENAME_WORKSPACE_LIKELY_TO
250   old_name = word
251       -> RENAME_WORKSPACE_TO
252
253 state RENAME_WORKSPACE_LIKELY_TO:
254   'to'
255       -> RENAME_WORKSPACE_NEW_NAME
256   new_name = word
257       -> call cmd_rename_workspace(NULL, $new_name)
258
259 state RENAME_WORKSPACE_TO:
260   'to'
261       -> RENAME_WORKSPACE_NEW_NAME
262
263 state RENAME_WORKSPACE_NEW_NAME:
264   end
265       -> call cmd_rename_workspace(NULL, "to")
266   new_name = string
267       -> call cmd_rename_workspace($old_name, $new_name)
268
269 # move <direction> [<pixels> [px]]
270 # move [window|container] [to] workspace [<str>|next|prev|next_on_output|prev_on_output|current]
271 # move [window|container] [to] output <str>
272 # move [window|container] [to] mark <str>
273 # move [window|container] [to] scratchpad
274 # move workspace to [output] <str>
275 # move scratchpad
276 # move [window|container] [to] [absolute] position [ [<pixels> [px] <pixels> [px]] | center ]
277 # move [window|container] [to] position mouse|cursor|pointer
278 state MOVE:
279   'window'
280       ->
281   'container'
282       ->
283   'to'
284       ->
285   'workspace'
286       -> MOVE_WORKSPACE
287   'output'
288       -> MOVE_TO_OUTPUT
289   'mark'
290       -> MOVE_TO_MARK
291   'scratchpad'
292       -> call cmd_move_scratchpad()
293   direction = 'left', 'right', 'up', 'down'
294       -> MOVE_DIRECTION
295   method = 'position'
296       -> MOVE_TO_POSITION
297   method = 'absolute'
298       -> MOVE_TO_ABSOLUTE_POSITION
299
300 state MOVE_DIRECTION:
301   pixels = word
302       -> MOVE_DIRECTION_PX
303   end
304       -> call cmd_move_direction($direction, "10")
305
306 state MOVE_DIRECTION_PX:
307   'px'
308       -> call cmd_move_direction($direction, $pixels)
309   end
310       -> call cmd_move_direction($direction, $pixels)
311
312 state MOVE_WORKSPACE:
313   'to '
314       -> MOVE_WORKSPACE_TO_OUTPUT
315   workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
316       -> call cmd_move_con_to_workspace($workspace)
317   'back_and_forth'
318       -> call cmd_move_con_to_workspace_back_and_forth()
319   'number'
320       -> MOVE_WORKSPACE_NUMBER
321   workspace = string
322       -> call cmd_move_con_to_workspace_name($workspace)
323
324 state MOVE_WORKSPACE_NUMBER:
325   number = string
326       -> call cmd_move_con_to_workspace_number($number)
327
328 state MOVE_TO_OUTPUT:
329   output = string
330       -> call cmd_move_con_to_output($output)
331
332 state MOVE_TO_MARK:
333   mark = string
334       -> call cmd_move_con_to_mark($mark)
335
336 state MOVE_WORKSPACE_TO_OUTPUT:
337   'output'
338       ->
339   output = string
340       -> call cmd_move_workspace_to_output($output)
341
342 state MOVE_TO_ABSOLUTE_POSITION:
343   'position'
344       -> MOVE_TO_POSITION
345
346 state MOVE_TO_POSITION:
347   'center'
348       -> call cmd_move_window_to_center($method)
349   'mouse', 'cursor', 'pointer'
350       -> call cmd_move_window_to_mouse()
351   coord_x = word
352       -> MOVE_TO_POSITION_X
353
354 state MOVE_TO_POSITION_X:
355   'px'
356       ->
357   coord_y = word
358       -> MOVE_TO_POSITION_Y
359
360 state MOVE_TO_POSITION_Y:
361   'px', end
362       -> call cmd_move_window_to_position($method, $coord_x, $coord_y)
363
364 # mode <string>
365 state MODE:
366   mode = string
367       -> call cmd_mode($mode)
368
369 state NOP:
370   comment = string
371       -> call cmd_nop($comment)
372   end
373       -> call cmd_nop(NULL)
374
375 state SCRATCHPAD:
376   'show'
377       -> call cmd_scratchpad_show()
378
379 state TITLE_FORMAT:
380   format = string
381       -> call cmd_title_format($format)
382
383 # bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]
384 state BAR:
385   bar_type = 'hidden_state'
386       -> BAR_HIDDEN_STATE
387   bar_type = 'mode'
388       -> BAR_MODE
389
390 state BAR_HIDDEN_STATE:
391   bar_value = 'hide', 'show', 'toggle'
392       -> BAR_W_ID
393
394 state BAR_MODE:
395   bar_value = 'dock', 'hide', 'invisible', 'toggle'
396       -> BAR_W_ID
397
398 state BAR_W_ID:
399   bar_id = word
400       ->
401   end
402       -> call cmd_bar($bar_type, $bar_value, $bar_id)