]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
24f40802b8dac4e8e6edab16bd6beffe5389d860
[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   'workspace_auto_back_and_forth'          -> WORKSPACE_BACK_AND_FORTH
41   'fake_outputs', 'fake-outputs'           -> FAKE_OUTPUTS
42   'force_display_urgency_hint'             -> FORCE_DISPLAY_URGENCY_HINT
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'
151       ->
152   workspace = string
153       -> call cfg_assign($workspace)
154
155 # no_focus <criteria>
156 state NO_FOCUS:
157   '['
158       -> call cfg_criteria_init(NO_FOCUS_END); CRITERIA
159
160 state NO_FOCUS_END:
161   end
162       -> call cfg_no_focus()
163
164 # Criteria: Used by for_window and assign.
165 state CRITERIA:
166   ctype = 'class'       -> CRITERION
167   ctype = 'instance'    -> CRITERION
168   ctype = 'window_role' -> CRITERION
169   ctype = 'con_id'      -> CRITERION
170   ctype = 'id'          -> CRITERION
171   ctype = 'window_type' -> CRITERION
172   ctype = 'con_mark'    -> CRITERION
173   ctype = 'title'       -> CRITERION
174   ctype = 'urgent'      -> CRITERION
175   ctype = 'workspace'   -> CRITERION
176   ']'
177       -> call cfg_criteria_pop_state()
178
179 state CRITERION:
180   '=' -> CRITERION_STR
181
182 state CRITERION_STR:
183   cvalue = word
184       -> call cfg_criteria_add($ctype, $cvalue); CRITERIA
185
186 # focus_follows_mouse bool
187 state FOCUS_FOLLOWS_MOUSE:
188   value = word
189       -> call cfg_focus_follows_mouse($value)
190
191 # mouse_warping warping_t
192 state MOUSE_WARPING:
193   value = 'none', 'output'
194       -> call cfg_mouse_warping($value)
195
196 # force_focus_wrapping
197 state FORCE_FOCUS_WRAPPING:
198   value = word
199       -> call cfg_force_focus_wrapping($value)
200
201 # force_xinerama
202 state FORCE_XINERAMA:
203   value = word
204       -> call cfg_force_xinerama($value)
205
206 # workspace_back_and_forth
207 state WORKSPACE_BACK_AND_FORTH:
208   value = word
209       -> call cfg_workspace_back_and_forth($value)
210
211
212 # fake_outputs (for testcases)
213 state FAKE_OUTPUTS:
214   outputs = string
215       -> call cfg_fake_outputs($outputs)
216
217 # force_display_urgency_hint <timeout> ms
218 state FORCE_DISPLAY_URGENCY_HINT:
219   duration_ms = number
220       -> FORCE_DISPLAY_URGENCY_HINT_MS
221
222 # show_marks
223 state SHOW_MARKS:
224   value = word
225       -> call cfg_show_marks($value)
226
227 state FORCE_DISPLAY_URGENCY_HINT_MS:
228   'ms'
229       ->
230   end
231       -> call cfg_force_display_urgency_hint(&duration_ms)
232
233 # focus_on_window_activation <smart|urgent|focus|none>
234 state FOCUS_ON_WINDOW_ACTIVATION:
235   mode = word
236       -> call cfg_focus_on_window_activation($mode)
237
238 # workspace <workspace> output <output>
239 state WORKSPACE:
240   workspace = word
241     -> WORKSPACE_OUTPUT
242
243 state WORKSPACE_OUTPUT:
244   'output'
245       -> WORKSPACE_OUTPUT_STR
246
247 state WORKSPACE_OUTPUT_STR:
248   output = word
249       -> call cfg_workspace($workspace, $output)
250
251 # ipc-socket <path>
252 state IPC_SOCKET:
253   path = string
254       -> call cfg_ipc_socket($path)
255
256 # restart_state <path> (for testcases)
257 state RESTART_STATE:
258   path = string
259       -> call cfg_restart_state($path)
260
261 # popup_during_fullscreen
262 state POPUP_DURING_FULLSCREEN:
263   value = 'ignore', 'leave_fullscreen', 'smart'
264       -> call cfg_popup_during_fullscreen($value)
265
266 # client.background <hexcolor>
267 state COLOR_SINGLE:
268   color = word
269       -> call cfg_color_single($colorclass, $color)
270
271 # colorclass border background text indicator
272 state COLOR_BORDER:
273   border = word
274       -> COLOR_BACKGROUND
275
276 state COLOR_BACKGROUND:
277   background = word
278       -> COLOR_TEXT
279
280 state COLOR_TEXT:
281   text = word
282       -> COLOR_INDICATOR
283
284 state COLOR_INDICATOR:
285   indicator = word
286       -> COLOR_CHILD_BORDER
287   end
288       -> call cfg_color($colorclass, $border, $background, $text, NULL, NULL)
289
290 state COLOR_CHILD_BORDER:
291   child_border = word
292       -> call cfg_color($colorclass, $border, $background, $text, $indicator, $child_border)
293   end
294       -> call cfg_color($colorclass, $border, $background, $text, $indicator, NULL)
295
296 # <exec|exec_always> [--no-startup-id] command
297 state EXEC:
298   no_startup_id = '--no-startup-id'
299       ->
300   command = string
301       -> call cfg_exec($exectype, $no_startup_id, $command)
302
303 # font font
304 state FONT:
305   font = string
306       -> call cfg_font($font)
307
308 # bindsym/bindcode
309 state BINDING:
310   release = '--release'
311       ->
312   border = '--border'
313       ->
314   whole_window = '--whole-window'
315       ->
316   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', 'Group1', 'Group2', 'Group3', 'Group4', '$mod'
317       ->
318   '+'
319       ->
320   key = word
321       -> BINDCOMMAND
322
323 state BINDCOMMAND:
324   release = '--release'
325       ->
326   border = '--border'
327       ->
328   whole_window = '--whole-window'
329       ->
330   command = string
331       -> call cfg_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $command)
332
333 ################################################################################
334 # Mode configuration
335 ################################################################################
336
337 state MODENAME:
338   pango_markup = '--pango_markup'
339       ->
340   modename = word
341       -> call cfg_enter_mode($pango_markup, $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', 'Group1', 'Group2', 'Group3', 'Group4', '$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       -> call cfg_bar_start(); 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   'bindsym'                -> BAR_BINDSYM
413   'position'               -> BAR_POSITION
414   'output'                 -> BAR_OUTPUT
415   'tray_output'            -> BAR_TRAY_OUTPUT
416   'tray_padding'           -> BAR_TRAY_PADDING
417   'font'                   -> BAR_FONT
418   'separator_symbol'       -> BAR_SEPARATOR_SYMBOL
419   'binding_mode_indicator' -> BAR_BINDING_MODE_INDICATOR
420   'workspace_buttons'      -> BAR_WORKSPACE_BUTTONS
421   'strip_workspace_numbers' -> BAR_STRIP_WORKSPACE_NUMBERS
422   'verbose'                -> BAR_VERBOSE
423   'colors'                 -> BAR_COLORS_BRACE
424   '}'
425       -> call cfg_bar_finish(); INITIAL
426
427 # We ignore comments and 'set' lines (variables).
428 state BAR_IGNORE_LINE:
429   line
430       -> BAR
431
432 state BAR_BAR_COMMAND:
433   command = string
434       -> call cfg_bar_i3bar_command($command); BAR
435
436 state BAR_STATUS_COMMAND:
437   command = string
438       -> call cfg_bar_status_command($command); BAR
439
440 state BAR_SOCKET_PATH:
441   path = string
442       -> call cfg_bar_socket_path($path); BAR
443
444 state BAR_MODE:
445   mode = 'dock', 'hide', 'invisible'
446       -> call cfg_bar_mode($mode); BAR
447
448 state BAR_HIDDEN_STATE:
449   hidden_state = 'hide', 'show'
450       -> call cfg_bar_hidden_state($hidden_state); BAR
451
452 state BAR_ID:
453   bar_id = word
454       -> call cfg_bar_id($bar_id); BAR
455
456 state BAR_MODIFIER:
457   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift', 'none', 'off'
458       -> call cfg_bar_modifier($modifier); BAR
459
460 state BAR_WHEEL_UP_CMD:
461   command = string
462       -> call cfg_bar_wheel_up_cmd($command); BAR
463
464 state BAR_WHEEL_DOWN_CMD:
465   command = string
466       -> call cfg_bar_wheel_down_cmd($command); BAR
467
468 state BAR_BINDSYM:
469   button = word
470       -> BAR_BINDSYM_COMMAND
471
472 state BAR_BINDSYM_COMMAND:
473   command = string
474       -> call cfg_bar_bindsym($button, $command); BAR
475
476 state BAR_POSITION:
477   position = 'top', 'bottom'
478       -> call cfg_bar_position($position); BAR
479
480 state BAR_OUTPUT:
481   output = string
482       -> call cfg_bar_output($output); BAR
483
484 state BAR_TRAY_OUTPUT:
485   output = word
486       -> call cfg_bar_tray_output($output); BAR
487
488 state BAR_TRAY_PADDING:
489   padding_px = number
490       -> BAR_TRAY_PADDING_PX
491
492 state BAR_TRAY_PADDING_PX:
493   'px'
494       ->
495   end
496       -> call cfg_bar_tray_padding(&padding_px); BAR
497
498 state BAR_FONT:
499   font = string
500       -> call cfg_bar_font($font); BAR
501
502 state BAR_SEPARATOR_SYMBOL:
503   separator = string
504       -> call cfg_bar_separator_symbol($separator); BAR
505
506 state BAR_BINDING_MODE_INDICATOR:
507   value = word
508       -> call cfg_bar_binding_mode_indicator($value); BAR
509
510 state BAR_WORKSPACE_BUTTONS:
511   value = word
512       -> call cfg_bar_workspace_buttons($value); BAR
513
514 state BAR_STRIP_WORKSPACE_NUMBERS:
515   value = word
516       -> call cfg_bar_strip_workspace_numbers($value); BAR
517
518 state BAR_VERBOSE:
519   value = word
520       -> call cfg_bar_verbose($value); BAR
521
522 state BAR_COLORS_BRACE:
523   end
524       ->
525   '{'
526       -> BAR_COLORS
527
528 state BAR_COLORS:
529   end ->
530   '#' -> BAR_COLORS_IGNORE_LINE
531   'set' -> BAR_COLORS_IGNORE_LINE
532   colorclass = 'background', 'statusline', 'separator', 'focused_background', 'focused_statusline', 'focused_separator'
533       -> BAR_COLORS_SINGLE
534   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace', 'binding_mode'
535       -> BAR_COLORS_BORDER
536   '}'
537       -> BAR
538
539 # We ignore comments and 'set' lines (variables).
540 state BAR_COLORS_IGNORE_LINE:
541   line
542       -> BAR_COLORS
543
544 state BAR_COLORS_SINGLE:
545   color = word
546       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
547
548 state BAR_COLORS_BORDER:
549   border = word
550       -> BAR_COLORS_BACKGROUND
551
552 state BAR_COLORS_BACKGROUND:
553   background = word
554       -> BAR_COLORS_TEXT
555
556 state BAR_COLORS_TEXT:
557   end
558       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
559   text = word
560       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS