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