]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
Merge branch 'next'
[i3/i3] / parser-specs / config.spec
1 # vim:ts=2:sw=2:expandtab
2 #
3 # i3 - an improved dynamic tiling window manager
4 # © 2009-2012 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   'focus_follows_mouse'                    -> FOCUS_FOLLOWS_MOUSE
35   'force_focus_wrapping'                   -> FORCE_FOCUS_WRAPPING
36   'force_xinerama', 'force-xinerama'       -> FORCE_XINERAMA
37   'workspace_auto_back_and_forth'          -> WORKSPACE_BACK_AND_FORTH
38   'fake_outputs', 'fake-outputs'           -> FAKE_OUTPUTS
39   'force_display_urgency_hint'             -> FORCE_DISPLAY_URGENCY_HINT
40   'workspace'                              -> WORKSPACE
41   'ipc_socket', 'ipc-socket'               -> IPC_SOCKET
42   'restart_state'                          -> RESTART_STATE
43   'popup_during_fullscreen'                -> POPUP_DURING_FULLSCREEN
44   exectype = 'exec_always', 'exec'         -> EXEC
45   colorclass = 'client.background'
46       -> COLOR_SINGLE
47   colorclass = 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
48       -> COLOR_BORDER
49
50 # We ignore comments and 'set' lines (variables).
51 state IGNORE_LINE:
52   line
53       -> INITIAL
54
55 # floating_minimum_size <width> x <height>
56 state FLOATING_MINIMUM_SIZE_WIDTH:
57   width = number
58       -> FLOATING_MINIMUM_SIZE_X
59
60 state FLOATING_MINIMUM_SIZE_X:
61   'x'
62       -> FLOATING_MINIMUM_SIZE_HEIGHT
63
64 state FLOATING_MINIMUM_SIZE_HEIGHT:
65   height = number
66       -> call cfg_floating_minimum_size(&width, &height)
67
68 # floating_maximum_size <width> x <height>
69 state FLOATING_MAXIMUM_SIZE_WIDTH:
70   width = number
71       -> FLOATING_MAXIMUM_SIZE_X
72
73 state FLOATING_MAXIMUM_SIZE_X:
74   'x'
75       -> FLOATING_MAXIMUM_SIZE_HEIGHT
76
77 state FLOATING_MAXIMUM_SIZE_HEIGHT:
78   height = number
79       -> call cfg_floating_maximum_size(&width, &height)
80
81 # floating_modifier <modifier>
82 state FLOATING_MODIFIER:
83   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl'
84       ->
85   '+'
86       ->
87   end
88       -> call cfg_floating_modifier($modifiers)
89
90 # default_orientation <horizontal|vertical|auto>
91 state DEFAULT_ORIENTATION:
92   orientation = 'horizontal', 'vertical', 'auto'
93       -> call cfg_default_orientation($orientation)
94
95 # workspace_layout <default|stacking|tabbed>
96 state WORKSPACE_LAYOUT:
97   layout = 'default', 'stacking', 'stacked', 'tabbed'
98       -> call cfg_workspace_layout($layout)
99
100 # new_window <normal|1pixel|none>
101 # new_float <normal|1pixel|none>
102 # TODO: new_float is not in the userguide yet
103 # TODO: pixel is not in the userguide yet
104 state NEW_WINDOW:
105   border = 'normal', 'pixel'
106       -> NEW_WINDOW_PIXELS
107   border = '1pixel', 'none'
108       -> call cfg_new_window($windowtype, $border, -1)
109
110 state NEW_WINDOW_PIXELS:
111   end
112       -> call cfg_new_window($windowtype, $border, 2)
113   width = number
114       -> NEW_WINDOW_PIXELS_PX
115
116 state NEW_WINDOW_PIXELS_PX:
117   'px'
118       ->
119   end
120       -> call cfg_new_window($windowtype, $border, &width)
121
122 # hide_edge_borders <none|vertical|horizontal|both>
123 # also hide_edge_borders <bool> for compatibility
124 state HIDE_EDGE_BORDERS:
125   hide_borders = 'none', 'vertical', 'horizontal', 'both'
126       -> call cfg_hide_edge_borders($hide_borders)
127   hide_borders = '1', 'yes', 'true', 'on', 'enable', 'active'
128       -> call cfg_hide_edge_borders($hide_borders)
129
130 # for_window <criteria> command
131 state FOR_WINDOW:
132   '['
133       -> call cfg_criteria_init(FOR_WINDOW_COMMAND); CRITERIA
134
135 state FOR_WINDOW_COMMAND:
136   command = string
137       -> call cfg_for_window($command)
138
139 # assign <criteria> [→] workspace
140 state ASSIGN:
141   '['
142       -> call cfg_criteria_init(ASSIGN_WORKSPACE); CRITERIA
143
144 state ASSIGN_WORKSPACE:
145   '→'
146       ->
147   workspace = string
148       -> call cfg_assign($workspace)
149
150 # Criteria: Used by for_window and assign.
151 state CRITERIA:
152   ctype = 'class'       -> CRITERION
153   ctype = 'instance'    -> CRITERION
154   ctype = 'window_role' -> CRITERION
155   ctype = 'con_id'      -> CRITERION
156   ctype = 'id'          -> CRITERION
157   ctype = 'con_mark'    -> CRITERION
158   ctype = 'title'       -> CRITERION
159   ctype = 'urgent'      -> CRITERION
160   ']'
161       -> call cfg_criteria_pop_state()
162
163 state CRITERION:
164   '=' -> CRITERION_STR
165
166 state CRITERION_STR:
167   cvalue = word
168       -> call cfg_criteria_add($ctype, $cvalue); CRITERIA
169
170 # focus_follows_mouse bool
171 state FOCUS_FOLLOWS_MOUSE:
172   value = word
173       -> call cfg_focus_follows_mouse($value)
174
175 # force_focus_wrapping
176 state FORCE_FOCUS_WRAPPING:
177   value = word
178       -> call cfg_force_focus_wrapping($value)
179
180 # force_xinerama
181 state FORCE_XINERAMA:
182   value = word
183       -> call cfg_force_xinerama($value)
184
185 # workspace_back_and_forth
186 state WORKSPACE_BACK_AND_FORTH:
187   value = word
188       -> call cfg_workspace_back_and_forth($value)
189
190
191 # fake_outputs (for testcases)
192 state FAKE_OUTPUTS:
193   outputs = string
194       -> call cfg_fake_outputs($outputs)
195
196 # force_display_urgency_hint <timeout> ms
197 state FORCE_DISPLAY_URGENCY_HINT:
198   duration_ms = number
199       -> FORCE_DISPLAY_URGENCY_HINT_MS
200
201 state FORCE_DISPLAY_URGENCY_HINT_MS:
202   'ms'
203       ->
204   end
205       -> call cfg_force_display_urgency_hint(&duration_ms)
206
207 # workspace <workspace> output <output>
208 state WORKSPACE:
209   workspace = word
210     -> WORKSPACE_OUTPUT
211
212 state WORKSPACE_OUTPUT:
213   'output'
214       -> WORKSPACE_OUTPUT_STR
215
216 state WORKSPACE_OUTPUT_STR:
217   output = word
218       -> call cfg_workspace($workspace, $output)
219
220 # ipc-socket <path>
221 state IPC_SOCKET:
222   path = string
223       -> call cfg_ipc_socket($path)
224
225 # restart_state <path> (for testcases)
226 state RESTART_STATE:
227   path = string
228       -> call cfg_restart_state($path)
229
230 # popup_during_fullscreen
231 state POPUP_DURING_FULLSCREEN:
232   value = 'ignore', 'leave_fullscreen', 'smart'
233       -> call cfg_popup_during_fullscreen($value)
234
235 # client.background <hexcolor>
236 state COLOR_SINGLE:
237   color = word
238       -> call cfg_color_single($colorclass, $color)
239
240 # colorclass border background text indicator
241 state COLOR_BORDER:
242   border = word
243       -> COLOR_BACKGROUND
244
245 state COLOR_BACKGROUND:
246   background = word
247       -> COLOR_TEXT
248
249 state COLOR_TEXT:
250   text = word
251       -> COLOR_INDICATOR
252
253 state COLOR_INDICATOR:
254   indicator = word
255       -> call cfg_color($colorclass, $border, $background, $text, $indicator)
256   end
257       -> call cfg_color($colorclass, $border, $background, $text, NULL)
258
259 # <exec|exec_always> [--no-startup-id] command
260 state EXEC:
261   no_startup_id = '--no-startup-id'
262       ->
263   command = string
264       -> call cfg_exec($exectype, $no_startup_id, $command)
265
266 # font font
267 state FONT:
268   font = string
269       -> call cfg_font($font)
270
271 # bindsym/bindcode
272 state BINDING:
273   release = '--release'
274       ->
275   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', '$mod'
276       ->
277   '+'
278       ->
279   key = word
280       -> BINDCOMMAND
281
282 state BINDCOMMAND:
283   release = '--release'
284       ->
285   command = string
286       -> call cfg_binding($bindtype, $modifiers, $key, $release, $command)
287
288 ################################################################################
289 # Mode configuration
290 ################################################################################
291
292 state MODENAME:
293   modename = word
294       -> call cfg_enter_mode($modename); MODEBRACE
295
296 state MODEBRACE:
297   end
298       ->
299   '{'
300       -> MODE
301
302 state MODE:
303   end ->
304   error ->
305   '#' -> MODE_IGNORE_LINE
306   'set' -> MODE_IGNORE_LINE
307   bindtype = 'bindsym', 'bindcode', 'bind'
308       -> MODE_BINDING
309   '}'
310       -> INITIAL
311
312 # We ignore comments and 'set' lines (variables).
313 state MODE_IGNORE_LINE:
314   line
315       -> MODE
316
317 state MODE_BINDING:
318   release = '--release'
319       ->
320   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', '$mod'
321       ->
322   '+'
323       ->
324   key = word
325       -> MODE_BINDCOMMAND
326
327 state MODE_BINDCOMMAND:
328   release = '--release'
329       ->
330   command = string
331       -> call cfg_mode_binding($bindtype, $modifiers, $key, $release, $command); MODE
332
333 ################################################################################
334 # Bar configuration (i3bar)
335 ################################################################################
336
337 state BARBRACE:
338   end
339       ->
340   '{'
341       -> BAR
342
343 state BAR:
344   end ->
345   error ->
346   '#' -> BAR_IGNORE_LINE
347   'set' -> BAR_IGNORE_LINE
348   'i3bar_command'     -> BAR_BAR_COMMAND
349   'status_command'    -> BAR_STATUS_COMMAND
350   'socket_path'       -> BAR_SOCKET_PATH
351   'mode'              -> BAR_MODE
352   'hidden_state'      -> BAR_HIDDEN_STATE
353   'id'                -> BAR_ID
354   'modifier'          -> BAR_MODIFIER
355   'position'          -> BAR_POSITION
356   'output'            -> BAR_OUTPUT
357   'tray_output'       -> BAR_TRAY_OUTPUT
358   'font'              -> BAR_FONT
359   'workspace_buttons' -> BAR_WORKSPACE_BUTTONS
360   'verbose'           -> BAR_VERBOSE
361   'colors'            -> BAR_COLORS_BRACE
362   '}'
363       -> call cfg_bar_finish(); INITIAL
364
365 # We ignore comments and 'set' lines (variables).
366 state BAR_IGNORE_LINE:
367   line
368       -> BAR
369
370 state BAR_BAR_COMMAND:
371   command = string
372       -> call cfg_bar_i3bar_command($command); BAR
373
374 state BAR_STATUS_COMMAND:
375   command = string
376       -> call cfg_bar_status_command($command); BAR
377
378 state BAR_SOCKET_PATH:
379   path = string
380       -> call cfg_bar_socket_path($path); BAR
381
382 state BAR_MODE:
383   mode = 'dock', 'hide', 'invisible'
384       -> call cfg_bar_mode($mode); BAR
385
386 state BAR_HIDDEN_STATE:
387   hidden_state = 'hide', 'show'
388       -> call cfg_bar_hidden_state($hidden_state); BAR
389
390 state BAR_ID:
391   bar_id = word
392       -> call cfg_bar_id($bar_id); BAR
393
394 state BAR_MODIFIER:
395   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift'
396       -> call cfg_bar_modifier($modifier); BAR
397
398 state BAR_POSITION:
399   position = 'top', 'bottom'
400       -> call cfg_bar_position($position); BAR
401
402 state BAR_OUTPUT:
403   output = string
404       -> call cfg_bar_output($output); BAR
405
406 state BAR_TRAY_OUTPUT:
407   output = string
408       -> call cfg_bar_tray_output($output); BAR
409
410 state BAR_FONT:
411   font = string
412       -> call cfg_bar_font($font); BAR
413
414 state BAR_WORKSPACE_BUTTONS:
415   value = word
416       -> call cfg_bar_workspace_buttons($value); BAR
417
418 state BAR_VERBOSE:
419   value = word
420       -> call cfg_bar_verbose($value); BAR
421
422 state BAR_COLORS_BRACE:
423   end
424       ->
425   '{'
426       -> BAR_COLORS
427
428 state BAR_COLORS:
429   end ->
430   '#' -> BAR_COLORS_IGNORE_LINE
431   'set' -> BAR_COLORS_IGNORE_LINE
432   colorclass = 'background', 'statusline', 'separator'
433       -> BAR_COLORS_SINGLE
434   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace'
435       -> BAR_COLORS_BORDER
436   '}'
437       -> BAR
438
439 # We ignore comments and 'set' lines (variables).
440 state BAR_COLORS_IGNORE_LINE:
441   line
442       -> BAR_COLORS
443
444 state BAR_COLORS_SINGLE:
445   color = word
446       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
447
448 state BAR_COLORS_BORDER:
449   border = word
450       -> BAR_COLORS_BACKGROUND
451
452 state BAR_COLORS_BACKGROUND:
453   background = word
454       -> BAR_COLORS_TEXT
455
456 state BAR_COLORS_TEXT:
457   end
458       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
459   text = word
460       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS