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