diff --git a/tiling-assistant@leleat-on-github/src/extension/moveHandler.js b/tiling-assistant@leleat-on-github/src/extension/moveHandler.js index d0f96cbb..bfff0b3e 100644 --- a/tiling-assistant@leleat-on-github/src/extension/moveHandler.js +++ b/tiling-assistant@leleat-on-github/src/extension/moveHandler.js @@ -98,7 +98,7 @@ var Handler = class TilingMoveHandler { // Also work with a window, which was maximized by GNOME natively // because it may have been tiled with this extension before being // maximized so we need to restore its size to pre-tiling. - this._wasMaximizedOnStart = window.get_maximized(); + this._wasMaximizedOnStart = window.get_maximized() === Meta.MaximizeFlags.BOTH; const [x, y] = global.get_pointer(); // Try to restore the window size diff --git a/tiling-assistant@leleat-on-github/src/extension/tilingWindowManager.js b/tiling-assistant@leleat-on-github/src/extension/tilingWindowManager.js index 61ce3808..e2d51af3 100644 --- a/tiling-assistant@leleat-on-github/src/extension/tilingWindowManager.js +++ b/tiling-assistant@leleat-on-github/src/extension/tilingWindowManager.js @@ -158,6 +158,8 @@ var TilingWindowManager = class TilingWindowManager { const monitor = monitorNr ?? window.get_monitor(); const workArea = new Rect(window.get_work_area_for_monitor(monitor)); const maximize = newRect.equal(workArea); + const verticalMaximize = !maximize && newRect.height === workArea.height; + const horizontalMaximize = !maximize && newRect.width === workArea.width; window.isTiled = !maximize; if (!window.untiledRect) @@ -194,6 +196,11 @@ var TilingWindowManager = class TilingWindowManager { ); } + if (verticalMaximize) + window.maximize(Meta.MaximizeFlags.VERTICAL); + else if (horizontalMaximize) + window.maximize(Meta.MaximizeFlags.HORIZONTAL); + // See issue #137. // Under some circumstances it's possible that windows will tile to the wrong // monitor. I can't reproduce it but I suspect that it's because of passing