]> 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-2012 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   'border' -> BORDER
23   'layout' -> LAYOUT
24   'append_layout' -> APPEND_LAYOUT
25   'workspace' -> WORKSPACE
26   'focus' -> FOCUS
27   'kill' -> KILL
28   'open' -> call cmd_open()
29   'fullscreen' -> FULLSCREEN
30   'split' -> SPLIT
31   'floating' -> FLOATING
32   'mark' -> MARK
33   'resize' -> RESIZE
34   'rename' -> RENAME
35   'nop' -> NOP
36   'scratchpad' -> SCRATCHPAD
37   'mode' -> MODE
38
39 state CRITERIA:
40   ctype = 'class' -> CRITERION
41   ctype = 'instance' -> CRITERION
42   ctype = 'window_role' -> CRITERION
43   ctype = 'con_id' -> CRITERION
44   ctype = 'id' -> CRITERION
45   ctype = 'con_mark' -> CRITERION
46   ctype = 'title' -> CRITERION
47   ctype = 'urgent' -> CRITERION
48   ']' -> call cmd_criteria_match_windows(); INITIAL
49
50 state CRITERION:
51   '=' -> CRITERION_STR
52
53 state CRITERION_STR:
54   cvalue = word
55       -> call cmd_criteria_add($ctype, $cvalue); CRITERIA
56
57 # exec [--no-startup-id] <command>
58 state EXEC:
59   nosn = '--no-startup-id'
60       ->
61   command = string
62       -> call cmd_exec($nosn, $command)
63
64 # border normal|none|1pixel|toggle
65 state BORDER:
66   border_style = 'normal', 'none', '1pixel', 'toggle'
67       -> call cmd_border($border_style)
68
69 # layout default|stacked|stacking|tabbed
70 state LAYOUT:
71   layout_mode = 'default', 'stacked', 'stacking', 'tabbed'
72       -> call cmd_layout($layout_mode)
73
74 # append_layout <path>
75 state APPEND_LAYOUT:
76   path = string -> call cmd_append_layout($path)
77
78 # workspace next|prev|next_on_output|prev_on_output
79 # workspace back_and_forth
80 # workspace <name>
81 # workspace number <number>
82 state WORKSPACE:
83   direction = 'next_on_output', 'prev_on_output', 'next', 'prev'
84       -> call cmd_workspace($direction)
85   'back_and_forth'
86       -> call cmd_workspace_back_and_forth()
87   'number'
88       -> WORKSPACE_NUMBER
89   workspace = string 
90       -> call cmd_workspace_name($workspace)
91
92 state WORKSPACE_NUMBER:
93   workspace = string
94       -> call cmd_workspace_number($workspace)
95
96 # focus left|right|up|down
97 # focus output <output>
98 # focus tiling|floating|mode_toggle
99 # focus parent|child
100 # focus
101 state FOCUS:
102   direction = 'left', 'right', 'up', 'down'
103       -> call cmd_focus_direction($direction)
104   'output'
105       -> FOCUS_OUTPUT
106   window_mode = 'tiling', 'floating', 'mode_toggle'
107       -> call cmd_focus_window_mode($window_mode)
108   level = 'parent', 'child'
109       -> call cmd_focus_level($level)
110   end
111       -> call cmd_focus()
112
113 state FOCUS_OUTPUT:
114   output = string
115       -> call cmd_focus_output($output)
116
117 # kill [window|client]
118 state KILL:
119   kill_mode = 'window', 'client'
120       -> call cmd_kill($kill_mode)
121   end
122       -> call cmd_kill($kill_mode)
123
124 # fullscreen [global]
125 state FULLSCREEN:
126   fullscreen_mode = 'global'
127       -> call cmd_fullscreen($fullscreen_mode)
128   end
129       -> call cmd_fullscreen($fullscreen_mode)
130
131 # split v|h|vertical|horizontal
132 state SPLIT:
133   direction = 'horizontal', 'vertical', 'v', 'h'
134       -> call cmd_split($direction)
135
136 # floating enable|disable|toggle
137 state FLOATING:
138   floating = 'enable', 'disable', 'toggle'
139       -> call cmd_floating($floating)
140
141 # mark <mark>
142 state MARK:
143   mark = string
144       -> call cmd_mark($mark)
145
146 # resize
147 state RESIZE:
148   way = 'grow', 'shrink'
149       -> RESIZE_DIRECTION
150
151 state RESIZE_DIRECTION:
152   direction = 'up', 'down', 'left', 'right', 'width', 'height'
153       -> RESIZE_PX
154
155 state RESIZE_PX:
156   resize_px = word
157       -> RESIZE_TILING
158   end
159       -> call cmd_resize($way, $direction, "10", "10")
160
161 state RESIZE_TILING:
162   'px'
163       ->
164   'or'
165       -> RESIZE_TILING_OR
166   end
167       -> call cmd_resize($way, $direction, $resize_px, "10")
168
169 state RESIZE_TILING_OR:
170   'ppt'
171       ->
172   resize_ppt = word
173       ->
174   end
175       -> call cmd_resize($way, $direction, $resize_px, $resize_ppt)
176
177 # rename workspace <name> to <name>
178 state RENAME:
179   'workspace'
180       -> RENAME_WORKSPACE
181
182 state RENAME_WORKSPACE:
183   old_name = word
184       -> RENAME_WORKSPACE_TO
185
186 state RENAME_WORKSPACE_TO:
187   'to'
188       ->
189   new_name = string
190       -> call cmd_rename_workspace($old_name, $new_name)
191
192 # move <direction> [<pixels> [px]]
193 # move [window|container] [to] workspace [<str>|next|prev|current]
194 # move [window|container] [to] output <str>
195 # move [window|container] [to] scratchpad
196 # move workspace to [output] <str>
197 # move scratchpad
198 # move [window|container] [to] [absolute] position [ [<pixels> [px] <pixels> [px]] | center ]
199 state MOVE:
200   'window'
201       ->
202   'container'
203       ->
204   'to'
205       ->
206   'workspace'
207       -> MOVE_WORKSPACE
208   'output'
209       -> MOVE_TO_OUTPUT
210   'scratchpad'
211       -> call cmd_move_scratchpad()
212   direction = 'left', 'right', 'up', 'down'
213       -> MOVE_DIRECTION
214   method = 'position'
215       -> MOVE_TO_POSITION
216   method = 'absolute'
217       -> MOVE_TO_ABSOLUTE_POSITION
218
219 state MOVE_DIRECTION:
220   pixels = word
221       -> MOVE_DIRECTION_PX
222   end
223       -> call cmd_move_direction($direction, "10")
224
225 state MOVE_DIRECTION_PX:
226   'px'
227       -> call cmd_move_direction($direction, $pixels)
228   end
229       -> call cmd_move_direction($direction, $pixels)
230
231 state MOVE_WORKSPACE:
232   'to'
233       -> MOVE_WORKSPACE_TO_OUTPUT
234   workspace = 'next', 'prev', 'next_on_output', 'prev_on_output', 'current'
235       -> call cmd_move_con_to_workspace($workspace)
236   'number'
237       -> MOVE_WORKSPACE_NUMBER
238   workspace = string
239       -> call cmd_move_con_to_workspace_name($workspace)
240
241 state MOVE_WORKSPACE_NUMBER:
242   number = string
243       -> call cmd_move_con_to_workspace_number($number)
244
245 state MOVE_TO_OUTPUT:
246   output = string
247       -> call cmd_move_con_to_output($output)
248
249 state MOVE_WORKSPACE_TO_OUTPUT:
250   'output'
251       ->
252   output = string
253       -> call cmd_move_workspace_to_output($output)
254
255 state MOVE_TO_ABSOLUTE_POSITION:
256   'position'
257       -> MOVE_TO_POSITION
258
259 state MOVE_TO_POSITION:
260   'center'
261       -> call cmd_move_window_to_center($method)
262   coord_x = word
263       -> MOVE_TO_POSITION_X
264
265 state MOVE_TO_POSITION_X:
266   'px'
267       ->
268   coord_y = word
269       -> MOVE_TO_POSITION_Y
270
271 state MOVE_TO_POSITION_Y:
272   'px', end
273       -> call cmd_move_window_to_position($method, $coord_x, $coord_y)
274
275 # mode <string>
276 state MODE:
277   mode = string
278       -> call cmd_mode($mode)
279
280 state NOP:
281   comment = string
282       -> call cmd_nop($comment)
283
284 state SCRATCHPAD:
285   'show'
286       -> call cmd_scratchpad_show()