diff --git a/lib/extension/tree.js b/lib/extension/tree.js index ea957d29..903457af 100644 --- a/lib/extension/tree.js +++ b/lib/extension/tree.js @@ -125,7 +125,9 @@ export class Node extends GObject.Object { case NODE_TYPES.MONITOR: case NODE_TYPES.ROOT: case NODE_TYPES.WORKSPACE: - if (this.actor) { + // (a container split off a window that was never laid out gets no rect until the next + // render, #540) + if (this.actor && rect) { this.actor.set_size(rect.width, rect.height); this.actor.set_position(rect.x, rect.y); } diff --git a/lib/extension/window.js b/lib/extension/window.js index 61820e1e..8335489d 100644 --- a/lib/extension/window.js +++ b/lib/extension/window.js @@ -1408,7 +1408,11 @@ export class WindowManager extends GObject.Object { */ trackWindow(_display, metaWindow) { let autoSplit = this.ext.settings.get_boolean("auto-split-enabled"); - if (autoSplit && this.focusMetaWindow) { + // Only for a window that is new to the tree: trackCurrentWindows() re-tracks every window + // after a workspace is added or removed, and splitting again for each of them wrapped the + // focused window in one more container each time (#540) + const isNewWindow = this._validWindow(metaWindow) && !this.tree.findNode(metaWindow); + if (autoSplit && isNewWindow && this.focusMetaWindow) { let currentFocusNode = this.tree.findNode(this.focusMetaWindow); if (currentFocusNode) { let currentParentFocusNode = currentFocusNode.parentNode;