Commit Graph

40 Commits

Author SHA1 Message Date
a532f5ac39 Implement a new parser for commands. (+test)
On the rationale of using a custom parser instead of a lex/yacc one, see this
quote from src/commands_parser.c:
     We use a hand-written parser instead of lex/yacc because our commands are
     easy for humans, not for computers. Thus, it’s quite hard to specify a
     context-free grammar for the commands. A PEG grammar would be easier, but
     there’s downsides to every PEG parser generator I have come accross so far.

     This parser is basically a state machine which looks for literals or strings
     and can push either on a stack. After identifying a literal or string, it
     will either transition to the current state, to a different state, or call a
     function (like cmd_move()).

     Special care has been taken that error messages are useful and the code is
     well testable (when compiled with -DTEST_PARSER it will output to stdout
     instead of actually calling any function).

During the migration phase (I plan to completely switch to this parser before
4.2 will be released), the new parser will parse every command you send to
i3 and save the resulting call stack. Then, the old parser will parse your
input and actually execute the commands. Afterwards, both call stacks will be
compared and any differences will be logged.

The new parser works with 100% of the test suite and produces identical call
stacks.
2012-01-14 21:29:57 +00:00
608def6c6e cmdparse.l: [^t] is enough (Thanks f8l) 2012-01-10 23:09:00 +00:00
df9b338175 Introduce synonyms: 'move to workspace' and 'move container to workspace' and 'move window to workspace'
This makes the new 'move workspace to output' command much more clear
2012-01-10 22:16:09 +00:00
fba2582b2e Switch and Move to next workspace on the same Output. As requested in \#554 2012-01-08 16:24:21 +00:00
08986a1798 Implement scratchpad functionality (see userguide) 2011-12-21 23:15:32 +00:00
60bfc3a600 Bugfix: Correctly handle --no-startup-id with quoted exec commands (Thanks aksr)
Parser changes shortly before a release. What could possibly go wrong.
2011-11-11 00:28:04 +00:00
bebd2fceb6 Bugfix: Correctly return to initial state after prev/next/back_and_forth (Thanks Brian)
Fixes: #552
2011-11-10 18:42:24 +00:00
178be03fa6 Implement 'workspace back_and_forth' (Patch by Michael Walle) 2011-10-17 23:17:56 +01:00
501dc36b98 move sstrdup, scalloc, smalloc, srealloc to libi3, improve error messages 2011-10-02 18:09:30 +01:00
b3adaa2983 Implement the window_role criterion (checks WM_WINDOW_ROLE)
Closes: #446

This is handy for matching specific windows of a multi-window application, for
example only Pidgin’s buddy list window.
2011-09-18 16:05:10 +01:00
7ddba4995f BUG-396: Implement move output <RANDR-OUTPUT> command
Also add support for move output <up|down|left|right> and update
userguide about the new command.
2011-08-17 16:10:11 +02:00
1913bf0e5c Add "instance" to matching criteria 2011-08-04 20:10:31 +02:00
c408fef021 Implement 'focus floating', 'focus tiling' and 'focus mode_toggle' (+test +docs) 2011-07-04 17:09:52 +02:00
60ae26c19d Implement 'workspace next/prev' (+test) 2011-06-10 16:03:59 +02:00
39b1c1bf75 Re-implement the 'mode' command 2011-06-10 02:38:07 +02:00
f1385ba3d5 CONFIG BREAK: Rename 'restore' to 'append_layout' 2011-06-10 02:15:31 +02:00
bd49c80d5f CONFIG BREAK: rename 'mode floating/tiling' to 'floating enable/disable'
The three different variants now:
   floating enable
   floating disable
   floating toggle
2011-06-10 02:06:47 +02:00
9bbb37bb55 BREAKS CONFIG: rename 'level up' to 'focus parent'
…and 'level down' to 'focus child'. More intuitive than the old command names.
2011-06-10 01:36:33 +02:00
9aa7e5fbd6 Parse multiple criteria in commands (+test), better error message for 'focus' 2011-06-08 23:34:08 +02:00
d68e4710fe CONFIG BREAK: kick the 'next'/'prev' commands, introduce 'focus left' etc.
Instead of the cryptic next/prev commands, we now provide an argument to the
focus command. Userguide and default config is updated.
2011-06-08 20:49:49 +02:00
e27a8597d8 forgot to remove unused TOK_ATTACH token from lexer 2011-05-22 21:42:34 +02:00
08f64f011d cleanup cmdparse lexer/parser (ignore whitespace, solves conflicts) 2011-05-22 21:26:50 +02:00
167bdd26b7 Argument for 'kill' for killing a specific window (now default) or the whole client (+test)
Use 'kill window' to kill a specific window (for example only one specific
popup), use 'kill client' to kill the whole application (or X11 connection to
be specific).
2011-05-13 20:41:03 +02:00
62e977102b Bugfix: Fix the WANT_QSTRING state 2011-05-13 17:03:15 +02:00
94646190aa Bugfix: Correct string/quoted string parsing for the commands exec, workspace, nop, restore and mark (Thanks SardemFF7)
Fixes: #380
2011-05-12 07:09:06 +02:00
26a416e016 refactor tree_move() into src/move.c, change config (!), change testcase
Due to lots of cases which were added and added to tree_move(), the function
was not really easy to understand. For this refactoring, I wrote tree_move()
from scratch, thinking about (hopefully) all cases. The testsuite still passes.

The move command also has different parameters now. Instead of the hard to
understand 'before v' stuff, we use 'move [left|right|up|down]'.
2011-02-14 23:05:20 +01:00
131a2f8765 debugging: implement a NOP command which just spits out its argument
You can use this in testcases to mark specific sections:
  $i3->command('nop before trying to crash')->recv;
leads to the following output in the i3 logfile:
  -------------------------------------------------
    NOP: before trying to crash
  -------------------------------------------------
2010-11-20 18:40:25 +01:00
6eb7f2a01d lexer/parser: implement 'border' command 2010-11-12 18:41:54 +01:00
565ef78b12 parser: implement resize command 2010-06-30 19:47:23 +02:00
6897e15e72 Implement mark/goto, modify testcase 2010-06-02 23:32:05 +02:00
cea8f91e18 parser: implement 'layout' 2010-06-01 23:20:57 +02:00
71e0e49c0e Implement mode toggle 2010-05-31 22:48:28 +02:00
c75a6732bf Implement 'restore' in new parser 2010-05-11 23:00:31 +02:00
a0e33c1d68 implement 'move' command in the new parser 2010-05-11 22:46:49 +02:00
98dbe63e35 Implement exec, exit, level, restart (without testcases for now) 2010-05-10 10:12:35 +02:00
6a1c34d2c5 Implement 'split' 2010-05-10 09:33:10 +02:00
145ebc7584 Implement 'prev', extend testcase 2010-05-10 09:08:31 +02:00
d8307f4b4a implement 'next' in the new command parser (testcase unfinished) 2010-05-10 00:06:24 +02:00
93600ce0fd implement con_id for matching containers, extend testcase 2010-04-16 15:30:07 +02:00
769501420d add first version of a new flex/bison based command parser 2010-04-14 20:26:56 +02:00