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