]> git.sur5r.net Git - i3/i3/blob - parser-specs/commands.spec
add comments to src/commands.c
[i3/i3] / parser-specs / commands.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/commands.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 state INITIAL:
13   # We have an end token here for all the commands which just call some
14   # function without using an explicit 'end' token.
15   end ->
16   '[' -> call cmd_criteria_init(); CRITERIA
17   'move' -> MOVE
18   'exec' -> EXEC
19   'exit' -> call cmd_exit()
20   'restart' -> call cmd_restart()
21   'reload' -> call cmd_reload()
22   'border' -> BORDER
23   'layout' -> LAYOUT
24   'append_layout' -> APPEND_LAYOUT
25   'workspace' -> WORKSPACE
26   'focus' -> FOCUS
27   'kill' -> KILL
28   'open' -> call cmd_open()
29   'fullscreen' -> FULLSCREEN
30   'split' -> SPLIT
31   'floating' -> FLOATING
32   'mark' -> MARK
33   'resize' -> RESIZE
34   'nop' -> NOP
35   'scratchpad' -> SCRATCHPAD
36   'mode' -> MODE
37
38 state CRITERIA:
39   ctype = 'class' -> CRITERION
40   ctype = 'instance' -> CRITERION
41   ctype = 'window_role' -> CRITERION
42   ctype = 'con_id' -> CRITERION
43   ctype = 'id' -> CRITERION
44   ctype = 'con_mark' -> CRITERION
45   ctype = 'title' -> CRITERION
46   ']' -> call cmd_criteria_match_windows(); INITIAL
47
48 state CRITERION:
49   '=' -> CRITERION_STR
50
51 state CRITERION_STR:
52   cvalue = word
53       -> call cmd_criteria_add($ctype, $cvalue); CRITERIA
54
55 # exec [--no-startup-id] <command>
56 state EXEC:
57   nosn = '--no-startup-id'
58       ->
59   command = string
60       -> call cmd_exec($nosn, $command)
61
62 # border normal|none|1pixel|toggle
63 state BORDER:
64   border_style = 'normal', 'none', '1pixel', 'toggle'
65       -> call cmd_border($border_style)
66
67 # layout default|stacked|stacking|tabbed
68 state LAYOUT:
69   layout_mode = 'default', 'stacked', 'stacking', 'tabbed'
70       -> call cmd_layout($layout_mode)
71
72 # append_layout <path>
73 state APPEND_LAYOUT:
74   path = string -> call cmd_append_layout($path)
75
76 # workspace next|prev|next_on_output|prev_on_output
77 # workspace back_and_forth
78 # workspace <name>
79 state WORKSPACE:
80   direction = 'next_on_output', 'prev_on_output', 'next', 'prev'
81       -> call cmd_workspace($direction)
82   'back_and_forth'
83       -> call cmd_workspace_back_and_forth()
84   workspace = string 
85       -> call cmd_workspace_name($workspace)
86
87 # focus left|right|up|down
88 # focus output <output>
89 # focus tiling|floating|mode_toggle
90 # focus parent|child
91 # focus
92 state FOCUS:
93   direction = 'left', 'right', 'up', 'down'
94       -> call cmd_focus_direction($direction)
95   'output'
96       -> FOCUS_OUTPUT
97   window_mode = 'tiling', 'floating', 'mode_toggle'
98       -> call cmd_focus_window_mode($window_mode)
99   level = 'parent', 'child'
100       -> call cmd_focus_level($level)
101   end
102       -> call cmd_focus()
103
104 state FOCUS_OUTPUT:
105   output = string
106       -> call cmd_focus_output($output)
107
108 # kill [window|client]
109 state KILL:
110   kill_mode = 'window', 'client'
111       -> call cmd_kill($kill_mode)
112   end
113       -> call cmd_kill($kill_mode)
114
115 # fullscreen [global]
116 state FULLSCREEN:
117   fullscreen_mode = 'global'
118       -> call cmd_fullscreen($fullscreen_mode)
119   end
120       -> call cmd_fullscreen($fullscreen_mode)
121
122 # split v|h|vertical|horizontal
123 state SPLIT:
124   direction = 'v', 'h', 'vertical', 'horizontal'
125       -> call cmd_split($direction)
126
127 # floating enable|disable|toggle
128 state FLOATING:
129   floating = 'enable', 'disable', 'toggle'
130       -> call cmd_floating($floating)
131
132 # mark <mark>
133 state MARK:
134   mark = string
135       -> call cmd_mark($mark)
136
137 # resize
138 state RESIZE:
139   way = 'grow', 'shrink'
140       -> RESIZE_DIRECTION
141
142 state RESIZE_DIRECTION:
143   direction = 'up', 'down', 'left', 'right'
144       -> RESIZE_PX
145
146 state RESIZE_PX:
147   resize_px = word
148       -> RESIZE_TILING
149   end
150       -> call cmd_resize($way, $direction, "10", "10")
151
152 state RESIZE_TILING:
153   'px'
154       ->
155   'or'
156       -> RESIZE_TILING_OR
157   end
158       -> call cmd_resize($way, $direction, $resize_px, "10")
159
160 state RESIZE_TILING_OR:
161   'ppt'
162       ->
163   resize_ppt = word
164       ->
165   end
166       -> call cmd_resize($way, $direction, $resize_px, $resize_ppt)
167
168 # move <direction> [<pixels> [px]]
169 # move [window|container] [to] workspace <str>
170 # move [window|container] [to] output <str>
171 # move [window|container] [to] scratchpad
172 # move workspace to [output] <str>
173 # move scratchpad
174 state MOVE:
175   'window'
176       ->
177   'container'
178       ->
179   'to'
180       ->
181   'workspace'
182       -> MOVE_WORKSPACE
183   'output'
184       -> MOVE_TO_OUTPUT
185   'scratchpad'
186       -> call cmd_move_scratchpad()
187   direction = 'left', 'right', 'up', 'down'
188       -> MOVE_DIRECTION
189
190 state MOVE_DIRECTION:
191   pixels = word
192       -> MOVE_DIRECTION_PX
193   end
194       -> call cmd_move_direction($direction, "10")
195
196 state MOVE_DIRECTION_PX:
197   'px'
198       -> call cmd_move_direction($direction, $pixels)
199   end
200       -> call cmd_move_direction($direction, $pixels)
201
202 state MOVE_WORKSPACE:
203   'to'
204       -> MOVE_WORKSPACE_TO_OUTPUT
205   workspace = 'next', 'prev', 'next_on_output', 'prev_on_output'
206       -> call cmd_move_con_to_workspace($workspace)
207   workspace = string
208       -> call cmd_move_con_to_workspace_name($workspace)
209
210 state MOVE_TO_OUTPUT:
211   output = string
212       -> call cmd_move_con_to_output($output)
213
214 state MOVE_WORKSPACE_TO_OUTPUT:
215   'output'
216       ->
217   output = string
218       -> call cmd_move_workspace_to_output($output)
219
220 # mode <string>
221 state MODE:
222   mode = string
223       -> call cmd_mode($mode)
224
225 state NOP:
226   comment = string
227       -> call cmd_nop($comment)
228
229 state SCRATCHPAD:
230   'show'
231       -> call cmd_scratchpad_show()