diff --git a/extension.js b/extension.js index e5b7bfc..517f8a1 100644 --- a/extension.js +++ b/extension.js @@ -64,7 +64,7 @@ function unMaximizeIfMaximized(app) { function initApp(app) { app.wintile = { - origFrame: app.get_frame_rect(), + origFrame: app.get_frame_rect() || getDefaultFloatingRectangle(), row: -1, col: -1, height: -1, @@ -72,6 +72,18 @@ function initApp(app) { }; } +function getDefaultFloatingRectangle() { + _log('Getting default rectangle.') + let padding = 100; + let workspace = app.get_work_area_current_monitor(); + return { + x: workspace.x + padding, + y: workspace.y + padding, + width: workspace.width - padding * 2, + height: workspace.height - padding * 2 + }; +} + function restoreApp(app) { app.move_resize_frame(true, app.wintile.origFrame.x, app.wintile.origFrame.y, app.wintile.origFrame.width, app.wintile.origFrame.height); app.wintile = null;