BREAKS CONFIG: rename 'level up' to 'focus parent'
…and 'level down' to 'focus child'. More intuitive than the old command names.
This commit is contained in:
parent
adb6d9630c
commit
9bbb37bb55
@ -237,19 +237,19 @@ unfloat::[]
|
||||
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
|
||||
|
@ -40,8 +40,11 @@ bindsym Mod1+l layout default
|
||||
# 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
|
||||
|
@ -124,11 +124,12 @@ prev { return TOK_PREV; }
|
||||
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; }
|
||||
|
@ -144,11 +144,12 @@ char *parse_cmd(const char *new) {
|
||||
%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"
|
||||
@ -168,7 +169,7 @@ char *parse_cmd(const char *new) {
|
||||
%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
|
||||
@ -345,7 +346,6 @@ operation:
|
||||
| fullscreen
|
||||
| split
|
||||
| mode
|
||||
| level
|
||||
| mark
|
||||
| resize
|
||||
| nop
|
||||
@ -441,6 +441,19 @@ focus:
|
||||
|
||||
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:
|
||||
@ -582,24 +595,6 @@ border_style:
|
||||
| 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
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ is($content->[0]->{id}, $first, 'first container unmodified');
|
||||
# | | | |
|
||||
# --------------------------
|
||||
cmd 'split v';
|
||||
cmd 'level up';
|
||||
cmd 'focus parent';
|
||||
cmd 'open';
|
||||
|
||||
$content = get_ws_content($tmp);
|
||||
|
@ -23,9 +23,9 @@ cmd 'split v';
|
||||
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);
|
||||
|
||||
|
@ -38,9 +38,9 @@ is(get_focused($tmp), $second, 'second container focused again');
|
||||
# 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');
|
||||
|
@ -48,7 +48,7 @@ sleep 0.25;
|
||||
# Set the parent to floating
|
||||
#####################################################################
|
||||
cmd 'nop setting floating';
|
||||
cmd 'level up';
|
||||
cmd 'focus parent';
|
||||
cmd 'mode floating';
|
||||
|
||||
#####################################################################
|
||||
|
@ -79,16 +79,16 @@ ok(@content == 1, 'one con at workspace level');
|
||||
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');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user