Introduce splith/splitv layouts, remove orientation
With this commit, the "default" layout is replaced by the splith and
splitv layouts. splith is equivalent to default with orientation
horizontal and splitv is equivalent to default with orientation
vertical.
The "split h" and "split v" commands continue to work as before, they
split the current container and you will end up in a split container
with layout splith (after "split h") or splitv (after "split v").
To change a splith container into a splitv container, use either "layout
splitv" or "layout toggle split". The latter command is used in the
default config as mod+l (previously "layout default"). In case you have
"layout default" in your config file, it is recommended to just replace
it by "layout toggle split", which will work as "layout default" did
before when pressing it once, but toggle between horizontal/vertical
when pressing it repeatedly.
The rationale behind this commit is that it’s cleaner to have all
parameters that influence how windows are rendered in the layout itself
rather than having a special parameter in combination with only one
layout. This enables us to change existing split containers in all cases
without breaking existing features (see ticket #464). Also, users should
feel more confident about whether they are actually splitting or just
changing an existing split container now.
As a nice side-effect, this commit brings back the "layout toggle"
feature we once had in i3 version 3 (see the userguide).
AFAIK, it is safe to use in-place restart to upgrade into versions
after this commit (switching to an older version will break your layout,
though).
Fixes #464
2012-08-04 03:04:00 +02:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
2012-09-10 14:09:01 +02:00
|
|
|
#
|
|
|
|
# Please read the following documents before working on tests:
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/testsuite.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
Introduce splith/splitv layouts, remove orientation
With this commit, the "default" layout is replaced by the splith and
splitv layouts. splith is equivalent to default with orientation
horizontal and splitv is equivalent to default with orientation
vertical.
The "split h" and "split v" commands continue to work as before, they
split the current container and you will end up in a split container
with layout splith (after "split h") or splitv (after "split v").
To change a splith container into a splitv container, use either "layout
splitv" or "layout toggle split". The latter command is used in the
default config as mod+l (previously "layout default"). In case you have
"layout default" in your config file, it is recommended to just replace
it by "layout toggle split", which will work as "layout default" did
before when pressing it once, but toggle between horizontal/vertical
when pressing it repeatedly.
The rationale behind this commit is that it’s cleaner to have all
parameters that influence how windows are rendered in the layout itself
rather than having a special parameter in combination with only one
layout. This enables us to change existing split containers in all cases
without breaking existing features (see ticket #464). Also, users should
feel more confident about whether they are actually splitting or just
changing an existing split container now.
As a nice side-effect, this commit brings back the "layout toggle"
feature we once had in i3 version 3 (see the userguide).
AFAIK, it is safe to use in-place restart to upgrade into versions
after this commit (switching to an older version will break your layout,
though).
Fixes #464
2012-08-04 03:04:00 +02:00
|
|
|
# Verifies that switching between the different layouts works as expected.
|
|
|
|
use i3test;
|
|
|
|
|
|
|
|
my $tmp = fresh_workspace;
|
|
|
|
|
|
|
|
open_window;
|
|
|
|
open_window;
|
|
|
|
cmd 'split v';
|
|
|
|
open_window;
|
|
|
|
|
|
|
|
my ($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout is splitv currently');
|
|
|
|
|
|
|
|
cmd 'layout stacked';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
|
|
|
|
|
|
|
cmd 'layout tabbed';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
|
|
|
|
|
|
|
cmd 'layout toggle split';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv again');
|
|
|
|
|
|
|
|
cmd 'layout toggle split';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
cmd 'layout toggle split';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
|
|
|
cmd 'layout toggle split';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
cmd 'layout toggle';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
|
|
|
|
|
|
|
cmd 'layout toggle';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
|
|
|
|
|
|
|
cmd 'layout toggle';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
cmd 'layout toggle';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
|
|
|
|
|
|
|
cmd 'layout toggle all';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
|
|
|
|
|
|
|
cmd 'layout toggle all';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
cmd 'layout toggle all';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
|
|
|
cmd 'layout toggle all';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
|
|
|
|
|
|
|
cmd 'layout toggle all';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
|
|
|
|
|
|
|
cmd 'layout toggle all';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
cmd 'layout toggle all';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
2017-01-19 20:49:56 +01:00
|
|
|
cmd 'layout toggle splith splitv';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
cmd 'layout toggle splith splitv';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
|
|
|
cmd 'layout toggle stacked splitv tabbed';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
|
|
|
|
|
|
|
cmd 'layout toggle stacking splitv tabbed';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
|
|
|
|
|
|
|
cmd 'layout toggle stacking splitv tabbed';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
|
|
|
cmd 'layout toggle splitv i stacking tabbed';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
|
|
|
|
|
|
|
cmd 'layout toggle stacked';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
# this is correct if it does nothing
|
2017-02-24 08:36:31 +01:00
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
2017-01-19 20:49:56 +01:00
|
|
|
|
|
|
|
cmd 'layout toggle tabbed stacked';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
2017-02-24 08:36:31 +01:00
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
2017-01-19 20:49:56 +01:00
|
|
|
|
|
|
|
# obsoletes 'split' ;)
|
|
|
|
cmd 'layout toggle splith splitv';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
# nonsense but works expectedly
|
|
|
|
cmd 'layout toggle split split';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
|
|
|
cmd 'layout toggle split split';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splith', 'layout now splith');
|
|
|
|
|
|
|
|
# testing with arbitrary length and garbage
|
|
|
|
cmd 'layout toggle stacking splith tabbed splitv stacking';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
|
|
|
|
|
|
|
cmd 'layout toggle stacking splith garbage tabbed splitv stacking';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
|
|
|
cmd 'layout toggle stacking splith garbage tabbed splitv stacking';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'stacked', 'layout now stacked');
|
|
|
|
|
|
|
|
cmd 'layout toggle splitv splith garbage splitv tabbed stacking splitv';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'splitv', 'layout now splitv');
|
|
|
|
|
|
|
|
cmd 'layout toggle splitv garbage tabbed';
|
|
|
|
($nodes, $focus) = get_ws_content($tmp);
|
|
|
|
is($nodes->[1]->{layout}, 'tabbed', 'layout now tabbed');
|
|
|
|
|
Introduce splith/splitv layouts, remove orientation
With this commit, the "default" layout is replaced by the splith and
splitv layouts. splith is equivalent to default with orientation
horizontal and splitv is equivalent to default with orientation
vertical.
The "split h" and "split v" commands continue to work as before, they
split the current container and you will end up in a split container
with layout splith (after "split h") or splitv (after "split v").
To change a splith container into a splitv container, use either "layout
splitv" or "layout toggle split". The latter command is used in the
default config as mod+l (previously "layout default"). In case you have
"layout default" in your config file, it is recommended to just replace
it by "layout toggle split", which will work as "layout default" did
before when pressing it once, but toggle between horizontal/vertical
when pressing it repeatedly.
The rationale behind this commit is that it’s cleaner to have all
parameters that influence how windows are rendered in the layout itself
rather than having a special parameter in combination with only one
layout. This enables us to change existing split containers in all cases
without breaking existing features (see ticket #464). Also, users should
feel more confident about whether they are actually splitting or just
changing an existing split container now.
As a nice side-effect, this commit brings back the "layout toggle"
feature we once had in i3 version 3 (see the userguide).
AFAIK, it is safe to use in-place restart to upgrade into versions
after this commit (switching to an older version will break your layout,
though).
Fixes #464
2012-08-04 03:04:00 +02:00
|
|
|
done_testing;
|