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