]> git.sur5r.net Git - i3/i3/blob - parser-specs/commands.spec
Introduce a config directive 'binding_mode' in the 'bar' config, pass it through...
[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   '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 = 'window_type' -> CRITERION
50   ctype = 'con_mark'    -> CRITERION
51   ctype = 'title'       -> CRITERION
52   ctype = 'urgent'      -> 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] mark <str>
270 # move [window|container] [to] scratchpad
271 # move workspace to [output] <str>
272 # move scratchpad
273 # move [window|container] [to] [absolute] position [ [<pixels> [px] <pixels> [px]] | center ]
274 # move [window|container] [to] position mouse|cursor|pointer
275 state MOVE:
276   'window'
277       ->
278   'container'
279       ->
280   'to'
281       ->
282   'workspace'
283       -> MOVE_WORKSPACE
284   'output'
285       -> MOVE_TO_OUTPUT
286   'mark'
287       -> MOVE_TO_MARK
288   'scratchpad'
289       -> call cmd_move_scratchpad()
290   direction = 'left', 'right', 'up', 'down'
291       -> MOVE_DIRECTION
292   method = 'position'
293       -> MOVE_TO_POSITION
294   method = 'absolute'
295       -> MOVE_TO_ABSOLUTE_POSITION
296
297 state MOVE_DIRECTION:
298   pixels = word
299       -> MOVE_DIRECTION_PX
300   end
301       -> call cmd_move_direction($direction, "10")
302
303 state MOVE_DIRECTION_PX:
304   'px'
305       -> call cmd_move_direction($direction, $pixels)
306   end
307       -> call cmd_move_direction($direction, $pixels)
308
309 state MOVE_WORKSPACE:
310   'to '
311       -> MOVE_WORKSPACE_TO_OUTPUT
312   workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
313       -> call cmd_move_con_to_workspace($workspace)
314   'back_and_forth'
315       -> call cmd_move_con_to_workspace_back_and_forth()
316   'number'
317       -> MOVE_WORKSPACE_NUMBER
318   workspace = string
319       -> call cmd_move_con_to_workspace_name($workspace)
320
321 state MOVE_WORKSPACE_NUMBER:
322   number = string
323       -> call cmd_move_con_to_workspace_number($number)
324
325 state MOVE_TO_OUTPUT:
326   output = string
327       -> call cmd_move_con_to_output($output)
328
329 state MOVE_TO_MARK:
330   mark = string
331       -> call cmd_move_con_to_mark($mark)
332
333 state MOVE_WORKSPACE_TO_OUTPUT:
334   'output'
335       ->
336   output = string
337       -> call cmd_move_workspace_to_output($output)
338
339 state MOVE_TO_ABSOLUTE_POSITION:
340   'position'
341       -> MOVE_TO_POSITION
342
343 state MOVE_TO_POSITION:
344   'center'
345       -> call cmd_move_window_to_center($method)
346   'mouse', 'cursor', 'pointer'
347       -> call cmd_move_window_to_mouse()
348   coord_x = word
349       -> MOVE_TO_POSITION_X
350
351 state MOVE_TO_POSITION_X:
352   'px'
353       ->
354   coord_y = word
355       -> MOVE_TO_POSITION_Y
356
357 state MOVE_TO_POSITION_Y:
358   'px', end
359       -> call cmd_move_window_to_position($method, $coord_x, $coord_y)
360
361 # mode <string>
362 state MODE:
363   mode = string
364       -> call cmd_mode($mode)
365
366 state NOP:
367   comment = string
368       -> call cmd_nop($comment)
369   end
370       -> call cmd_nop(NULL)
371
372 state SCRATCHPAD:
373   'show'
374       -> call cmd_scratchpad_show()
375
376 # bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]
377 state BAR:
378   bar_type = 'hidden_state'
379       -> BAR_HIDDEN_STATE
380   bar_type = 'mode'
381       -> BAR_MODE
382
383 state BAR_HIDDEN_STATE:
384   bar_value = 'hide', 'show', 'toggle'
385       -> BAR_W_ID
386
387 state BAR_MODE:
388   bar_value = 'dock', 'hide', 'invisible', 'toggle'
389       -> BAR_W_ID
390
391 state BAR_W_ID:
392   bar_id = word
393       ->
394   end
395       -> call cmd_bar($bar_type, $bar_value, $bar_id)