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