perl: use get_tree instead of get_workspaces
This commit is contained in:
parent
0f083f6f78
commit
4549effe15
@ -11,7 +11,7 @@ use v5.10;
|
|||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3("/tmp/nestedcons");
|
||||||
|
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
|
|
||||||
my $tmp = File::Temp->new(UNLINK => 0, SUFFIX => '.asy');
|
my $tmp = File::Temp->new(UNLINK => 0, SUFFIX => '.asy');
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ my $layout_container = Gtk2::HBox->new(0, 0);
|
|||||||
$layout_sw->add_with_viewport($layout_container);
|
$layout_sw->add_with_viewport($layout_container);
|
||||||
|
|
||||||
sub copy_tree {
|
sub copy_tree {
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
|
|
||||||
# convert the tree back to json so we only rebuild/redraw when the tree is changed
|
# convert the tree back to json so we only rebuild/redraw when the tree is changed
|
||||||
my $json = encode_json($tree);
|
my $json = encode_json($tree);
|
||||||
|
@ -16,7 +16,7 @@ sub fullscreen_windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# get the output of this workspace
|
# get the output of this workspace
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @outputs = @{$tree->{nodes}};
|
my @outputs = @{$tree->{nodes}};
|
||||||
my $output = first { defined(first { $_->{name} eq $tmp } @{$_->{nodes}}) } @outputs;
|
my $output = first { defined(first { $_->{name} eq $tmp } @{$_->{nodes}}) } @outputs;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ my $i3 = i3("/tmp/nestedcons");
|
|||||||
# Request tree
|
# Request tree
|
||||||
####################
|
####################
|
||||||
|
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
|
|
||||||
my $expected = {
|
my $expected = {
|
||||||
fullscreen_mode => 0,
|
fullscreen_mode => 0,
|
||||||
|
@ -18,7 +18,7 @@ $i3->command('kill')->recv;
|
|||||||
$i3->command('kill')->recv;
|
$i3->command('kill')->recv;
|
||||||
|
|
||||||
|
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @nodes = @{$tree->{nodes}};
|
my @nodes = @{$tree->{nodes}};
|
||||||
ok(@nodes > 0, 'i3 still lives');
|
ok(@nodes > 0, 'i3 still lives');
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ is(get_focused($tmp), $floating, 'floating window focused');
|
|||||||
sleep 1;
|
sleep 1;
|
||||||
$i3->command('mode toggle')->recv;
|
$i3->command('mode toggle')->recv;
|
||||||
|
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @nodes = @{$tree->{nodes}};
|
my @nodes = @{$tree->{nodes}};
|
||||||
ok(@nodes > 0, 'i3 still lives');
|
ok(@nodes > 0, 'i3 still lives');
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ my $i3 = i3("/tmp/nestedcons");
|
|||||||
|
|
||||||
$i3->command("blargh!")->recv;
|
$i3->command("blargh!")->recv;
|
||||||
|
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @nodes = @{$tree->{nodes}};
|
my @nodes = @{$tree->{nodes}};
|
||||||
ok(@nodes > 0, 'i3 still lives');
|
ok(@nodes > 0, 'i3 still lives');
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ sub open_empty_con {
|
|||||||
sub get_workspace_names {
|
sub get_workspace_names {
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3("/tmp/nestedcons");
|
||||||
# TODO: use correct command as soon as AnyEvent::i3 is updated
|
# TODO: use correct command as soon as AnyEvent::i3 is updated
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @workspaces = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
my @workspaces = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
||||||
[ map { $_->{name} } @workspaces ]
|
[ map { $_->{name} } @workspaces ]
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ sub get_unused_workspace {
|
|||||||
sub get_ws {
|
sub get_ws {
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3("/tmp/nestedcons");
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @ws = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
my @ws = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
||||||
|
|
||||||
# as there can only be one workspace with this name, we can safely
|
# as there can only be one workspace with this name, we can safely
|
||||||
@ -100,7 +100,7 @@ sub get_ws_content {
|
|||||||
sub get_focused {
|
sub get_focused {
|
||||||
my ($ws) = @_;
|
my ($ws) = @_;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3("/tmp/nestedcons");
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
|
|
||||||
my @ws = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
my @ws = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
||||||
my @cons = grep { $_->{name} eq $ws } @ws;
|
my @cons = grep { $_->{name} eq $ws } @ws;
|
||||||
|
Loading…
Reference in New Issue
Block a user