]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
Merge pull request #2649 from s3rb31/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_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   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', 'Group1', 'Group2', 'Group3', 'Group4', '$mod'
325       ->
326   '+'
327       ->
328   key = word
329       -> BINDCOMMAND
330
331 state BINDCOMMAND:
332   release = '--release'
333       ->
334   border = '--border'
335       ->
336   whole_window = '--whole-window'
337       ->
338   command = string
339       -> call cfg_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $command)
340
341 ################################################################################
342 # Mode configuration
343 ################################################################################
344
345 state MODENAME:
346   pango_markup = '--pango_markup'
347       ->
348   modename = word
349       -> call cfg_enter_mode($pango_markup, $modename); MODEBRACE
350
351 state MODEBRACE:
352   end
353       ->
354   '{'
355       -> MODE
356
357 state MODE:
358   end ->
359   error ->
360   '#' -> MODE_IGNORE_LINE
361   'set' -> MODE_IGNORE_LINE
362   bindtype = 'bindsym', 'bindcode', 'bind'
363       -> MODE_BINDING
364   '}'
365       -> INITIAL
366
367 # We ignore comments and 'set' lines (variables).
368 state MODE_IGNORE_LINE:
369   line
370       -> MODE
371
372 state MODE_BINDING:
373   release = '--release'
374       ->
375   border = '--border'
376       ->
377   whole_window = '--whole-window'
378       ->
379   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', 'Group1', 'Group2', 'Group3', 'Group4', '$mod'
380       ->
381   '+'
382       ->
383   key = word
384       -> MODE_BINDCOMMAND
385
386 state MODE_BINDCOMMAND:
387   release = '--release'
388       ->
389   border = '--border'
390       ->
391   whole_window = '--whole-window'
392       ->
393   command = string
394       -> call cfg_mode_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $command); MODE
395
396 ################################################################################
397 # Bar configuration (i3bar)
398 ################################################################################
399
400 state BARBRACE:
401   end
402       ->
403   '{'
404       -> call cfg_bar_start(); BAR
405
406 state BAR:
407   end ->
408   error ->
409   '#' -> BAR_IGNORE_LINE
410   'set' -> BAR_IGNORE_LINE
411   'i3bar_command'          -> BAR_BAR_COMMAND
412   'status_command'         -> BAR_STATUS_COMMAND
413   'socket_path'            -> BAR_SOCKET_PATH
414   'mode'                   -> BAR_MODE
415   'hidden_state'           -> BAR_HIDDEN_STATE
416   'id'                     -> BAR_ID
417   'modifier'               -> BAR_MODIFIER
418   'wheel_up_cmd'           -> BAR_WHEEL_UP_CMD
419   'wheel_down_cmd'         -> BAR_WHEEL_DOWN_CMD
420   'bindsym'                -> BAR_BINDSYM
421   'position'               -> BAR_POSITION
422   'output'                 -> BAR_OUTPUT
423   'tray_output'            -> BAR_TRAY_OUTPUT
424   'tray_padding'           -> BAR_TRAY_PADDING
425   'font'                   -> BAR_FONT
426   'separator_symbol'       -> BAR_SEPARATOR_SYMBOL
427   'binding_mode_indicator' -> BAR_BINDING_MODE_INDICATOR
428   'workspace_buttons'      -> BAR_WORKSPACE_BUTTONS
429   'strip_workspace_numbers' -> BAR_STRIP_WORKSPACE_NUMBERS
430   'verbose'                -> BAR_VERBOSE
431   'colors'                 -> BAR_COLORS_BRACE
432   '}'
433       -> call cfg_bar_finish(); INITIAL
434
435 # We ignore comments and 'set' lines (variables).
436 state BAR_IGNORE_LINE:
437   line
438       -> BAR
439
440 state BAR_BAR_COMMAND:
441   command = string
442       -> call cfg_bar_i3bar_command($command); BAR
443
444 state BAR_STATUS_COMMAND:
445   command = string
446       -> call cfg_bar_status_command($command); BAR
447
448 state BAR_SOCKET_PATH:
449   path = string
450       -> call cfg_bar_socket_path($path); BAR
451
452 state BAR_MODE:
453   mode = 'dock', 'hide', 'invisible'
454       -> call cfg_bar_mode($mode); BAR
455
456 state BAR_HIDDEN_STATE:
457   hidden_state = 'hide', 'show'
458       -> call cfg_bar_hidden_state($hidden_state); BAR
459
460 state BAR_ID:
461   bar_id = word
462       -> call cfg_bar_id($bar_id); BAR
463
464 state BAR_MODIFIER:
465   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift', 'none', 'off'
466       -> call cfg_bar_modifier($modifier); BAR
467
468 state BAR_WHEEL_UP_CMD:
469   command = string
470       -> call cfg_bar_wheel_up_cmd($command); BAR
471
472 state BAR_WHEEL_DOWN_CMD:
473   command = string
474       -> call cfg_bar_wheel_down_cmd($command); BAR
475
476 state BAR_BINDSYM:
477   button = word
478       -> BAR_BINDSYM_COMMAND
479
480 state BAR_BINDSYM_COMMAND:
481   command = string
482       -> call cfg_bar_bindsym($button, $command); BAR
483
484 state BAR_POSITION:
485   position = 'top', 'bottom'
486       -> call cfg_bar_position($position); BAR
487
488 state BAR_OUTPUT:
489   output = string
490       -> call cfg_bar_output($output); BAR
491
492 state BAR_TRAY_OUTPUT:
493   output = word
494       -> call cfg_bar_tray_output($output); BAR
495
496 state BAR_TRAY_PADDING:
497   padding_px = number
498       -> BAR_TRAY_PADDING_PX
499
500 state BAR_TRAY_PADDING_PX:
501   'px'
502       ->
503   end
504       -> call cfg_bar_tray_padding(&padding_px); BAR
505
506 state BAR_FONT:
507   font = string
508       -> call cfg_bar_font($font); BAR
509
510 state BAR_SEPARATOR_SYMBOL:
511   separator = string
512       -> call cfg_bar_separator_symbol($separator); BAR
513
514 state BAR_BINDING_MODE_INDICATOR:
515   value = word
516       -> call cfg_bar_binding_mode_indicator($value); BAR
517
518 state BAR_WORKSPACE_BUTTONS:
519   value = word
520       -> call cfg_bar_workspace_buttons($value); BAR
521
522 state BAR_STRIP_WORKSPACE_NUMBERS:
523   value = word
524       -> call cfg_bar_strip_workspace_numbers($value); BAR
525
526 state BAR_VERBOSE:
527   value = word
528       -> call cfg_bar_verbose($value); BAR
529
530 state BAR_COLORS_BRACE:
531   end
532       ->
533   '{'
534       -> BAR_COLORS
535
536 state BAR_COLORS:
537   end ->
538   '#' -> BAR_COLORS_IGNORE_LINE
539   'set' -> BAR_COLORS_IGNORE_LINE
540   colorclass = 'background', 'statusline', 'separator', 'focused_background', 'focused_statusline', 'focused_separator'
541       -> BAR_COLORS_SINGLE
542   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace', 'binding_mode'
543       -> BAR_COLORS_BORDER
544   '}'
545       -> BAR
546
547 # We ignore comments and 'set' lines (variables).
548 state BAR_COLORS_IGNORE_LINE:
549   line
550       -> BAR_COLORS
551
552 state BAR_COLORS_SINGLE:
553   color = word
554       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
555
556 state BAR_COLORS_BORDER:
557   border = word
558       -> BAR_COLORS_BACKGROUND
559
560 state BAR_COLORS_BACKGROUND:
561   background = word
562       -> BAR_COLORS_TEXT
563
564 state BAR_COLORS_TEXT:
565   end
566       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
567   text = word
568       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS