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