From c9d9dd75161b8f08aa937b8904f529fa05aa92aa Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Thu, 25 Feb 2016 13:36:25 +0100 Subject: 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. --- sway/handlers.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sway/handlers.c') diff --git a/sway/handlers.c b/sway/handlers.c index d3fbdc0f..69f325eb 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -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? -- cgit v1.2.3