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.
This commit is contained in:
Michael Stapelberg
2011-06-08 20:49:49 +02:00
parent 30501e7c8a
commit d68e4710fe
11 changed files with 66 additions and 78 deletions

View File

@ -44,20 +44,20 @@ sub focus_after {
$focus = $x->input_focus;
is($focus, $bottom->id, "Latest window focused");
$focus = focus_after("prev v");
$focus = focus_after('focus up');
is($focus, $mid->id, "Middle window focused");
$focus = focus_after("prev v");
$focus = focus_after('focus up');
is($focus, $top->id, "Top window focused");
#####################################################################
# Test focus wrapping
#####################################################################
$focus = focus_after("prev v");
$focus = focus_after('focus up');
is($focus, $bottom->id, "Bottom window focused (wrapping to the top works)");
$focus = focus_after("next v");
$focus = focus_after('focus down');
is($focus, $top->id, "Top window focused (wrapping to the bottom works)");
###############################################

View File

@ -45,7 +45,7 @@ sub focus_after {
$focus = $x->input_focus;
is($focus, $bottom->id, "Latest window focused");
$focus = focus_after("prev h");
$focus = focus_after('focus left');
is($focus, $mid->id, "Middle window focused");
#####################################################################
@ -59,7 +59,7 @@ is($focus, $mid->id, "focus unchanged");
$i3->command("mark $random_mark")->recv;
$focus = focus_after("prev h");
$focus = focus_after('focus left');
is($focus, $top->id, "Top window focused");
$focus = focus_after(qq|[con_mark="$random_mark"] focus|);

View File

@ -8,23 +8,23 @@ use i3test;
my $tmp = fresh_workspace;
######################################################################
# Open one container, verify that 'next v' and 'next h' do nothing
# Open one container, verify that 'focus down' and 'focus right' do nothing
######################################################################
cmd 'open';
my ($nodes, $focus) = get_ws_content($tmp);
my $old_focused = $focus->[0];
cmd 'next v';
cmd 'focus down';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $old_focused, 'focus did not change with only one con');
cmd 'next h';
cmd 'focus right';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $old_focused, 'focus did not change with only one con');
######################################################################
# Open another container, verify that 'next h' switches
# Open another container, verify that 'focus right' switches
######################################################################
my $left = $old_focused;
@ -38,44 +38,32 @@ cmd 'open';
isnt($old_focused, $focus->[0], 'new container is focused');
my $right = $focus->[0];
cmd 'next h';
cmd 'focus right';
($nodes, $focus) = get_ws_content($tmp);
isnt($focus->[0], $right, 'focus did change');
is($focus->[0], $left, 'left container focused (wrapping)');
cmd 'next h';
cmd 'focus right';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $mid, 'middle container focused');
cmd 'next h';
cmd 'focus right';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $right, 'right container focused');
cmd 'prev h';
cmd 'focus left';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $mid, 'middle container focused');
cmd 'prev h';
cmd 'focus left';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $left, 'left container focused');
cmd 'prev h';
cmd 'focus left';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $right, 'right container focused');
######################################################################
# Test synonyms (horizontal/vertical instead of h/v)
######################################################################
cmd 'prev horizontal';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $mid, 'middle container focused');
cmd 'next horizontal';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $right, 'right container focused');
######################################################################
# Test focus command
######################################################################

View File

@ -121,11 +121,11 @@ cmd "open";
cmd "open";
cmd "split v";
cmd "open";
cmd "prev h";
cmd 'focus left';
cmd "split v";
cmd "open";
cmd "move right";
cmd "prev h";
cmd 'focus left';
cmd "move right";
$content = get_ws_content($otmp);

View File

@ -64,11 +64,11 @@ cmd 'split v';
$first = open_empty_con($i3);
my $bottom = open_empty_con($i3);
cmd 'prev v';
cmd 'focus up';
cmd 'split h';
my $middle = open_empty_con($i3);
my $right = open_empty_con($i3);
cmd 'next v';
cmd 'focus down';
# We have the following layout now (second is focused):
# .----------------------------.

View File

@ -28,10 +28,10 @@ isnt($first, $second, 'two different containers opened');
cmd 'layout stacking';
is(get_focused($tmp), $second, 'second container still focused');
cmd 'next v';
cmd 'focus down';
is(get_focused($tmp), $first, 'first container focused');
cmd 'prev v';
cmd 'focus up';
is(get_focused($tmp), $second, 'second container focused again');
##############################################################
@ -42,10 +42,10 @@ cmd 'level up';
cmd 'split h';
cmd 'level down';
cmd 'next v';
cmd 'focus down';
is(get_focused($tmp), $first, 'first container focused');
cmd 'prev v';
cmd 'focus up';
is(get_focused($tmp), $second, 'second container focused again');

View File

@ -36,7 +36,7 @@ diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
is($x->input_focus, $right->id, 'Right window focused');
cmd 'prev h';
cmd 'focus left';
is($x->input_focus, $mid->id, 'Mid window focused');