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