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