]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
Merge branch 'master' into next
[i3/i3] / parser-specs / config.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/config.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 # TODO: should we implement an include statement for the criteria part so we DRY?
13
14 state INITIAL:
15   # We have an end token here for all the commands which just call some
16   # function without using an explicit 'end' token.
17   end ->
18   error ->
19   '#'                                      -> IGNORE_LINE
20   'set'                                    -> IGNORE_LINE
21   bindtype = 'bindsym', 'bindcode', 'bind' -> BINDING
22   'bar'                                    -> BARBRACE
23   'font'                                   -> FONT
24   'mode'                                   -> MODENAME
25   'floating_minimum_size'                  -> FLOATING_MINIMUM_SIZE_WIDTH
26   'floating_maximum_size'                  -> FLOATING_MAXIMUM_SIZE_WIDTH
27   'floating_modifier'                      -> FLOATING_MODIFIER
28   'default_orientation'                    -> DEFAULT_ORIENTATION
29   'workspace_layout'                       -> WORKSPACE_LAYOUT
30   windowtype = 'new_window', 'new_float'   -> NEW_WINDOW
31   'hide_edge_borders'                      -> HIDE_EDGE_BORDERS
32   'for_window'                             -> FOR_WINDOW
33   'assign'                                 -> ASSIGN
34   'focus_follows_mouse'                    -> FOCUS_FOLLOWS_MOUSE
35   'mouse_warping'                          -> MOUSE_WARPING
36   'force_focus_wrapping'                   -> FORCE_FOCUS_WRAPPING
37   'force_xinerama', 'force-xinerama'       -> FORCE_XINERAMA
38   'workspace_auto_back_and_forth'          -> WORKSPACE_BACK_AND_FORTH
39   'fake_outputs', 'fake-outputs'           -> FAKE_OUTPUTS
40   'force_display_urgency_hint'             -> FORCE_DISPLAY_URGENCY_HINT
41   'workspace'                              -> WORKSPACE
42   'ipc_socket', 'ipc-socket'               -> IPC_SOCKET
43   'restart_state'                          -> RESTART_STATE
44   'popup_during_fullscreen'                -> POPUP_DURING_FULLSCREEN
45   exectype = 'exec_always', 'exec'         -> EXEC
46   colorclass = 'client.background'
47       -> COLOR_SINGLE
48   colorclass = 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
49       -> COLOR_BORDER
50
51 # We ignore comments and 'set' lines (variables).
52 state IGNORE_LINE:
53   line
54       -> INITIAL
55
56 # floating_minimum_size <width> x <height>
57 state FLOATING_MINIMUM_SIZE_WIDTH:
58   width = number
59       -> FLOATING_MINIMUM_SIZE_X
60
61 state FLOATING_MINIMUM_SIZE_X:
62   'x'
63       -> FLOATING_MINIMUM_SIZE_HEIGHT
64
65 state FLOATING_MINIMUM_SIZE_HEIGHT:
66   height = number
67       -> call cfg_floating_minimum_size(&width, &height)
68
69 # floating_maximum_size <width> x <height>
70 state FLOATING_MAXIMUM_SIZE_WIDTH:
71   width = number
72       -> FLOATING_MAXIMUM_SIZE_X
73
74 state FLOATING_MAXIMUM_SIZE_X:
75   'x'
76       -> FLOATING_MAXIMUM_SIZE_HEIGHT
77
78 state FLOATING_MAXIMUM_SIZE_HEIGHT:
79   height = number
80       -> call cfg_floating_maximum_size(&width, &height)
81
82 # floating_modifier <modifier>
83 state FLOATING_MODIFIER:
84   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl'
85       ->
86   '+'
87       ->
88   end
89       -> call cfg_floating_modifier($modifiers)
90
91 # default_orientation <horizontal|vertical|auto>
92 state DEFAULT_ORIENTATION:
93   orientation = 'horizontal', 'vertical', 'auto'
94       -> call cfg_default_orientation($orientation)
95
96 # workspace_layout <default|stacking|tabbed>
97 state WORKSPACE_LAYOUT:
98   layout = 'default', 'stacking', 'stacked', 'tabbed'
99       -> call cfg_workspace_layout($layout)
100
101 # new_window <normal|1pixel|none>
102 # new_float <normal|1pixel|none>
103 # TODO: new_float is not in the userguide yet
104 # TODO: pixel is not in the userguide yet
105 state NEW_WINDOW:
106   border = 'normal', 'pixel'
107       -> NEW_WINDOW_PIXELS
108   border = '1pixel', 'none'
109       -> call cfg_new_window($windowtype, $border, -1)
110
111 state NEW_WINDOW_PIXELS:
112   end
113       -> call cfg_new_window($windowtype, $border, 2)
114   width = number
115       -> NEW_WINDOW_PIXELS_PX
116
117 state NEW_WINDOW_PIXELS_PX:
118   'px'
119       ->
120   end
121       -> call cfg_new_window($windowtype, $border, &width)
122
123 # hide_edge_borders <none|vertical|horizontal|both>
124 # also hide_edge_borders <bool> for compatibility
125 state HIDE_EDGE_BORDERS:
126   hide_borders = 'none', 'vertical', 'horizontal', 'both'
127       -> call cfg_hide_edge_borders($hide_borders)
128   hide_borders = '1', 'yes', 'true', 'on', 'enable', 'active'
129       -> call cfg_hide_edge_borders($hide_borders)
130
131 # for_window <criteria> command
132 state FOR_WINDOW:
133   '['
134       -> call cfg_criteria_init(FOR_WINDOW_COMMAND); CRITERIA
135
136 state FOR_WINDOW_COMMAND:
137   command = string
138       -> call cfg_for_window($command)
139
140 # assign <criteria> [→] workspace
141 state ASSIGN:
142   '['
143       -> call cfg_criteria_init(ASSIGN_WORKSPACE); CRITERIA
144
145 state ASSIGN_WORKSPACE:
146   '→'
147       ->
148   workspace = string
149       -> call cfg_assign($workspace)
150
151 # Criteria: Used by for_window and assign.
152 state CRITERIA:
153   ctype = 'class'       -> CRITERION
154   ctype = 'instance'    -> CRITERION
155   ctype = 'window_role' -> CRITERION
156   ctype = 'con_id'      -> CRITERION
157   ctype = 'id'          -> CRITERION
158   ctype = 'con_mark'    -> CRITERION
159   ctype = 'title'       -> CRITERION
160   ctype = 'urgent'      -> CRITERION
161   ']'
162       -> call cfg_criteria_pop_state()
163
164 state CRITERION:
165   '=' -> CRITERION_STR
166
167 state CRITERION_STR:
168   cvalue = word
169       -> call cfg_criteria_add($ctype, $cvalue); CRITERIA
170
171 # focus_follows_mouse bool
172 state FOCUS_FOLLOWS_MOUSE:
173   value = word
174       -> call cfg_focus_follows_mouse($value)
175
176 # mouse_warping warping_t
177 state MOUSE_WARPING:
178   value = 'none', 'output'
179       -> call cfg_mouse_warping($value)
180
181 # force_focus_wrapping
182 state FORCE_FOCUS_WRAPPING:
183   value = word
184       -> call cfg_force_focus_wrapping($value)
185
186 # force_xinerama
187 state FORCE_XINERAMA:
188   value = word
189       -> call cfg_force_xinerama($value)
190
191 # workspace_back_and_forth
192 state WORKSPACE_BACK_AND_FORTH:
193   value = word
194       -> call cfg_workspace_back_and_forth($value)
195
196
197 # fake_outputs (for testcases)
198 state FAKE_OUTPUTS:
199   outputs = string
200       -> call cfg_fake_outputs($outputs)
201
202 # force_display_urgency_hint <timeout> ms
203 state FORCE_DISPLAY_URGENCY_HINT:
204   duration_ms = number
205       -> FORCE_DISPLAY_URGENCY_HINT_MS
206
207 state FORCE_DISPLAY_URGENCY_HINT_MS:
208   'ms'
209       ->
210   end
211       -> call cfg_force_display_urgency_hint(&duration_ms)
212
213 # workspace <workspace> output <output>
214 state WORKSPACE:
215   workspace = word
216     -> WORKSPACE_OUTPUT
217
218 state WORKSPACE_OUTPUT:
219   'output'
220       -> WORKSPACE_OUTPUT_STR
221
222 state WORKSPACE_OUTPUT_STR:
223   output = word
224       -> call cfg_workspace($workspace, $output)
225
226 # ipc-socket <path>
227 state IPC_SOCKET:
228   path = string
229       -> call cfg_ipc_socket($path)
230
231 # restart_state <path> (for testcases)
232 state RESTART_STATE:
233   path = string
234       -> call cfg_restart_state($path)
235
236 # popup_during_fullscreen
237 state POPUP_DURING_FULLSCREEN:
238   value = 'ignore', 'leave_fullscreen', 'smart'
239       -> call cfg_popup_during_fullscreen($value)
240
241 # client.background <hexcolor>
242 state COLOR_SINGLE:
243   color = word
244       -> call cfg_color_single($colorclass, $color)
245
246 # colorclass border background text indicator
247 state COLOR_BORDER:
248   border = word
249       -> COLOR_BACKGROUND
250
251 state COLOR_BACKGROUND:
252   background = word
253       -> COLOR_TEXT
254
255 state COLOR_TEXT:
256   text = word
257       -> COLOR_INDICATOR
258
259 state COLOR_INDICATOR:
260   indicator = word
261       -> call cfg_color($colorclass, $border, $background, $text, $indicator)
262   end
263       -> call cfg_color($colorclass, $border, $background, $text, NULL)
264
265 # <exec|exec_always> [--no-startup-id] command
266 state EXEC:
267   no_startup_id = '--no-startup-id'
268       ->
269   command = string
270       -> call cfg_exec($exectype, $no_startup_id, $command)
271
272 # font font
273 state FONT:
274   font = string
275       -> call cfg_font($font)
276
277 # bindsym/bindcode
278 state BINDING:
279   release = '--release'
280       ->
281   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', '$mod'
282       ->
283   '+'
284       ->
285   key = word
286       -> BINDCOMMAND
287
288 state BINDCOMMAND:
289   release = '--release'
290       ->
291   command = string
292       -> call cfg_binding($bindtype, $modifiers, $key, $release, $command)
293
294 ################################################################################
295 # Mode configuration
296 ################################################################################
297
298 state MODENAME:
299   modename = word
300       -> call cfg_enter_mode($modename); MODEBRACE
301
302 state MODEBRACE:
303   end
304       ->
305   '{'
306       -> MODE
307
308 state MODE:
309   end ->
310   error ->
311   '#' -> MODE_IGNORE_LINE
312   'set' -> MODE_IGNORE_LINE
313   bindtype = 'bindsym', 'bindcode', 'bind'
314       -> MODE_BINDING
315   '}'
316       -> INITIAL
317
318 # We ignore comments and 'set' lines (variables).
319 state MODE_IGNORE_LINE:
320   line
321       -> MODE
322
323 state MODE_BINDING:
324   release = '--release'
325       ->
326   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', '$mod'
327       ->
328   '+'
329       ->
330   key = word
331       -> MODE_BINDCOMMAND
332
333 state MODE_BINDCOMMAND:
334   release = '--release'
335       ->
336   command = string
337       -> call cfg_mode_binding($bindtype, $modifiers, $key, $release, $command); MODE
338
339 ################################################################################
340 # Bar configuration (i3bar)
341 ################################################################################
342
343 state BARBRACE:
344   end
345       ->
346   '{'
347       -> BAR
348
349 state BAR:
350   end ->
351   error ->
352   '#' -> BAR_IGNORE_LINE
353   'set' -> BAR_IGNORE_LINE
354   'i3bar_command'          -> BAR_BAR_COMMAND
355   'status_command'         -> BAR_STATUS_COMMAND
356   'socket_path'            -> BAR_SOCKET_PATH
357   'mode'                   -> BAR_MODE
358   'hidden_state'           -> BAR_HIDDEN_STATE
359   'id'                     -> BAR_ID
360   'modifier'               -> BAR_MODIFIER
361   'wheel_up_cmd'           -> BAR_WHEEL_UP_CMD
362   'wheel_down_cmd'         -> BAR_WHEEL_DOWN_CMD
363   'position'               -> BAR_POSITION
364   'output'                 -> BAR_OUTPUT
365   'tray_output'            -> BAR_TRAY_OUTPUT
366   'font'                   -> BAR_FONT
367   'binding_mode_indicator' -> BAR_BINDING_MODE_INDICATOR
368   'workspace_buttons'      -> BAR_WORKSPACE_BUTTONS
369   'strip_workspace_numbers' -> BAR_STRIP_WORKSPACE_NUMBERS
370   'verbose'                -> BAR_VERBOSE
371   'colors'                 -> BAR_COLORS_BRACE
372   '}'
373       -> call cfg_bar_finish(); INITIAL
374
375 # We ignore comments and 'set' lines (variables).
376 state BAR_IGNORE_LINE:
377   line
378       -> BAR
379
380 state BAR_BAR_COMMAND:
381   command = string
382       -> call cfg_bar_i3bar_command($command); BAR
383
384 state BAR_STATUS_COMMAND:
385   command = string
386       -> call cfg_bar_status_command($command); BAR
387
388 state BAR_SOCKET_PATH:
389   path = string
390       -> call cfg_bar_socket_path($path); BAR
391
392 state BAR_MODE:
393   mode = 'dock', 'hide', 'invisible'
394       -> call cfg_bar_mode($mode); BAR
395
396 state BAR_HIDDEN_STATE:
397   hidden_state = 'hide', 'show'
398       -> call cfg_bar_hidden_state($hidden_state); BAR
399
400 state BAR_ID:
401   bar_id = word
402       -> call cfg_bar_id($bar_id); BAR
403
404 state BAR_MODIFIER:
405   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift'
406       -> call cfg_bar_modifier($modifier); BAR
407
408 state BAR_WHEEL_UP_CMD:
409   command = string
410       -> call cfg_bar_wheel_up_cmd($command); BAR
411
412 state BAR_WHEEL_DOWN_CMD:
413   command = string
414       -> call cfg_bar_wheel_down_cmd($command); BAR
415
416 state BAR_POSITION:
417   position = 'top', 'bottom'
418       -> call cfg_bar_position($position); BAR
419
420 state BAR_OUTPUT:
421   output = string
422       -> call cfg_bar_output($output); BAR
423
424 state BAR_TRAY_OUTPUT:
425   output = string
426       -> call cfg_bar_tray_output($output); BAR
427
428 state BAR_FONT:
429   font = string
430       -> call cfg_bar_font($font); BAR
431
432 state BAR_BINDING_MODE_INDICATOR:
433   value = word
434       -> call cfg_bar_binding_mode_indicator($value); BAR
435
436 state BAR_WORKSPACE_BUTTONS:
437   value = word
438       -> call cfg_bar_workspace_buttons($value); BAR
439
440 state BAR_STRIP_WORKSPACE_NUMBERS:
441   value = word
442       -> call cfg_bar_strip_workspace_numbers($value); BAR
443
444 state BAR_VERBOSE:
445   value = word
446       -> call cfg_bar_verbose($value); BAR
447
448 state BAR_COLORS_BRACE:
449   end
450       ->
451   '{'
452       -> BAR_COLORS
453
454 state BAR_COLORS:
455   end ->
456   '#' -> BAR_COLORS_IGNORE_LINE
457   'set' -> BAR_COLORS_IGNORE_LINE
458   colorclass = 'background', 'statusline', 'separator'
459       -> BAR_COLORS_SINGLE
460   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace'
461       -> BAR_COLORS_BORDER
462   '}'
463       -> BAR
464
465 # We ignore comments and 'set' lines (variables).
466 state BAR_COLORS_IGNORE_LINE:
467   line
468       -> BAR_COLORS
469
470 state BAR_COLORS_SINGLE:
471   color = word
472       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
473
474 state BAR_COLORS_BORDER:
475   border = word
476       -> BAR_COLORS_BACKGROUND
477
478 state BAR_COLORS_BACKGROUND:
479   background = word
480       -> BAR_COLORS_TEXT
481
482 state BAR_COLORS_TEXT:
483   end
484       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
485   text = word
486       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS