]> git.sur5r.net Git - i3/i3/blobdiff - testcases/lib/i3test.pm
Merge branch 'master' into next
[i3/i3] / testcases / lib / i3test.pm
index 414362ae1be8414e3f1a75e15a1de46e9734cc0a..d71a6e86cb9ece155cf90a67093cfb7b2aeb6567 100644 (file)
@@ -391,7 +391,7 @@ sub get_workspace_names {
     for my $output (@outputs) {
         next if $output->{name} eq '__i3';
         # get the first CT_CON of each output
-        my $content = first { $_->{type} == 2 } @{$output->{nodes}};
+        my $content = first { $_->{type} eq 'con' } @{$output->{nodes}};
         @cons = (@cons, @{$content->{nodes}});
     }
     [ map { $_->{name} } @cons ]
@@ -434,7 +434,7 @@ sub fresh_workspace {
                         @{$tree->{nodes}};
         die "BUG: Could not find output $args{output}" unless defined($output);
         # Get the focused workspace on that output and switch to it.
-        my $content = first { $_->{type} == 2 } @{$output->{nodes}};
+        my $content = first { $_->{type} eq 'con' } @{$output->{nodes}};
         my $focused = $content->{focus}->[0];
         my $workspace = first { $_->{id} == $focused } @{$content->{nodes}};
         $workspace = $workspace->{name};
@@ -479,7 +479,7 @@ sub get_ws {
     my @workspaces;
     for my $output (@outputs) {
         # get the first CT_CON of each output
-        my $content = first { $_->{type} == 2 } @{$output->{nodes}};
+        my $content = first { $_->{type} eq 'con' } @{$output->{nodes}};
         @workspaces = (@workspaces, @{$content->{nodes}});
     }
 
@@ -589,13 +589,13 @@ sub get_dock_clients {
     for my $output (@outputs) {
         if (!defined($which)) {
             @docked = (@docked, map { @{$_->{nodes}} }
-                                grep { $_->{type} == 5 }
+                                grep { $_->{type} eq 'dockarea' }
                                 @{$output->{nodes}});
         } elsif ($which eq 'top') {
-            my $first = first { $_->{type} == 5 } @{$output->{nodes}};
+            my $first = first { $_->{type} eq 'dockarea' } @{$output->{nodes}};
             @docked = (@docked, @{$first->{nodes}}) if defined($first);
         } elsif ($which eq 'bottom') {
-            my @matching = grep { $_->{type} == 5 } @{$output->{nodes}};
+            my @matching = grep { $_->{type} eq 'dockarea' } @{$output->{nodes}};
             my $last = $matching[-1];
             @docked = (@docked, @{$last->{nodes}}) if defined($last);
         }
@@ -645,7 +645,7 @@ sub focused_ws {
     my $tree = $i3->get_tree->recv;
     my $focused = $tree->{focus}->[0];
     my $output = first { $_->{id} == $focused } @{$tree->{nodes}};
-    my $content = first { $_->{type} == 2 } @{$output->{nodes}};
+    my $content = first { $_->{type} eq 'con' } @{$output->{nodes}};
     my $first = first { $_->{fullscreen_mode} == 1 } @{$content->{nodes}};
     return $first->{name}
 }