Codebase list i3-gaps / 6a17515 parser-specs / commands.spec
6a17515

Tree @6a17515 (Download .tar.gz)

commands.spec @6a17515raw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# vim:ts=2:sw=2:expandtab
#
# i3 - an improved dynamic tiling window manager
# © 2009 Michael Stapelberg and contributors (see also: LICENSE)
#
# parser-specs/commands.spec: Specification file for generate-command-parser.pl
# which will generate the appropriate header files for our C parser.
#
# Use :source highlighting.vim in vim to get syntax highlighting
# for this file.

state INITIAL:
  # We have an end token here for all the commands which just call some
  # function without using an explicit 'end' token.
  end ->
  '[' -> call cmd_criteria_init(); CRITERIA
  'move' -> MOVE
  'exec' -> EXEC
  'exit' -> call cmd_exit()
  'restart' -> call cmd_restart()
  'reload' -> call cmd_reload()
  'shmlog' -> SHMLOG
  'debuglog' -> DEBUGLOG
  'border' -> BORDER
  'layout' -> LAYOUT
  'append_layout' -> APPEND_LAYOUT
  'workspace' -> WORKSPACE
  'focus' -> FOCUS
  'kill' -> KILL
  'open' -> call cmd_open()
  'fullscreen' -> FULLSCREEN
  'sticky' -> STICKY
  'split' -> SPLIT
  'floating' -> FLOATING
  'mark' -> MARK
  'unmark' -> UNMARK
  'resize' -> RESIZE
  'rename' -> RENAME
  'nop' -> NOP
  'scratchpad' -> SCRATCHPAD
  'swap' -> SWAP
  'title_format' -> TITLE_FORMAT
  'title_window_icon' -> TITLE_WINDOW_ICON
  'mode' -> MODE
  'bar' -> BAR
  'gaps' -> GAPS

state CRITERIA:
  ctype = 'class'       -> CRITERION
  ctype = 'instance'    -> CRITERION
  ctype = 'window_role' -> CRITERION
  ctype = 'con_id'      -> CRITERION
  ctype = 'id'          -> CRITERION
  ctype = 'window_type' -> CRITERION
  ctype = 'con_mark'    -> CRITERION
  ctype = 'title'       -> CRITERION
  ctype = 'urgent'      -> CRITERION
  ctype = 'workspace'   -> CRITERION
  ctype = 'machine'     -> CRITERION
  ctype = 'tiling', 'floating', 'all'
      -> call cmd_criteria_add($ctype, NULL); CRITERIA
  ']' -> call cmd_criteria_match_windows(); INITIAL

state CRITERION:
  '=' -> CRITERION_STR

state CRITERION_STR:
  cvalue = word
      -> call cmd_criteria_add($ctype, $cvalue); CRITERIA

# exec [--no-startup-id] <command>
state EXEC:
  nosn = '--no-startup-id'
      ->
  command = string
      -> call cmd_exec($nosn, $command)

# shmlog <size>|toggle|on|off
state SHMLOG:
  # argument may be a number
  argument = string
    -> call cmd_shmlog($argument)

# debuglog toggle|on|off
state DEBUGLOG:
  argument = 'toggle', 'on', 'off'
    -> call cmd_debuglog($argument)

# border normal|pixel [<n>]
# border none|1pixel|toggle
state BORDER:
  border_style = 'normal', 'pixel', 'toggle'
    -> BORDER_WIDTH
  border_style = 'none'
    -> call cmd_border($border_style, 0)
  '1pixel'
    -> call cmd_border("pixel", 1)

# gaps inner|outer|horizontal|vertical|top|right|bottom|left [current] [set|plus|minus|toggle] <px>
state GAPS:
  type = 'inner', 'outer', 'horizontal', 'vertical', 'top', 'right', 'bottom', 'left'
      -> GAPS_WITH_TYPE

state GAPS_WITH_TYPE:
  scope = 'current', 'all'
      -> GAPS_WITH_SCOPE

state GAPS_WITH_SCOPE:
  mode = 'plus', 'minus', 'set', 'toggle'
      -> GAPS_WITH_MODE

state GAPS_WITH_MODE:
  value = word
      -> call cmd_gaps($type, $scope, $mode, $value)

state BORDER_WIDTH:
  end
    -> call cmd_border($border_style, -1)
  border_width = number
    -> call cmd_border($border_style, &border_width)

# layout default|stacked|stacking|tabbed|splitv|splith
# layout toggle [split|all]
state LAYOUT:
  layout_mode = 'default', 'stacked', 'stacking', 'tabbed', 'splitv', 'splith'
      -> call cmd_layout($layout_mode)
  'toggle'
      -> LAYOUT_TOGGLE

# layout toggle [split|all]
state LAYOUT_TOGGLE:
  end
      -> call cmd_layout_toggle($toggle_mode)
  toggle_mode = string
      -> call cmd_layout_toggle($toggle_mode)

# append_layout <path>
state APPEND_LAYOUT:
  path = string -> call cmd_append_layout($path)

# workspace next|prev|next_on_output|prev_on_output
# workspace back_and_forth
# workspace [--no-auto-back-and-forth] <name>
# workspace [--no-auto-back-and-forth] number <number>
state WORKSPACE:
  no_auto_back_and_forth = '--no-auto-back-and-forth'
      ->
  direction = 'next_on_output', 'prev_on_output', 'next', 'prev'
      -> call cmd_workspace($direction)
  'back_and_forth'
      -> call cmd_workspace_back_and_forth()
  'number'
      -> WORKSPACE_NUMBER
  workspace = string
      -> call cmd_workspace_name($workspace, $no_auto_back_and_forth)

state WORKSPACE_NUMBER:
  workspace = string
      -> call cmd_workspace_number($workspace, $no_auto_back_and_forth)

# focus left|right|up|down
# focus output <output>
# focus tiling|floating|mode_toggle
# focus parent|child
# focus
state FOCUS:
  direction = 'left', 'right', 'up', 'down'
      -> call cmd_focus_direction($direction)
  direction = 'prev', 'next'
      -> FOCUS_AUTO
  'output'
      -> FOCUS_OUTPUT
  window_mode = 'tiling', 'floating', 'mode_toggle'
      -> call cmd_focus_window_mode($window_mode)
  level = 'parent', 'child'
      -> call cmd_focus_level($level)
  end
      -> call cmd_focus()

state FOCUS_AUTO:
  'sibling'
      -> call cmd_focus_sibling($direction)
  end
      -> call cmd_focus_direction($direction)

state FOCUS_OUTPUT:
  output = word
      -> call cmd_focus_output($output); FOCUS_OUTPUT
  end
      -> call cmd_focus_output(NULL); INITIAL

# kill [window|client]
state KILL:
  kill_mode = 'window', 'client'
      -> call cmd_kill($kill_mode)
  end
      -> call cmd_kill($kill_mode)

# fullscreen enable|toggle [global]
# fullscreen disable
# fullscreen [global]
state FULLSCREEN:
  action = 'disable'
      -> call cmd_fullscreen($action, "output")
  action = 'enable', 'toggle'
      -> FULLSCREEN_MODE
  action = ''
      -> FULLSCREEN_COMPAT

state FULLSCREEN_MODE:
  mode = 'global'
      -> call cmd_fullscreen($action, $mode)
  end
      -> call cmd_fullscreen($action, "output")

state FULLSCREEN_COMPAT:
  mode = 'global'
      -> call cmd_fullscreen("toggle", $mode)
  end
      -> call cmd_fullscreen("toggle", "output")

# sticky enable|disable|toggle
state STICKY:
  action = 'enable', 'disable', 'toggle'
      -> call cmd_sticky($action)

# split v|h|t|vertical|horizontal|toggle
state SPLIT:
  direction = 'horizontal', 'vertical', 'toggle', 'v', 'h', 't'
      -> call cmd_split($direction)

# floating enable|disable|toggle
state FLOATING:
  floating = 'enable', 'disable', 'toggle'
      -> call cmd_floating($floating)

# mark [--add|--replace] [--toggle] <mark>
state MARK:
  mode = '--add', '--replace'
      ->
  toggle = '--toggle'
      ->
  mark = string
      -> call cmd_mark($mark, $mode, $toggle)

# unmark [mark]
state UNMARK:
  end
      -> call cmd_unmark($mark)
  mark = string
      -> call cmd_unmark($mark)

# resize
state RESIZE:
  way = 'grow', 'shrink'
      -> RESIZE_DIRECTION
  set = 'set'
      -> RESIZE_SET

state RESIZE_DIRECTION:
  direction = 'up', 'down', 'left', 'right', 'width', 'height'
      -> RESIZE_PX

state RESIZE_PX:
  resize_px = number
      -> RESIZE_TILING
  end
      -> call cmd_resize($way, $direction, 10, 10)

state RESIZE_TILING:
  'px'
      ->
  'or'
      -> RESIZE_TILING_OR
  end
      -> call cmd_resize($way, $direction, &resize_px, 0)

state RESIZE_TILING_OR:
  resize_ppt = number
      -> RESIZE_TILING_FINAL

state RESIZE_TILING_FINAL:
  'ppt', end
      -> call cmd_resize($way, $direction, &resize_px, &resize_ppt)

state RESIZE_SET:
  'height'
      -> RESIZE_HEIGHT_GET_NUMBER
  'width'
      ->
  width = number
      -> RESIZE_WIDTH

state RESIZE_WIDTH:
  mode_width = 'px', 'ppt'
      ->
  end
      -> call cmd_resize_set(&width, $mode_width, 0, 0)
  'height'
      -> RESIZE_HEIGHT_GET_NUMBER
  height = number
      -> RESIZE_HEIGHT

state RESIZE_HEIGHT_GET_NUMBER:
  height = number
      -> RESIZE_HEIGHT

state RESIZE_HEIGHT:
  mode_height = 'px', 'ppt'
      ->
  end
      -> call cmd_resize_set(&width, $mode_width, &height, $mode_height)

# rename workspace <name> to <name>
# rename workspace to <name>
state RENAME:
  'workspace'
      -> RENAME_WORKSPACE

state RENAME_WORKSPACE:
  'to'
      -> RENAME_WORKSPACE_LIKELY_TO
  old_name = word
      -> RENAME_WORKSPACE_TO

state RENAME_WORKSPACE_LIKELY_TO:
  'to '
      -> RENAME_WORKSPACE_LIKELY_TO_NEW_NAME
  new_name = word
      -> call cmd_rename_workspace(NULL, $new_name)

state RENAME_WORKSPACE_LIKELY_TO_NEW_NAME:
  new_name = string
      -> call cmd_rename_workspace("to", $new_name)
  end
      -> call cmd_rename_workspace(NULL, "to")

state RENAME_WORKSPACE_TO:
  'to'
      -> RENAME_WORKSPACE_TO_NEW_NAME

state RENAME_WORKSPACE_TO_NEW_NAME:
  new_name = string
      -> call cmd_rename_workspace($old_name, $new_name)


# move <direction> [<amount> [px|ppt]]
# move [window|container] [to] workspace [<str>|next|prev|next_on_output|prev_on_output|current]
# move [window|container] [to] output <str>
# move [window|container] [to] mark <str>
# move [window|container] [to] scratchpad
# move workspace to [output] <str>
# move scratchpad
# move [window|container] [to] [absolute] position [ [<pos_x> [px|ppt] <pos_y> [px|ppt] ] | center ]
# move [window|container] [to] position mouse|cursor|pointer
state MOVE:
  'window'
      ->
  'container'
      ->
  'to'
      ->
  no_auto_back_and_forth = '--no-auto-back-and-forth'
      ->
  'workspace'
      -> MOVE_WORKSPACE
  'output'
      -> MOVE_TO_OUTPUT
  'mark'
      -> MOVE_TO_MARK
  'scratchpad'
      -> call cmd_move_scratchpad()
  direction = 'left', 'right', 'up', 'down'
      -> MOVE_DIRECTION
  method = 'position'
      -> MOVE_TO_POSITION
  method = 'absolute'
      -> MOVE_TO_ABSOLUTE_POSITION

state MOVE_DIRECTION:
  amount = number
      -> MOVE_DIRECTION_NUMBER
  end
      -> call cmd_move_direction($direction, 10, "px")

state MOVE_DIRECTION_NUMBER:
  mode = 'px', 'ppt'
      -> call cmd_move_direction($direction, &amount, $mode)
  end
      -> call cmd_move_direction($direction, &amount, "px")

state MOVE_WORKSPACE:
  'to '
      -> MOVE_WORKSPACE_TO_OUTPUT
  workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current'
      -> call cmd_move_con_to_workspace($workspace)
  'back_and_forth'
      -> call cmd_move_con_to_workspace_back_and_forth()
  'number'
      -> MOVE_WORKSPACE_NUMBER
  workspace = string
      -> call cmd_move_con_to_workspace_name($workspace, $no_auto_back_and_forth)

state MOVE_WORKSPACE_NUMBER:
  number = string
      -> call cmd_move_con_to_workspace_number($number, $no_auto_back_and_forth)

state MOVE_TO_OUTPUT:
  output = word
      -> call cmd_move_con_to_output($output, 0); MOVE_TO_OUTPUT
  end
      -> call cmd_move_con_to_output(NULL, 0); INITIAL

state MOVE_TO_MARK:
  mark = string
      -> call cmd_move_con_to_mark($mark)

state MOVE_WORKSPACE_TO_OUTPUT:
  'output'
      -> MOVE_WORKSPACE_TO_OUTPUT_WORD

state MOVE_WORKSPACE_TO_OUTPUT_WORD:
  output = word
      -> call cmd_move_con_to_output($output, 1); MOVE_WORKSPACE_TO_OUTPUT_WORD
  end
      -> call cmd_move_con_to_output(NULL, 1); INITIAL

state MOVE_TO_ABSOLUTE_POSITION:
  'position'
      -> MOVE_TO_POSITION

state MOVE_TO_POSITION:
  'center'
      -> call cmd_move_window_to_center($method)
  'mouse', 'cursor', 'pointer'
      -> call cmd_move_window_to_mouse()
  coord_x = number
      -> MOVE_TO_POSITION_X

state MOVE_TO_POSITION_X:
  mode_x = 'px', 'ppt'
      ->
  coord_y = number
      -> MOVE_TO_POSITION_Y

state MOVE_TO_POSITION_Y:
  mode_y = 'px', 'ppt'
      -> call cmd_move_window_to_position(&coord_x, $mode_x, &coord_y, $mode_y)
  end
      -> call cmd_move_window_to_position(&coord_x, $mode_x, &coord_y, 0)

# mode <string>
state MODE:
  mode = string
      -> call cmd_mode($mode)

state NOP:
  comment = string
      -> call cmd_nop($comment)
  end
      -> call cmd_nop(NULL)

state SCRATCHPAD:
  'show'
      -> call cmd_scratchpad_show()

# swap [container] [with] id <window>
# swap [container] [with] con_id <con_id>
# swap [container] [with] mark <mark>
state SWAP:
  'container'
      ->
  'with'
      ->
  mode = 'id', 'con_id', 'mark'
      -> SWAP_ARGUMENT

state SWAP_ARGUMENT:
  arg = string
      -> call cmd_swap($mode, $arg)

state TITLE_FORMAT:
  format = string
      -> call cmd_title_format($format)

state TITLE_WINDOW_ICON:
  'padding'
    -> TITLE_WINDOW_ICON_PADDING
  enable = 'toggle'
    -> TITLE_WINDOW_ICON_PADDING
  enable = '1', 'yes', 'true', 'on', 'enable', 'active', '0', 'no', 'false', 'off', 'disable', 'inactive'
    -> call cmd_title_window_icon($enable, 0)

state TITLE_WINDOW_ICON_PADDING:
  end
    -> call cmd_title_window_icon($enable, &padding)
  'px'
    -> call cmd_title_window_icon($enable, &padding)
  padding = number
    ->

# bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]
state BAR:
  'hidden_state'
      -> BAR_HIDDEN_STATE
  'mode'
      -> BAR_MODE

state BAR_HIDDEN_STATE:
  bar_value = 'hide', 'show', 'toggle'
      -> BAR_HIDDEN_STATE_ID

state BAR_HIDDEN_STATE_ID:
  bar_id = word
      ->
  end
      -> call cmd_bar_hidden_state($bar_value, $bar_id)

state BAR_MODE:
  bar_value = 'dock', 'hide', 'invisible', 'toggle'
      -> BAR_MODE_ID

state BAR_MODE_ID:
  bar_id = word
      ->
  end
      -> call cmd_bar_mode($bar_value, $bar_id)