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