diff options
author | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-02-25 13:36:25 +0100 |
---|---|---|
committer | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-02-25 13:36:25 +0100 |
commit | c9d9dd75161b8f08aa937b8904f529fa05aa92aa (patch) | |
tree | 47259e969aa561b4ca2a008dd29ea35781b6d836 /sway/handlers.c | |
parent | ee32bc3aef5ae7c0b96439bc2e5cd1e32612dafd (diff) |
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.
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 10 |
1 files changed, 10 insertions, 0 deletions
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? |