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