-cmd '[urgent=oldest] focus';
-is($x->input_focus, $bottom->id, 'oldest urgent window focused');
-$bottom->delete_hint('urgency');
-sync_with_i3;
+ $tmp = fresh_workspace;
+ my $floating_win = open_floating_window;
+
+# switch away
+ fresh_workspace;
+
+ set_urgency($floating_win, 1, $type);
+ sync_with_i3;
+
+ cmd "workspace $tmp";
+
+ does_i3_live;
+
+###############################################################################
+# Check if the urgency hint is still set when the urgent window is killed
+###############################################################################
+
+ my $ws1 = fresh_workspace;
+ my $ws2 = fresh_workspace;
+ cmd "workspace $ws1";
+ my $w1 = open_window;
+ my $w2 = open_window;
+ cmd "workspace $ws2";
+ sync_with_i3;
+ set_urgency($w1, 1, $type);
+ sync_with_i3;
+ cmd '[id="' . $w1->id . '"] kill';
+ sync_with_i3;
+ my $w = get_ws($ws1);
+ is($w->{urgent}, 0, 'Urgent flag no longer set after killing the window ' .
+ 'from another workspace');
+
+##############################################################################
+# Check if urgent flag can be unset if we move the window out of the container
+##############################################################################
+ my $tmp = fresh_workspace;
+ cmd 'layout tabbed';
+ my $w1 = open_window;
+ my $w2 = open_window;
+ sync_with_i3;
+ cmd '[id="' . $w2->id . '"] focus';
+ sync_with_i3;
+ cmd 'split v';
+ cmd 'layout stacked';
+ my $w3 = open_window;
+ sync_with_i3;
+ cmd '[id="' . $w2->id . '"] focus';
+ sync_with_i3;
+ set_urgency($w3, 1, $type);
+ sync_with_i3;
+ cmd 'focus parent';
+ sync_with_i3;
+ cmd 'move right';
+ cmd '[id="' . $w3->id . '"] focus';
+ sync_with_i3;
+ my $ws = get_ws($tmp);
+ ok(!$ws->{urgent}, 'urgent flag not set on workspace');
+
+ exit_gracefully($pid);
+}