]> 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   ']' -> 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 # kill
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 # fullscreen
118 state FULLSCREEN:
119   fullscreen_mode = 'global'
120       -> call cmd_fullscreen($fullscreen_mode)
121   end
122       -> call cmd_fullscreen($fullscreen_mode)
123
124 # split v|h|vertical|horizontal
125 state SPLIT:
126   direction = 'v', 'h', 'vertical', 'horizontal'
127       -> call cmd_split($direction)
128
129 # floating enable|disable|toggle
130 state FLOATING:
131   floating = 'enable', 'disable', 'toggle'
132       -> call cmd_floating($floating)
133
134 # mark <mark>
135 state MARK:
136   mark = string
137       -> call cmd_mark($mark)
138
139 # resize
140 state RESIZE:
141   way = 'grow', 'shrink'
142       -> RESIZE_DIRECTION
143
144 state RESIZE_DIRECTION:
145   direction = 'up', 'down', 'left', 'right'
146       -> RESIZE_PX
147
148 state RESIZE_PX:
149   resize_px = word
150       -> RESIZE_TILING
151   end
152       -> call cmd_resize($way, $direction, "10", "10")
153
154 state RESIZE_TILING:
155   'px'
156       ->
157   'or'
158       -> RESIZE_TILING_OR
159   end
160       -> call cmd_resize($way, $direction, $resize_px, "10")
161
162 state RESIZE_TILING_OR:
163   'ppt'
164       ->
165   resize_ppt = word
166       ->
167   end
168       -> call cmd_resize($way, $direction, $resize_px, $resize_ppt)
169
170 # move <direction> [<pixels> [px]]
171 # move [window|container] [to] workspace <str>
172 # move [window|container] [to] output <str>
173 # move [window|container] [to] scratchpad
174 # move workspace to [output] <str>
175 # move scratchpad
176 state MOVE:
177   'window'
178       ->
179   'container'
180       ->
181   'to'
182       ->
183   'workspace'
184       -> MOVE_WORKSPACE
185   'output'
186       -> MOVE_TO_OUTPUT
187   'scratchpad'
188       -> call cmd_move_scratchpad()
189   direction = 'left', 'right', 'up', 'down'
190       -> MOVE_DIRECTION
191
192 state MOVE_DIRECTION:
193   pixels = word
194       -> MOVE_DIRECTION_PX
195   end
196       -> call cmd_move_direction($direction, "10")
197
198 state MOVE_DIRECTION_PX:
199   'px'
200       -> call cmd_move_direction($direction, $pixels)
201   end
202       -> call cmd_move_direction($direction, $pixels)
203
204 state MOVE_WORKSPACE:
205   'to'
206       -> MOVE_WORKSPACE_TO_OUTPUT
207   workspace = 'next', 'prev', 'next_on_output', 'prev_on_output'
208       -> call cmd_move_con_to_workspace($workspace)
209   workspace = string
210       -> call cmd_move_con_to_workspace_name($workspace)
211
212 state MOVE_TO_OUTPUT:
213   output = string
214       -> call cmd_move_con_to_output($output)
215
216 state MOVE_WORKSPACE_TO_OUTPUT:
217   'output'
218       ->
219   output = string
220       -> call cmd_move_workspace_to_output($output)
221
222 # mode <string>
223 state MODE:
224   mode = string
225       -> call cmd_mode($mode)
226
227 state NOP:
228   comment = string
229       -> call cmd_nop($comment)
230
231 state SCRATCHPAD:
232   'show'
233       -> call cmd_scratchpad_show()