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