+ my %args = @_;
+ if (exists($args{output})) {
+ my $i3 = i3(get_socket_path());
+ my $tree = $i3->get_tree->recv;
+ my $output = first { $_->{name} eq "fake-$args{output}" }
+ @{$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 $focused = $content->{focus}->[0];
+ my $workspace = first { $_->{id} == $focused } @{$content->{nodes}};
+ $workspace = $workspace->{name};
+ cmd("workspace $workspace");
+ }
+