From ece6a1d408456ade74c88dee7d4b9e0491f0bdaf Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Sun, 25 Oct 2020 14:20:11 -0700 Subject: Change workspace_layout to match i3 behavior In i3, the workspace_layout command does not affect the workspace layout. Instead, new workspace level containers are wrapped in the desired layout and the workspace layout always defaults to the output orientation. --- sway/tree/view.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'sway/tree/view.c') diff --git a/sway/tree/view.c b/sway/tree/view.c index 354f2d34..e690c334 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -732,10 +732,11 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, ws = seat_get_last_known_workspace(seat); } + struct sway_container *container = view->container; if (target_sibling) { - container_add_sibling(target_sibling, view->container, 1); + container_add_sibling(target_sibling, container, 1); } else if (ws) { - workspace_add_tiling(ws, view->container); + container = workspace_add_tiling(ws, container); } ipc_event_window(view->container, "new"); @@ -759,26 +760,26 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, } if (config->popup_during_fullscreen == POPUP_LEAVE && - view->container->workspace && - view->container->workspace->fullscreen && - view->container->workspace->fullscreen->view) { - struct sway_container *fs = view->container->workspace->fullscreen; + container->workspace && + container->workspace->fullscreen && + container->workspace->fullscreen->view) { + struct sway_container *fs = container->workspace->fullscreen; if (view_is_transient_for(view, fs->view)) { container_set_fullscreen(fs, false); } } view_update_title(view, false); - container_update_representation(view->container); + container_update_representation(container); if (fullscreen) { container_set_fullscreen(view->container, true); arrange_workspace(view->container->workspace); } else { - if (view->container->parent) { - arrange_container(view->container->parent); - } else if (view->container->workspace) { - arrange_workspace(view->container->workspace); + if (container->parent) { + arrange_container(container->parent); + } else if (container->workspace) { + arrange_workspace(container->workspace); } } -- cgit v1.2.3