]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
Added new criteria 'tiling' / 'floating'. (#2481)
[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|smart>
126 # also hide_edge_borders <bool> for compatibility
127 state HIDE_EDGE_BORDERS:
128   hide_borders = 'none', 'vertical', 'horizontal', 'both', 'smart'
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   ctype = 'tiling', 'floating'
177       -> call cfg_criteria_add($ctype, NULL); CRITERIA
178   ']'
179       -> call cfg_criteria_pop_state()
180
181 state CRITERION:
182   '=' -> CRITERION_STR
183
184 state CRITERION_STR:
185   cvalue = word
186       -> call cfg_criteria_add($ctype, $cvalue); CRITERIA
187
188 # focus_follows_mouse bool
189 state FOCUS_FOLLOWS_MOUSE:
190   value = word
191       -> call cfg_focus_follows_mouse($value)
192
193 # mouse_warping warping_t
194 state MOUSE_WARPING:
195   value = 'none', 'output'
196       -> call cfg_mouse_warping($value)
197
198 # force_focus_wrapping
199 state FORCE_FOCUS_WRAPPING:
200   value = word
201       -> call cfg_force_focus_wrapping($value)
202
203 # force_xinerama
204 state FORCE_XINERAMA:
205   value = word
206       -> call cfg_force_xinerama($value)
207
208 # workspace_back_and_forth
209 state WORKSPACE_BACK_AND_FORTH:
210   value = word
211       -> call cfg_workspace_back_and_forth($value)
212
213
214 # fake_outputs (for testcases)
215 state FAKE_OUTPUTS:
216   outputs = string
217       -> call cfg_fake_outputs($outputs)
218
219 # force_display_urgency_hint <timeout> ms
220 state FORCE_DISPLAY_URGENCY_HINT:
221   duration_ms = number
222       -> FORCE_DISPLAY_URGENCY_HINT_MS
223
224 # show_marks
225 state SHOW_MARKS:
226   value = word
227       -> call cfg_show_marks($value)
228
229 state FORCE_DISPLAY_URGENCY_HINT_MS:
230   'ms'
231       ->
232   end
233       -> call cfg_force_display_urgency_hint(&duration_ms)
234
235 # focus_on_window_activation <smart|urgent|focus|none>
236 state FOCUS_ON_WINDOW_ACTIVATION:
237   mode = word
238       -> call cfg_focus_on_window_activation($mode)
239
240 # workspace <workspace> output <output>
241 state WORKSPACE:
242   workspace = word
243     -> WORKSPACE_OUTPUT
244
245 state WORKSPACE_OUTPUT:
246   'output'
247       -> WORKSPACE_OUTPUT_STR
248
249 state WORKSPACE_OUTPUT_STR:
250   output = word
251       -> call cfg_workspace($workspace, $output)
252
253 # ipc-socket <path>
254 state IPC_SOCKET:
255   path = string
256       -> call cfg_ipc_socket($path)
257
258 # restart_state <path> (for testcases)
259 state RESTART_STATE:
260   path = string
261       -> call cfg_restart_state($path)
262
263 # popup_during_fullscreen
264 state POPUP_DURING_FULLSCREEN:
265   value = 'ignore', 'leave_fullscreen', 'smart'
266       -> call cfg_popup_during_fullscreen($value)
267
268 # client.background <hexcolor>
269 state COLOR_SINGLE:
270   color = word
271       -> call cfg_color_single($colorclass, $color)
272
273 # colorclass border background text indicator
274 state COLOR_BORDER:
275   border = word
276       -> COLOR_BACKGROUND
277
278 state COLOR_BACKGROUND:
279   background = word
280       -> COLOR_TEXT
281
282 state COLOR_TEXT:
283   text = word
284       -> COLOR_INDICATOR
285
286 state COLOR_INDICATOR:
287   indicator = word
288       -> COLOR_CHILD_BORDER
289   end
290       -> call cfg_color($colorclass, $border, $background, $text, NULL, NULL)
291
292 state COLOR_CHILD_BORDER:
293   child_border = word
294       -> call cfg_color($colorclass, $border, $background, $text, $indicator, $child_border)
295   end
296       -> call cfg_color($colorclass, $border, $background, $text, $indicator, 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', 'Group1', 'Group2', 'Group3', 'Group4', '$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   pango_markup = '--pango_markup'
341       ->
342   modename = word
343       -> call cfg_enter_mode($pango_markup, $modename); MODEBRACE
344
345 state MODEBRACE:
346   end
347       ->
348   '{'
349       -> MODE
350
351 state MODE:
352   end ->
353   error ->
354   '#' -> MODE_IGNORE_LINE
355   'set' -> MODE_IGNORE_LINE
356   bindtype = 'bindsym', 'bindcode', 'bind'
357       -> MODE_BINDING
358   '}'
359       -> INITIAL
360
361 # We ignore comments and 'set' lines (variables).
362 state MODE_IGNORE_LINE:
363   line
364       -> MODE
365
366 state MODE_BINDING:
367   release = '--release'
368       ->
369   border = '--border'
370       ->
371   whole_window = '--whole-window'
372       ->
373   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', 'Group1', 'Group2', 'Group3', 'Group4', '$mod'
374       ->
375   '+'
376       ->
377   key = word
378       -> MODE_BINDCOMMAND
379
380 state MODE_BINDCOMMAND:
381   release = '--release'
382       ->
383   border = '--border'
384       ->
385   whole_window = '--whole-window'
386       ->
387   command = string
388       -> call cfg_mode_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $command); MODE
389
390 ################################################################################
391 # Bar configuration (i3bar)
392 ################################################################################
393
394 state BARBRACE:
395   end
396       ->
397   '{'
398       -> call cfg_bar_start(); BAR
399
400 state BAR:
401   end ->
402   error ->
403   '#' -> BAR_IGNORE_LINE
404   'set' -> BAR_IGNORE_LINE
405   'i3bar_command'          -> BAR_BAR_COMMAND
406   'status_command'         -> BAR_STATUS_COMMAND
407   'socket_path'            -> BAR_SOCKET_PATH
408   'mode'                   -> BAR_MODE
409   'hidden_state'           -> BAR_HIDDEN_STATE
410   'id'                     -> BAR_ID
411   'modifier'               -> BAR_MODIFIER
412   'wheel_up_cmd'           -> BAR_WHEEL_UP_CMD
413   'wheel_down_cmd'         -> BAR_WHEEL_DOWN_CMD
414   'bindsym'                -> BAR_BINDSYM
415   'position'               -> BAR_POSITION
416   'output'                 -> BAR_OUTPUT
417   'tray_output'            -> BAR_TRAY_OUTPUT
418   'tray_padding'           -> BAR_TRAY_PADDING
419   'font'                   -> BAR_FONT
420   'separator_symbol'       -> BAR_SEPARATOR_SYMBOL
421   'binding_mode_indicator' -> BAR_BINDING_MODE_INDICATOR
422   'workspace_buttons'      -> BAR_WORKSPACE_BUTTONS
423   'strip_workspace_numbers' -> BAR_STRIP_WORKSPACE_NUMBERS
424   'verbose'                -> BAR_VERBOSE
425   'colors'                 -> BAR_COLORS_BRACE
426   '}'
427       -> call cfg_bar_finish(); INITIAL
428
429 # We ignore comments and 'set' lines (variables).
430 state BAR_IGNORE_LINE:
431   line
432       -> BAR
433
434 state BAR_BAR_COMMAND:
435   command = string
436       -> call cfg_bar_i3bar_command($command); BAR
437
438 state BAR_STATUS_COMMAND:
439   command = string
440       -> call cfg_bar_status_command($command); BAR
441
442 state BAR_SOCKET_PATH:
443   path = string
444       -> call cfg_bar_socket_path($path); BAR
445
446 state BAR_MODE:
447   mode = 'dock', 'hide', 'invisible'
448       -> call cfg_bar_mode($mode); BAR
449
450 state BAR_HIDDEN_STATE:
451   hidden_state = 'hide', 'show'
452       -> call cfg_bar_hidden_state($hidden_state); BAR
453
454 state BAR_ID:
455   bar_id = word
456       -> call cfg_bar_id($bar_id); BAR
457
458 state BAR_MODIFIER:
459   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift', 'none', 'off'
460       -> call cfg_bar_modifier($modifier); BAR
461
462 state BAR_WHEEL_UP_CMD:
463   command = string
464       -> call cfg_bar_wheel_up_cmd($command); BAR
465
466 state BAR_WHEEL_DOWN_CMD:
467   command = string
468       -> call cfg_bar_wheel_down_cmd($command); BAR
469
470 state BAR_BINDSYM:
471   button = word
472       -> BAR_BINDSYM_COMMAND
473
474 state BAR_BINDSYM_COMMAND:
475   command = string
476       -> call cfg_bar_bindsym($button, $command); BAR
477
478 state BAR_POSITION:
479   position = 'top', 'bottom'
480       -> call cfg_bar_position($position); BAR
481
482 state BAR_OUTPUT:
483   output = string
484       -> call cfg_bar_output($output); BAR
485
486 state BAR_TRAY_OUTPUT:
487   output = word
488       -> call cfg_bar_tray_output($output); BAR
489
490 state BAR_TRAY_PADDING:
491   padding_px = number
492       -> BAR_TRAY_PADDING_PX
493
494 state BAR_TRAY_PADDING_PX:
495   'px'
496       ->
497   end
498       -> call cfg_bar_tray_padding(&padding_px); BAR
499
500 state BAR_FONT:
501   font = string
502       -> call cfg_bar_font($font); BAR
503
504 state BAR_SEPARATOR_SYMBOL:
505   separator = string
506       -> call cfg_bar_separator_symbol($separator); BAR
507
508 state BAR_BINDING_MODE_INDICATOR:
509   value = word
510       -> call cfg_bar_binding_mode_indicator($value); BAR
511
512 state BAR_WORKSPACE_BUTTONS:
513   value = word
514       -> call cfg_bar_workspace_buttons($value); BAR
515
516 state BAR_STRIP_WORKSPACE_NUMBERS:
517   value = word
518       -> call cfg_bar_strip_workspace_numbers($value); BAR
519
520 state BAR_VERBOSE:
521   value = word
522       -> call cfg_bar_verbose($value); BAR
523
524 state BAR_COLORS_BRACE:
525   end
526       ->
527   '{'
528       -> BAR_COLORS
529
530 state BAR_COLORS:
531   end ->
532   '#' -> BAR_COLORS_IGNORE_LINE
533   'set' -> BAR_COLORS_IGNORE_LINE
534   colorclass = 'background', 'statusline', 'separator', 'focused_background', 'focused_statusline', 'focused_separator'
535       -> BAR_COLORS_SINGLE
536   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace', 'binding_mode'
537       -> BAR_COLORS_BORDER
538   '}'
539       -> BAR
540
541 # We ignore comments and 'set' lines (variables).
542 state BAR_COLORS_IGNORE_LINE:
543   line
544       -> BAR_COLORS
545
546 state BAR_COLORS_SINGLE:
547   color = word
548       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
549
550 state BAR_COLORS_BORDER:
551   border = word
552       -> BAR_COLORS_BACKGROUND
553
554 state BAR_COLORS_BACKGROUND:
555   background = word
556       -> BAR_COLORS_TEXT
557
558 state BAR_COLORS_TEXT:
559   end
560       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
561   text = word
562       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS