]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
Merge branch 'master' into 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   '#'                                      -> 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', 'Ctrl'
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', 'Ctrl', '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   end
295       ->
296   '{'
297       -> MODE
298
299 state MODE:
300   end ->
301   '#' -> MODE_IGNORE_LINE
302   'set' -> MODE_IGNORE_LINE
303   bindtype = 'bindsym', 'bindcode', 'bind'
304       -> MODE_BINDING
305   '}'
306       -> INITIAL
307
308 # We ignore comments and 'set' lines (variables).
309 state MODE_IGNORE_LINE:
310   end, string
311       -> MODE
312
313 state MODE_BINDING:
314   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch'
315       ->
316   '+'
317       ->
318   key = word
319       -> MODE_BINDCOMMAND
320
321 state MODE_BINDCOMMAND:
322   release = '--release'
323       ->
324   command = string
325       -> call cfg_mode_binding($bindtype, $modifiers, $key, $release, $command); MODE
326
327 ################################################################################
328 # Bar configuration (i3bar)
329 ################################################################################
330
331 state BARBRACE:
332   end
333       ->
334   '{'
335       -> BAR
336
337 state BAR:
338   end ->
339   '#' -> BAR_IGNORE_LINE
340   'set' -> BAR_IGNORE_LINE
341   'i3bar_command'     -> BAR_BAR_COMMAND
342   'status_command'    -> BAR_STATUS_COMMAND
343   'socket_path'       -> BAR_SOCKET_PATH
344   'mode'              -> BAR_MODE
345   'modifier'          -> BAR_MODIFIER
346   'position'          -> BAR_POSITION
347   'output'            -> BAR_OUTPUT
348   'tray_output'       -> BAR_TRAY_OUTPUT
349   'font'              -> BAR_FONT
350   'workspace_buttons' -> BAR_WORKSPACE_BUTTONS
351   'verbose'           -> BAR_VERBOSE
352   'colors'            -> BAR_COLORS_BRACE
353   '}'
354       -> call cfg_bar_finish(); INITIAL
355
356 # We ignore comments and 'set' lines (variables).
357 state BAR_IGNORE_LINE:
358   end, string
359       -> BAR
360
361 state BAR_BAR_COMMAND:
362   command = string
363       -> call cfg_bar_i3bar_command($command); BAR
364
365 state BAR_STATUS_COMMAND:
366   command = string
367       -> call cfg_bar_status_command($command); BAR
368
369 state BAR_SOCKET_PATH:
370   path = string
371       -> call cfg_bar_socket_path($path); BAR
372
373 state BAR_MODE:
374   mode = 'dock', 'hide'
375       -> call cfg_bar_mode($mode); BAR
376
377 state BAR_MODIFIER:
378   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift'
379       -> call cfg_bar_modifier($modifier); BAR
380
381 state BAR_POSITION:
382   position = 'top', 'bottom'
383       -> call cfg_bar_position($position); BAR
384
385 state BAR_OUTPUT:
386   output = string
387       -> call cfg_bar_output($output); BAR
388
389 state BAR_TRAY_OUTPUT:
390   output = string
391       -> call cfg_bar_tray_output($output); BAR
392
393 state BAR_FONT:
394   font = string
395       -> call cfg_bar_font($font); BAR
396
397 state BAR_WORKSPACE_BUTTONS:
398   value = word
399       -> call cfg_bar_workspace_buttons($value); BAR
400
401 state BAR_VERBOSE:
402   value = word
403       -> call cfg_bar_verbose($value); BAR
404
405 state BAR_COLORS_BRACE:
406   end
407       ->
408   '{'
409       -> BAR_COLORS
410
411 state BAR_COLORS:
412   end ->
413   '#' -> BAR_COLORS_IGNORE_LINE
414   'set' -> BAR_COLORS_IGNORE_LINE
415   colorclass = 'background', 'statusline'
416       -> BAR_COLORS_SINGLE
417   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace'
418       -> BAR_COLORS_BORDER
419   '}'
420       -> BAR
421
422 # We ignore comments and 'set' lines (variables).
423 state BAR_COLORS_IGNORE_LINE:
424   end, string
425       -> BAR_COLORS
426
427 state BAR_COLORS_SINGLE:
428   color = word
429       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
430
431 state BAR_COLORS_BORDER:
432   border = word
433       -> BAR_COLORS_BACKGROUND
434
435 state BAR_COLORS_BACKGROUND:
436   background = word
437       -> BAR_COLORS_TEXT
438
439 state BAR_COLORS_TEXT:
440   end
441       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
442   text = word
443       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS