From 6aaa01084551f5ff048e77ccde88282b1d245617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Br=C3=B8nner?= Date: Tue, 1 May 2018 13:24:50 +0200 Subject: [PATCH] cycle-width: Move window if necessary so it remains fully visible --- tiling.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tiling.js b/tiling.js index bfa7e51..68fa75e 100644 --- a/tiling.js +++ b/tiling.js @@ -1335,7 +1335,15 @@ function cycleWindowWidth(metaWindow) { let availableWidth = monitor.width - minimumMargin*2; let r = frame.width / availableWidth; let nextW = Math.floor(ratios[findNext(r)]*availableWidth); - metaWindow.move_resize_frame(true, frame.x, frame.y, nextW, frame.height); + let nextX = frame.x; + + if (nextX+nextW > monitor.x+monitor.width - minimumMargin) { + // Move the window so it remains fully visible + nextX = monitor.x+monitor.width - minimumMargin - nextW; + } + + // WEAKNESS: When the navigator is open the window is not moved until the navigator is closed + metaWindow.move_resize_frame(true, nextX, frame.y, nextW, frame.height); delete metaWindow.unmaximized_rect; }