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