]> git.sur5r.net Git - i3/i3/blob - parser-specs/commands.spec
Implement debuglog command
[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   'shmlog' -> SHMLOG
23   'debuglog' -> DEBUGLOG
24   'border' -> BORDER
25   'layout' -> LAYOUT
26   'append_layout' -> APPEND_LAYOUT
27   'workspace' -> WORKSPACE
28   'focus' -> FOCUS
29   'kill' -> KILL
30   'open' -> call cmd_open()
31   'fullscreen' -> FULLSCREEN
32   'split' -> SPLIT
33   'floating' -> FLOATING
34   'mark' -> MARK
35   'resize' -> RESIZE
36   'rename' -> RENAME
37   'nop' -> NOP
38   'scratchpad' -> SCRATCHPAD
39   'mode' -> MODE
40   'bar' -> BAR
41
42 state CRITERIA:
43   ctype = 'class' -> CRITERION
44   ctype = 'instance' -> CRITERION
45   ctype = 'window_role' -> CRITERION
46   ctype = 'con_id' -> CRITERION
47   ctype = 'id' -> CRITERION
48   ctype = 'con_mark' -> CRITERION
49   ctype = 'title' -> CRITERION
50   ctype = 'urgent' -> CRITERION
51   ']' -> call cmd_criteria_match_windows(); INITIAL
52
53 state CRITERION:
54   '=' -> CRITERION_STR
55
56 state CRITERION_STR:
57   cvalue = word
58       -> call cmd_criteria_add($ctype, $cvalue); CRITERIA
59
60 # exec [--no-startup-id] <command>
61 state EXEC:
62   nosn = '--no-startup-id'
63       ->
64   command = string
65       -> call cmd_exec($nosn, $command)
66
67 # shmlog <size>|toggle|on|off
68 state SHMLOG:
69   # argument may be a number
70   argument = string
71     -> call cmd_shmlog($argument)
72
73 # debuglog toggle|on|off
74 state DEBUGLOG:
75   argument = 'toggle', 'on', 'off'
76     -> call cmd_debuglog($argument)
77
78 # border normal|none|1pixel|toggle|1pixel
79 state BORDER:
80   border_style = 'normal', 'pixel'
81     -> BORDER_WIDTH
82   border_style = 'none', 'toggle'
83     -> call cmd_border($border_style, "0")
84   border_style = '1pixel'
85     -> call cmd_border($border_style, "1")
86
87 state BORDER_WIDTH:
88   end
89     -> call cmd_border($border_style, "2")
90   border_width = word
91     -> call cmd_border($border_style, $border_width)
92
93 # layout default|stacked|stacking|tabbed|splitv|splith
94 # layout toggle [split|all]
95 state LAYOUT:
96   layout_mode = 'default', 'stacked', 'stacking', 'tabbed', 'splitv', 'splith'
97       -> call cmd_layout($layout_mode)
98   'toggle'
99       -> LAYOUT_TOGGLE
100
101 # layout toggle [split|all]
102 state LAYOUT_TOGGLE:
103   end
104       -> call cmd_layout_toggle($toggle_mode)
105   toggle_mode = 'split', 'all'
106       -> call cmd_layout_toggle($toggle_mode)
107
108 # append_layout <path>
109 state APPEND_LAYOUT:
110   path = string -> call cmd_append_layout($path)
111
112 # workspace next|prev|next_on_output|prev_on_output
113 # workspace back_and_forth
114 # workspace <name>
115 # workspace number <number>
116 state WORKSPACE:
117   direction = 'next_on_output', 'prev_on_output', 'next', 'prev'
118       -> call cmd_workspace($direction)
119   'back_and_forth'
120       -> call cmd_workspace_back_and_forth()
121   'number'
122       -> WORKSPACE_NUMBER
123   workspace = string 
124       -> call cmd_workspace_name($workspace)
125
126 state WORKSPACE_NUMBER:
127   workspace = string
128       -> call cmd_workspace_number($workspace)
129
130 # focus left|right|up|down
131 # focus output <output>
132 # focus tiling|floating|mode_toggle
133 # focus parent|child
134 # focus
135 state FOCUS:
136   direction = 'left', 'right', 'up', 'down'
137       -> call cmd_focus_direction($direction)
138   'output'
139       -> FOCUS_OUTPUT
140   window_mode = 'tiling', 'floating', 'mode_toggle'
141       -> call cmd_focus_window_mode($window_mode)
142   level = 'parent', 'child'
143       -> call cmd_focus_level($level)
144   end
145       -> call cmd_focus()
146
147 state FOCUS_OUTPUT:
148   output = string
149       -> call cmd_focus_output($output)
150
151 # kill [window|client]
152 state KILL:
153   kill_mode = 'window', 'client'
154       -> call cmd_kill($kill_mode)
155   end
156       -> call cmd_kill($kill_mode)
157
158 # fullscreen [global]
159 state FULLSCREEN:
160   fullscreen_mode = 'global'
161       -> call cmd_fullscreen($fullscreen_mode)
162   end
163       -> call cmd_fullscreen($fullscreen_mode)
164
165 # split v|h|vertical|horizontal
166 state SPLIT:
167   direction = 'horizontal', 'vertical', 'v', 'h'
168       -> call cmd_split($direction)
169
170 # floating enable|disable|toggle
171 state FLOATING:
172   floating = 'enable', 'disable', 'toggle'
173       -> call cmd_floating($floating)
174
175 # mark <mark>
176 state MARK:
177   mark = string
178       -> call cmd_mark($mark)
179
180 # resize
181 state RESIZE:
182   way = 'grow', 'shrink'
183       -> RESIZE_DIRECTION
184
185 state RESIZE_DIRECTION:
186   direction = 'up', 'down', 'left', 'right', 'width', 'height'
187       -> RESIZE_PX
188
189 state RESIZE_PX:
190   resize_px = word
191       -> RESIZE_TILING
192   end
193       -> call cmd_resize($way, $direction, "10", "10")
194
195 state RESIZE_TILING:
196   'px'
197       ->
198   'or'
199       -> RESIZE_TILING_OR
200   end
201       -> call cmd_resize($way, $direction, $resize_px, "10")
202
203 state RESIZE_TILING_OR:
204   'ppt'
205       ->
206   resize_ppt = word
207       ->
208   end
209       -> call cmd_resize($way, $direction, $resize_px, $resize_ppt)
210
211 # rename workspace <name> to <name>
212 # rename workspace to <name>
213 state RENAME:
214   'workspace'
215       -> RENAME_WORKSPACE
216
217 state RENAME_WORKSPACE:
218   old_name = 'to'
219       -> RENAME_WORKSPACE_LIKELY_TO
220   old_name = word
221       -> RENAME_WORKSPACE_TO
222
223 state RENAME_WORKSPACE_LIKELY_TO:
224   'to'
225       -> RENAME_WORKSPACE_NEW_NAME
226   new_name = word
227       -> call cmd_rename_workspace(NULL, $new_name)
228
229 state RENAME_WORKSPACE_TO:
230   'to'
231       -> RENAME_WORKSPACE_NEW_NAME
232
233 state RENAME_WORKSPACE_NEW_NAME:
234   end
235       -> call cmd_rename_workspace(NULL, "to")
236   new_name = string
237       -> call cmd_rename_workspace($old_name, $new_name)
238
239 # move <direction> [<pixels> [px]]
240 # move [window|container] [to] workspace [<str>|next|prev|next_on_output|prev_on_output|current]
241 # move [window|container] [to] output <str>
242 # move [window|container] [to] scratchpad
243 # move workspace to [output] <str>
244 # move scratchpad
245 # move [window|container] [to] [absolute] position [ [<pixels> [px] <pixels> [px]] | center ]
246 state MOVE:
247   'window'
248       ->
249   'container'
250       ->
251   'to'
252       ->
253   'workspace'
254       -> MOVE_WORKSPACE
255   'output'
256       -> MOVE_TO_OUTPUT
257   'scratchpad'
258       -> call cmd_move_scratchpad()
259   direction = 'left', 'right', 'up', 'down'
260       -> MOVE_DIRECTION
261   method = 'position'
262       -> MOVE_TO_POSITION
263   method = 'absolute'
264       -> MOVE_TO_ABSOLUTE_POSITION
265
266 state MOVE_DIRECTION:
267   pixels = word
268       -> MOVE_DIRECTION_PX
269   end
270       -> call cmd_move_direction($direction, "10")
271
272 state MOVE_DIRECTION_PX:
273   'px'
274       -> call cmd_move_direction($direction, $pixels)
275   end
276       -> call cmd_move_direction($direction, $pixels)
277
278 state MOVE_WORKSPACE:
279   'to '
280       -> MOVE_WORKSPACE_TO_OUTPUT
281   workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
282       -> call cmd_move_con_to_workspace($workspace)
283   'back_and_forth'
284       -> call cmd_move_con_to_workspace_back_and_forth()
285   'number'
286       -> MOVE_WORKSPACE_NUMBER
287   workspace = string
288       -> call cmd_move_con_to_workspace_name($workspace)
289
290 state MOVE_WORKSPACE_NUMBER:
291   number = string
292       -> call cmd_move_con_to_workspace_number($number)
293
294 state MOVE_TO_OUTPUT:
295   output = string
296       -> call cmd_move_con_to_output($output)
297
298 state MOVE_WORKSPACE_TO_OUTPUT:
299   'output'
300       ->
301   output = string
302       -> call cmd_move_workspace_to_output($output)
303
304 state MOVE_TO_ABSOLUTE_POSITION:
305   'position'
306       -> MOVE_TO_POSITION
307
308 state MOVE_TO_POSITION:
309   'center'
310       -> call cmd_move_window_to_center($method)
311   coord_x = word
312       -> MOVE_TO_POSITION_X
313
314 state MOVE_TO_POSITION_X:
315   'px'
316       ->
317   coord_y = word
318       -> MOVE_TO_POSITION_Y
319
320 state MOVE_TO_POSITION_Y:
321   'px', end
322       -> call cmd_move_window_to_position($method, $coord_x, $coord_y)
323
324 # mode <string>
325 state MODE:
326   mode = string
327       -> call cmd_mode($mode)
328
329 state NOP:
330   comment = string
331       -> call cmd_nop($comment)
332
333 state SCRATCHPAD:
334   'show'
335       -> call cmd_scratchpad_show()
336
337 # bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]
338 state BAR:
339   bar_type = 'hidden_state'
340       -> BAR_HIDDEN_STATE
341   bar_type = 'mode'
342       -> BAR_MODE
343
344 state BAR_HIDDEN_STATE:
345   bar_value = 'hide', 'show', 'toggle'
346       -> BAR_W_ID
347
348 state BAR_MODE:
349   bar_value = 'dock', 'hide', 'invisible', 'toggle'
350       -> BAR_W_ID
351
352 state BAR_W_ID:
353   bar_id = word
354       ->
355   end
356       -> call cmd_bar($bar_type, $bar_value, $bar_id)