From 2deedca4e3baec02806112bb89989dc2b597b142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Tue, 12 Sep 2017 17:11:51 +0200 Subject: [PATCH] Fix ensure_viewport to center large windows That is only use as much margin as there's room for without pushing the window outside the viewport --- tiling.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tiling.js b/tiling.js index b3d746f..8c553c9 100644 --- a/tiling.js +++ b/tiling.js @@ -110,9 +110,11 @@ ensure_viewport = (meta_window) => { let workspace = workspaces[meta_window.get_workspace().workspace_index]; let index = workspace.indexOf(meta_window) let margin = margin_lr + let frame = meta_window.get_frame_rect(); + if (frame.width > global.screen_width - 2*margin) + margin = (global.screen_width - frame.width)/2 if (index == workspace.length - 1 || index == 0) margin = 0 - let frame = meta_window.get_frame_rect(); if (end >= global.screen_width - margin) { let position = global.screen_width - margin - frame.width; propogate_forward(index, position, false)