Check for empty ws on view destroyed.

In some cases destroying a view can result in an empty and inactive
workspace, which should be destroyed.

This handles those cases.
This commit is contained in:
Mikkel Oscar Lyderik 2016-02-25 13:36:25 +01:00
parent ee32bc3aef
commit c9d9dd7516
1 changed files with 10 additions and 0 deletions

View File

@ -303,6 +303,16 @@ static void handle_view_destroyed(wlc_handle handle) {
if (fullscreen) {
parent->fullscreen = NULL;
}
// Destroy empty workspaces
if (parent->type == C_WORKSPACE &&
parent->children->length == 0 &&
parent->floating->length == 0 &&
swayc_active_workspace() != parent &&
!parent->visible) {
parent = destroy_workspace(parent);
}
arrange_windows(parent, -1, -1);
} else {
// Is it unmanaged?