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