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