…and 'level down' to 'focus child'. More intuitive than the old command names.
You probably guessed it already: There is no limit on how deep your hierarchy
of splits can be.
-=== Level up
+=== Focus parent
Let’s stay with our example from above. We have a terminal on the left and two
vertically split terminals on the right, focus is on the bottom right one. When
you open a new terminal, it will open below the current one.
So, how can you open a new terminal window to the *right* of the current one?
-The solution is to use +level up+, which will focus the +Parent Container+ of
+The solution is to use +focus parent+, which will focus the +Parent Container+ of
the current +Container+. In this case, you would focus the +Vertical Split
Container+ which is *inside* the horizontally oriented workspace. Thus, now new
windows will be opened to the right of the +Vertical Split Container+:
-image::tree-shot3.png["shot3",title="Level Up, then open new terminal"]
+image::tree-shot3.png["shot3",title="Focus parent, then open new terminal"]
== Configuring i3
# toggle tiling / floating
bindsym Mod1+Shift+space mode toggle
-bindsym Mod1+u level up
-#bindsym Mod1+d level down
+# focus the parent container
+bindsym Mod1+u focus parent
+
+# focus the child container
+#bindsym Mod1+d focus child
# Kill current window
bindsym Mod1+c kill
split { return TOK_SPLIT; }
horizontal { return TOK_HORIZONTAL; }
vertical { return TOK_VERTICAL; }
-level { return TOK_LEVEL; }
up { return TOK_UP; }
down { return TOK_DOWN; }
left { return TOK_LEFT; }
right { return TOK_RIGHT; }
+parent { return TOK_PARENT; }
+child { return TOK_CHILD; }
resize { return TOK_RESIZE; }
shrink { return TOK_SHRINK; }
grow { return TOK_GROW; }
%token TOK_SPLIT "split"
%token TOK_HORIZONTAL "horizontal"
%token TOK_VERTICAL "vertical"
-%token TOK_LEVEL "level"
%token TOK_UP "up"
%token TOK_DOWN "down"
%token TOK_LEFT "left"
%token TOK_RIGHT "right"
+%token TOK_PARENT "parent"
+%token TOK_CHILD "child"
%token TOK_RESTORE "restore"
%token TOK_MARK "mark"
%token TOK_RESIZE "resize"
%token <number> NUMBER "<number>"
%type <number> direction
-%type <chr> level_direction
+%type <number> level
%type <number> window_mode
%type <number> border_style
%type <number> layout_mode
| fullscreen
| split
| mode
- | level
| mark
| resize
| nop
tree_render();
}
+ | TOK_FOCUS level
+ {
+ if ($2 == TOK_PARENT)
+ level_up();
+ else level_down();
+
+ tree_render();
+ }
+ ;
+
+level:
+ TOK_PARENT { $$ = TOK_PARENT; }
+ | TOK_CHILD { $$ = TOK_CHILD; }
;
kill:
| TOK_1PIXEL { $$ = BS_1PIXEL; }
;
-
-level:
- TOK_LEVEL level_direction
- {
- printf("level %c\n", $2);
- if ($2 == 'u')
- level_up();
- else level_down();
-
- tree_render();
- }
- ;
-
-level_direction:
- TOK_UP { $$ = 'u'; }
- | TOK_DOWN { $$ = 'd'; }
- ;
-
move:
TOK_MOVE direction
{
# | | | |
# --------------------------
cmd 'split v';
-cmd 'level up';
+cmd 'focus parent';
cmd 'open';
$content = get_ws_content($tmp);
my ($nodes, $focus) = get_ws_content($tmp);
is($nodes->[1]->{focused}, 0, 'split container not focused');
-cmd 'level up';
+cmd 'focus parent';
($nodes, $focus) = get_ws_content($tmp);
-is($nodes->[1]->{focused}, 1, 'split container focused after level up');
+is($nodes->[1]->{focused}, 1, 'split container focused after focus parent');
my $third = open_empty_con($i3);
# now change the orientation to horizontal and cycle
##############################################################
-cmd 'level up';
+cmd 'focus parent';
cmd 'split h';
-cmd 'level down';
+cmd 'focus child';
cmd 'focus down';
is(get_focused($tmp), $first, 'first container focused');
# Set the parent to floating
#####################################################################
cmd 'nop setting floating';
-cmd 'level up';
+cmd 'focus parent';
cmd 'mode floating';
#####################################################################
is($content[0]->{layout}, 'stacked', 'layout stacked');
#####################################################################
-# 3: level up, open two new cons, check that they end up in a stacked
+# 3: focus parent, open two new cons, check that they end up in a stacked
# con
#####################################################################
-cmd 'level up';
+cmd 'focus parent';
my $right_top = open_standard_window($x);
my $right_bot = open_standard_window($x);
@content = @{get_ws_content($tmp)};
-is(@content, 2, 'two cons at workspace level after level up');
+is(@content, 2, 'two cons at workspace level after focus parent');
is($content[0]->{layout}, 'stacked', 'layout stacked');
is($content[1]->{layout}, 'stacked', 'layout stacked');