]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
Implement new criterion 'workspace'.
[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   'delay_exit_on_zero_displays'            -> DELAY_EXIT_ON_ZERO_DISPLAYS
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 = string
151       -> call cfg_assign($workspace)
152
153 # no_focus <criteria>
154 state NO_FOCUS:
155   '['
156       -> call cfg_criteria_init(NO_FOCUS_END); CRITERIA
157
158 state NO_FOCUS_END:
159   end
160       -> call cfg_no_focus()
161
162 # Criteria: Used by for_window and assign.
163 state CRITERIA:
164   ctype = 'class'       -> CRITERION
165   ctype = 'instance'    -> CRITERION
166   ctype = 'window_role' -> CRITERION
167   ctype = 'con_id'      -> CRITERION
168   ctype = 'id'          -> CRITERION
169   ctype = 'window_type' -> CRITERION
170   ctype = 'con_mark'    -> CRITERION
171   ctype = 'title'       -> CRITERION
172   ctype = 'urgent'      -> CRITERION
173   ctype = 'workspace'   -> 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 # delay_exit_on_zero_displays <delay> ms
232 state DELAY_EXIT_ON_ZERO_DISPLAYS:
233   duration_ms = number
234       -> DELAY_EXIT_ON_ZERO_DISPLAYS_MS
235
236 state DELAY_EXIT_ON_ZERO_DISPLAYS_MS:
237   'ms'
238       ->
239   end
240       -> call cfg_delay_exit_on_zero_displays(&duration_ms)
241
242 # focus_on_window_activation <smart|urgent|focus|none>
243 state FOCUS_ON_WINDOW_ACTIVATION:
244   mode = word
245       -> call cfg_focus_on_window_activation($mode)
246
247 # workspace <workspace> output <output>
248 state WORKSPACE:
249   workspace = word
250     -> WORKSPACE_OUTPUT
251
252 state WORKSPACE_OUTPUT:
253   'output'
254       -> WORKSPACE_OUTPUT_STR
255
256 state WORKSPACE_OUTPUT_STR:
257   output = word
258       -> call cfg_workspace($workspace, $output)
259
260 # ipc-socket <path>
261 state IPC_SOCKET:
262   path = string
263       -> call cfg_ipc_socket($path)
264
265 # restart_state <path> (for testcases)
266 state RESTART_STATE:
267   path = string
268       -> call cfg_restart_state($path)
269
270 # popup_during_fullscreen
271 state POPUP_DURING_FULLSCREEN:
272   value = 'ignore', 'leave_fullscreen', 'smart'
273       -> call cfg_popup_during_fullscreen($value)
274
275 # client.background <hexcolor>
276 state COLOR_SINGLE:
277   color = word
278       -> call cfg_color_single($colorclass, $color)
279
280 # colorclass border background text indicator
281 state COLOR_BORDER:
282   border = word
283       -> COLOR_BACKGROUND
284
285 state COLOR_BACKGROUND:
286   background = word
287       -> COLOR_TEXT
288
289 state COLOR_TEXT:
290   text = word
291       -> COLOR_INDICATOR
292
293 state COLOR_INDICATOR:
294   indicator = word
295       -> call cfg_color($colorclass, $border, $background, $text, $indicator)
296   end
297       -> call cfg_color($colorclass, $border, $background, $text, NULL)
298
299 # <exec|exec_always> [--no-startup-id] command
300 state EXEC:
301   no_startup_id = '--no-startup-id'
302       ->
303   command = string
304       -> call cfg_exec($exectype, $no_startup_id, $command)
305
306 # font font
307 state FONT:
308   font = string
309       -> call cfg_font($font)
310
311 # bindsym/bindcode
312 state BINDING:
313   release = '--release'
314       ->
315   border = '--border'
316       ->
317   whole_window = '--whole-window'
318       ->
319   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', '$mod'
320       ->
321   '+'
322       ->
323   key = word
324       -> BINDCOMMAND
325
326 state BINDCOMMAND:
327   release = '--release'
328       ->
329   border = '--border'
330       ->
331   whole_window = '--whole-window'
332       ->
333   command = string
334       -> call cfg_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $command)
335
336 ################################################################################
337 # Mode configuration
338 ################################################################################
339
340 state MODENAME:
341   modename = word
342       -> call cfg_enter_mode($modename); MODEBRACE
343
344 state MODEBRACE:
345   end
346       ->
347   '{'
348       -> MODE
349
350 state MODE:
351   end ->
352   error ->
353   '#' -> MODE_IGNORE_LINE
354   'set' -> MODE_IGNORE_LINE
355   bindtype = 'bindsym', 'bindcode', 'bind'
356       -> MODE_BINDING
357   '}'
358       -> INITIAL
359
360 # We ignore comments and 'set' lines (variables).
361 state MODE_IGNORE_LINE:
362   line
363       -> MODE
364
365 state MODE_BINDING:
366   release = '--release'
367       ->
368   border = '--border'
369       ->
370   whole_window = '--whole-window'
371       ->
372   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', '$mod'
373       ->
374   '+'
375       ->
376   key = word
377       -> MODE_BINDCOMMAND
378
379 state MODE_BINDCOMMAND:
380   release = '--release'
381       ->
382   border = '--border'
383       ->
384   whole_window = '--whole-window'
385       ->
386   command = string
387       -> call cfg_mode_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $command); MODE
388
389 ################################################################################
390 # Bar configuration (i3bar)
391 ################################################################################
392
393 state BARBRACE:
394   end
395       ->
396   '{'
397       -> call cfg_bar_start(); BAR
398
399 state BAR:
400   end ->
401   error ->
402   '#' -> BAR_IGNORE_LINE
403   'set' -> BAR_IGNORE_LINE
404   'i3bar_command'          -> BAR_BAR_COMMAND
405   'status_command'         -> BAR_STATUS_COMMAND
406   'socket_path'            -> BAR_SOCKET_PATH
407   'mode'                   -> BAR_MODE
408   'hidden_state'           -> BAR_HIDDEN_STATE
409   'id'                     -> BAR_ID
410   'modifier'               -> BAR_MODIFIER
411   'wheel_up_cmd'           -> BAR_WHEEL_UP_CMD
412   'wheel_down_cmd'         -> BAR_WHEEL_DOWN_CMD
413   'bindsym'                -> BAR_BINDSYM
414   'position'               -> BAR_POSITION
415   'output'                 -> BAR_OUTPUT
416   'tray_output'            -> BAR_TRAY_OUTPUT
417   'tray_padding'           -> BAR_TRAY_PADDING
418   'font'                   -> BAR_FONT
419   'separator_symbol'       -> BAR_SEPARATOR_SYMBOL
420   'binding_mode_indicator' -> BAR_BINDING_MODE_INDICATOR
421   'workspace_buttons'      -> BAR_WORKSPACE_BUTTONS
422   'strip_workspace_numbers' -> BAR_STRIP_WORKSPACE_NUMBERS
423   'verbose'                -> BAR_VERBOSE
424   'colors'                 -> BAR_COLORS_BRACE
425   '}'
426       -> call cfg_bar_finish(); INITIAL
427
428 # We ignore comments and 'set' lines (variables).
429 state BAR_IGNORE_LINE:
430   line
431       -> BAR
432
433 state BAR_BAR_COMMAND:
434   command = string
435       -> call cfg_bar_i3bar_command($command); BAR
436
437 state BAR_STATUS_COMMAND:
438   command = string
439       -> call cfg_bar_status_command($command); BAR
440
441 state BAR_SOCKET_PATH:
442   path = string
443       -> call cfg_bar_socket_path($path); BAR
444
445 state BAR_MODE:
446   mode = 'dock', 'hide', 'invisible'
447       -> call cfg_bar_mode($mode); BAR
448
449 state BAR_HIDDEN_STATE:
450   hidden_state = 'hide', 'show'
451       -> call cfg_bar_hidden_state($hidden_state); BAR
452
453 state BAR_ID:
454   bar_id = word
455       -> call cfg_bar_id($bar_id); BAR
456
457 state BAR_MODIFIER:
458   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift'
459       -> call cfg_bar_modifier($modifier); BAR
460
461 state BAR_WHEEL_UP_CMD:
462   command = string
463       -> call cfg_bar_wheel_up_cmd($command); BAR
464
465 state BAR_WHEEL_DOWN_CMD:
466   command = string
467       -> call cfg_bar_wheel_down_cmd($command); BAR
468
469 state BAR_BINDSYM:
470   button = word
471       -> BAR_BINDSYM_COMMAND
472
473 state BAR_BINDSYM_COMMAND:
474   command = string
475       -> call cfg_bar_bindsym($button, $command); BAR
476
477 state BAR_POSITION:
478   position = 'top', 'bottom'
479       -> call cfg_bar_position($position); BAR
480
481 state BAR_OUTPUT:
482   output = string
483       -> call cfg_bar_output($output); BAR
484
485 state BAR_TRAY_OUTPUT:
486   output = word
487       -> call cfg_bar_tray_output($output); BAR
488
489 state BAR_TRAY_PADDING:
490   padding_px = number
491       -> BAR_TRAY_PADDING_PX
492
493 state BAR_TRAY_PADDING_PX:
494   'px'
495       ->
496   end
497       -> call cfg_bar_tray_padding(&padding_px); BAR
498
499 state BAR_FONT:
500   font = string
501       -> call cfg_bar_font($font); BAR
502
503 state BAR_SEPARATOR_SYMBOL:
504   separator = string
505       -> call cfg_bar_separator_symbol($separator); BAR
506
507 state BAR_BINDING_MODE_INDICATOR:
508   value = word
509       -> call cfg_bar_binding_mode_indicator($value); BAR
510
511 state BAR_WORKSPACE_BUTTONS:
512   value = word
513       -> call cfg_bar_workspace_buttons($value); BAR
514
515 state BAR_STRIP_WORKSPACE_NUMBERS:
516   value = word
517       -> call cfg_bar_strip_workspace_numbers($value); BAR
518
519 state BAR_VERBOSE:
520   value = word
521       -> call cfg_bar_verbose($value); BAR
522
523 state BAR_COLORS_BRACE:
524   end
525       ->
526   '{'
527       -> BAR_COLORS
528
529 state BAR_COLORS:
530   end ->
531   '#' -> BAR_COLORS_IGNORE_LINE
532   'set' -> BAR_COLORS_IGNORE_LINE
533   colorclass = 'background', 'statusline', 'separator'
534       -> BAR_COLORS_SINGLE
535   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace', 'binding_mode'
536       -> BAR_COLORS_BORDER
537   '}'
538       -> BAR
539
540 # We ignore comments and 'set' lines (variables).
541 state BAR_COLORS_IGNORE_LINE:
542   line
543       -> BAR_COLORS
544
545 state BAR_COLORS_SINGLE:
546   color = word
547       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
548
549 state BAR_COLORS_BORDER:
550   border = word
551       -> BAR_COLORS_BACKGROUND
552
553 state BAR_COLORS_BACKGROUND:
554   background = word
555       -> BAR_COLORS_TEXT
556
557 state BAR_COLORS_TEXT:
558   end
559       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
560   text = word
561       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS