1# vim:ts=2:sw=2:expandtab 2# 3# i3 - an improved dynamic tiling window manager 4# © 2009 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 12state 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 'sticky' -> STICKY 33 'split' -> SPLIT 34 'floating' -> FLOATING 35 'mark' -> MARK 36 'unmark' -> UNMARK 37 'resize' -> RESIZE 38 'rename' -> RENAME 39 'nop' -> NOP 40 'scratchpad' -> SCRATCHPAD 41 'swap' -> SWAP 42 'title_format' -> TITLE_FORMAT 43 'title_window_icon' -> TITLE_WINDOW_ICON 44 'mode' -> MODE 45 'bar' -> BAR 46 47state CRITERIA: 48 ctype = 'class' -> CRITERION 49 ctype = 'instance' -> CRITERION 50 ctype = 'window_role' -> CRITERION 51 ctype = 'con_id' -> CRITERION 52 ctype = 'id' -> CRITERION 53 ctype = 'window_type' -> CRITERION 54 ctype = 'con_mark' -> CRITERION 55 ctype = 'title' -> CRITERION 56 ctype = 'urgent' -> CRITERION 57 ctype = 'workspace' -> CRITERION 58 ctype = 'machine' -> CRITERION 59 ctype = 'tiling', 'floating', 'all' 60 -> call cmd_criteria_add($ctype, NULL); CRITERIA 61 ']' -> call cmd_criteria_match_windows(); INITIAL 62 63state CRITERION: 64 '=' -> CRITERION_STR 65 66state CRITERION_STR: 67 cvalue = word 68 -> call cmd_criteria_add($ctype, $cvalue); CRITERIA 69 70# exec [--no-startup-id] <command> 71state EXEC: 72 nosn = '--no-startup-id' 73 -> 74 command = string 75 -> call cmd_exec($nosn, $command) 76 77# shmlog <size>|toggle|on|off 78state SHMLOG: 79 # argument may be a number 80 argument = string 81 -> call cmd_shmlog($argument) 82 83# debuglog toggle|on|off 84state DEBUGLOG: 85 argument = 'toggle', 'on', 'off' 86 -> call cmd_debuglog($argument) 87 88# border normal|pixel [<n>] 89# border none|1pixel|toggle 90state BORDER: 91 border_style = 'normal', 'pixel', 'toggle' 92 -> BORDER_WIDTH 93 border_style = 'none' 94 -> call cmd_border($border_style, 0) 95 '1pixel' 96 -> call cmd_border("pixel", 1) 97 98state BORDER_WIDTH: 99 end 100 -> call cmd_border($border_style, -1) 101 border_width = number 102 -> call cmd_border($border_style, &border_width) 103 104# layout default|stacked|stacking|tabbed|splitv|splith 105# layout toggle [split|all] 106state LAYOUT: 107 layout_mode = 'default', 'stacked', 'stacking', 'tabbed', 'splitv', 'splith' 108 -> call cmd_layout($layout_mode) 109 'toggle' 110 -> LAYOUT_TOGGLE 111 112# layout toggle [split|all] 113state LAYOUT_TOGGLE: 114 end 115 -> call cmd_layout_toggle($toggle_mode) 116 toggle_mode = string 117 -> call cmd_layout_toggle($toggle_mode) 118 119# append_layout <path> 120state APPEND_LAYOUT: 121 path = string -> call cmd_append_layout($path) 122 123# workspace next|prev|next_on_output|prev_on_output 124# workspace back_and_forth 125# workspace [--no-auto-back-and-forth] <name> 126# workspace [--no-auto-back-and-forth] number <number> 127state WORKSPACE: 128 no_auto_back_and_forth = '--no-auto-back-and-forth' 129 -> 130 direction = 'next_on_output', 'prev_on_output', 'next', 'prev' 131 -> call cmd_workspace($direction) 132 'back_and_forth' 133 -> call cmd_workspace_back_and_forth() 134 'number' 135 -> WORKSPACE_NUMBER 136 workspace = string 137 -> call cmd_workspace_name($workspace, $no_auto_back_and_forth) 138 139state WORKSPACE_NUMBER: 140 workspace = string 141 -> call cmd_workspace_number($workspace, $no_auto_back_and_forth) 142 143# focus left|right|up|down 144# focus output <output> 145# focus tiling|floating|mode_toggle 146# focus parent|child 147# focus 148state FOCUS: 149 direction = 'left', 'right', 'up', 'down' 150 -> call cmd_focus_direction($direction) 151 direction = 'prev', 'next' 152 -> FOCUS_AUTO 153 'output' 154 -> FOCUS_OUTPUT 155 window_mode = 'tiling', 'floating', 'mode_toggle' 156 -> call cmd_focus_window_mode($window_mode) 157 level = 'parent', 'child' 158 -> call cmd_focus_level($level) 159 end 160 -> call cmd_focus() 161 162state FOCUS_AUTO: 163 'sibling' 164 -> call cmd_focus_sibling($direction) 165 end 166 -> call cmd_focus_direction($direction) 167 168state FOCUS_OUTPUT: 169 output = string 170 -> call cmd_focus_output($output) 171 172# kill [window|client] 173state KILL: 174 kill_mode = 'window', 'client' 175 -> call cmd_kill($kill_mode) 176 end 177 -> call cmd_kill($kill_mode) 178 179# fullscreen enable|toggle [global] 180# fullscreen disable 181# fullscreen [global] 182state FULLSCREEN: 183 action = 'disable' 184 -> call cmd_fullscreen($action, "output") 185 action = 'enable', 'toggle' 186 -> FULLSCREEN_MODE 187 action = '' 188 -> FULLSCREEN_COMPAT 189 190state FULLSCREEN_MODE: 191 mode = 'global' 192 -> call cmd_fullscreen($action, $mode) 193 end 194 -> call cmd_fullscreen($action, "output") 195 196state FULLSCREEN_COMPAT: 197 mode = 'global' 198 -> call cmd_fullscreen("toggle", $mode) 199 end 200 -> call cmd_fullscreen("toggle", "output") 201 202# sticky enable|disable|toggle 203state STICKY: 204 action = 'enable', 'disable', 'toggle' 205 -> call cmd_sticky($action) 206 207# split v|h|t|vertical|horizontal|toggle 208state SPLIT: 209 direction = 'horizontal', 'vertical', 'toggle', 'v', 'h', 't' 210 -> call cmd_split($direction) 211 212# floating enable|disable|toggle 213state FLOATING: 214 floating = 'enable', 'disable', 'toggle' 215 -> call cmd_floating($floating) 216 217# mark [--add|--replace] [--toggle] <mark> 218state MARK: 219 mode = '--add', '--replace' 220 -> 221 toggle = '--toggle' 222 -> 223 mark = string 224 -> call cmd_mark($mark, $mode, $toggle) 225 226# unmark [mark] 227state UNMARK: 228 end 229 -> call cmd_unmark($mark) 230 mark = string 231 -> call cmd_unmark($mark) 232 233# resize 234state RESIZE: 235 way = 'grow', 'shrink' 236 -> RESIZE_DIRECTION 237 set = 'set' 238 -> RESIZE_SET 239 240state RESIZE_DIRECTION: 241 direction = 'up', 'down', 'left', 'right', 'width', 'height' 242 -> RESIZE_PX 243 244state RESIZE_PX: 245 resize_px = number 246 -> RESIZE_TILING 247 end 248 -> call cmd_resize($way, $direction, 10, 10) 249 250state RESIZE_TILING: 251 'px' 252 -> 253 'or' 254 -> RESIZE_TILING_OR 255 end 256 -> call cmd_resize($way, $direction, &resize_px, 0) 257 258state RESIZE_TILING_OR: 259 resize_ppt = number 260 -> RESIZE_TILING_FINAL 261 262state RESIZE_TILING_FINAL: 263 'ppt', end 264 -> call cmd_resize($way, $direction, &resize_px, &resize_ppt) 265 266state RESIZE_SET: 267 'height' 268 -> RESIZE_HEIGHT_GET_NUMBER 269 'width' 270 -> 271 width = number 272 -> RESIZE_WIDTH 273 274state RESIZE_WIDTH: 275 mode_width = 'px', 'ppt' 276 -> 277 end 278 -> call cmd_resize_set(&width, $mode_width, 0, 0) 279 'height' 280 -> RESIZE_HEIGHT_GET_NUMBER 281 height = number 282 -> RESIZE_HEIGHT 283 284state RESIZE_HEIGHT_GET_NUMBER: 285 height = number 286 -> RESIZE_HEIGHT 287 288state RESIZE_HEIGHT: 289 mode_height = 'px', 'ppt' 290 -> 291 end 292 -> call cmd_resize_set(&width, $mode_width, &height, $mode_height) 293 294# rename workspace <name> to <name> 295# rename workspace to <name> 296state RENAME: 297 'workspace' 298 -> RENAME_WORKSPACE 299 300state RENAME_WORKSPACE: 301 'to' 302 -> RENAME_WORKSPACE_LIKELY_TO 303 old_name = word 304 -> RENAME_WORKSPACE_TO 305 306state RENAME_WORKSPACE_LIKELY_TO: 307 'to ' 308 -> RENAME_WORKSPACE_LIKELY_TO_NEW_NAME 309 new_name = word 310 -> call cmd_rename_workspace(NULL, $new_name) 311 312state RENAME_WORKSPACE_LIKELY_TO_NEW_NAME: 313 new_name = string 314 -> call cmd_rename_workspace("to", $new_name) 315 end 316 -> call cmd_rename_workspace(NULL, "to") 317 318state RENAME_WORKSPACE_TO: 319 'to' 320 -> RENAME_WORKSPACE_TO_NEW_NAME 321 322state RENAME_WORKSPACE_TO_NEW_NAME: 323 new_name = string 324 -> call cmd_rename_workspace($old_name, $new_name) 325 326 327# move <direction> [<amount> [px|ppt]] 328# move [window|container] [to] workspace [<str>|next|prev|next_on_output|prev_on_output|current] 329# move [window|container] [to] output <str> 330# move [window|container] [to] mark <str> 331# move [window|container] [to] scratchpad 332# move workspace to [output] <str> 333# move scratchpad 334# move [window|container] [to] [absolute] position [ [<pos_x> [px|ppt] <pos_y> [px|ppt] ] | center ] 335# move [window|container] [to] position mouse|cursor|pointer 336state MOVE: 337 'window' 338 -> 339 'container' 340 -> 341 'to' 342 -> 343 no_auto_back_and_forth = '--no-auto-back-and-forth' 344 -> 345 'workspace' 346 -> MOVE_WORKSPACE 347 'output' 348 -> MOVE_TO_OUTPUT 349 'mark' 350 -> MOVE_TO_MARK 351 'scratchpad' 352 -> call cmd_move_scratchpad() 353 direction = 'left', 'right', 'up', 'down' 354 -> MOVE_DIRECTION 355 method = 'position' 356 -> MOVE_TO_POSITION 357 method = 'absolute' 358 -> MOVE_TO_ABSOLUTE_POSITION 359 360state MOVE_DIRECTION: 361 amount = number 362 -> MOVE_DIRECTION_NUMBER 363 end 364 -> call cmd_move_direction($direction, 10, "px") 365 366state MOVE_DIRECTION_NUMBER: 367 mode = 'px', 'ppt' 368 -> call cmd_move_direction($direction, &amount, $mode) 369 end 370 -> call cmd_move_direction($direction, &amount, "px") 371 372state MOVE_WORKSPACE: 373 'to ' 374 -> MOVE_WORKSPACE_TO_OUTPUT 375 workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current' 376 -> call cmd_move_con_to_workspace($workspace) 377 'back_and_forth' 378 -> call cmd_move_con_to_workspace_back_and_forth() 379 'number' 380 -> MOVE_WORKSPACE_NUMBER 381 workspace = string 382 -> call cmd_move_con_to_workspace_name($workspace, $no_auto_back_and_forth) 383 384state MOVE_WORKSPACE_NUMBER: 385 number = string 386 -> call cmd_move_con_to_workspace_number($number, $no_auto_back_and_forth) 387 388state MOVE_TO_OUTPUT: 389 output = word 390 -> call cmd_move_con_to_output($output, 0); MOVE_TO_OUTPUT 391 end 392 -> call cmd_move_con_to_output(NULL, 0); INITIAL 393 394state MOVE_TO_MARK: 395 mark = string 396 -> call cmd_move_con_to_mark($mark) 397 398state MOVE_WORKSPACE_TO_OUTPUT: 399 'output' 400 -> MOVE_WORKSPACE_TO_OUTPUT_WORD 401 402state MOVE_WORKSPACE_TO_OUTPUT_WORD: 403 output = word 404 -> call cmd_move_con_to_output($output, 1); MOVE_WORKSPACE_TO_OUTPUT_WORD 405 end 406 -> call cmd_move_con_to_output(NULL, 1); INITIAL 407 408state MOVE_TO_ABSOLUTE_POSITION: 409 'position' 410 -> MOVE_TO_POSITION 411 412state MOVE_TO_POSITION: 413 'center' 414 -> call cmd_move_window_to_center($method) 415 'mouse', 'cursor', 'pointer' 416 -> call cmd_move_window_to_mouse() 417 coord_x = number 418 -> MOVE_TO_POSITION_X 419 420state MOVE_TO_POSITION_X: 421 mode_x = 'px', 'ppt' 422 -> 423 coord_y = number 424 -> MOVE_TO_POSITION_Y 425 426state MOVE_TO_POSITION_Y: 427 mode_y = 'px', 'ppt' 428 -> call cmd_move_window_to_position(&coord_x, $mode_x, &coord_y, $mode_y) 429 end 430 -> call cmd_move_window_to_position(&coord_x, $mode_x, &coord_y, 0) 431 432# mode <string> 433state MODE: 434 mode = string 435 -> call cmd_mode($mode) 436 437state NOP: 438 comment = string 439 -> call cmd_nop($comment) 440 end 441 -> call cmd_nop(NULL) 442 443state SCRATCHPAD: 444 'show' 445 -> call cmd_scratchpad_show() 446 447# swap [container] [with] id <window> 448# swap [container] [with] con_id <con_id> 449# swap [container] [with] mark <mark> 450state SWAP: 451 'container' 452 -> 453 'with' 454 -> 455 mode = 'id', 'con_id', 'mark' 456 -> SWAP_ARGUMENT 457 458state SWAP_ARGUMENT: 459 arg = string 460 -> call cmd_swap($mode, $arg) 461 462state TITLE_FORMAT: 463 format = string 464 -> call cmd_title_format($format) 465 466state TITLE_WINDOW_ICON: 467 'padding' 468 -> TITLE_WINDOW_ICON_PADDING 469 enable = '1', 'yes', 'true', 'on', 'enable', 'active', '0', 'no', 'false', 'off', 'disable', 'inactive' 470 -> call cmd_title_window_icon($enable, 0) 471 472state TITLE_WINDOW_ICON_PADDING: 473 end 474 -> call cmd_title_window_icon($enable, &padding) 475 'px' 476 -> call cmd_title_window_icon($enable, &padding) 477 padding = number 478 -> 479 480# bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>] 481state BAR: 482 'hidden_state' 483 -> BAR_HIDDEN_STATE 484 'mode' 485 -> BAR_MODE 486 487state BAR_HIDDEN_STATE: 488 bar_value = 'hide', 'show', 'toggle' 489 -> BAR_HIDDEN_STATE_ID 490 491state BAR_HIDDEN_STATE_ID: 492 bar_id = word 493 -> 494 end 495 -> call cmd_bar_hidden_state($bar_value, $bar_id) 496 497state BAR_MODE: 498 bar_value = 'dock', 'hide', 'invisible', 'toggle' 499 -> BAR_MODE_ID 500 501state BAR_MODE_ID: 502 bar_id = word 503 -> 504 end 505 -> call cmd_bar_mode($bar_value, $bar_id) 506