diff --git a/README.md b/README.md index 393d9be..81f68da 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,8 @@ WinTile can be found on the GNOME Extension site: https://extensions.gnome.org/extension/1723/wintile-windows-10-window-tiling-for-gnome/ + +# Configuration +1. Visit https://extensions.gnome.org/local/ +1. Click on the "Configure this extension" button. +1. Alternatively, open the `Extension` settings in [Gnome Tweaks](https://gitlab.gnome.org/GNOME/gnome-tweaks), locate `Wintile` and click on the cogwheel button to bring up the configuration dialog. diff --git a/extension.js b/extension.js index 9369386..0de8d85 100644 --- a/extension.js +++ b/extension.js @@ -90,6 +90,17 @@ function requestMinimize(app) { } else { _log("Not minimizing due to config"); } + +// Move window to specified location and size. +// On paper, the move_resize_frame should not need the preceding move_frame, +// but the additional move_frame is known to fix errors with gnome-terminal +// and [gnome-]terminator. +// A similar fix is used in the gTile extension: +// See https://github.com/gTile/gTile/commit/fc68797015e13143f74606fcbb9d48859f55dca9 by jshack88. +function moveAppCoordinates(app, x, y, w, h) { + _log("Moving window to ("+x+","+y+"), size ("+w+","+h+")" ); + app.move_frame(true, x, y); + app.move_resize_frame(true, x, y, w, h); } function moveApp(app, loc) { @@ -112,12 +123,12 @@ function moveApp(app, loc) { if (!config.useMaximize) { unMaximizeIfMaximized(app); - app.move_resize_frame(true, x, y, w, h); + moveAppCoordinates(app, x, y, w, h); } else { if (loc.height < 2 || loc.width < config.cols) { unMaximizeIfMaximized(app); } - app.move_resize_frame(true, x, y, w, h); + moveAppCoordinates(app, x, y, w, h); if (loc.height == 2 && loc.width == config.cols) { // Maximize _log('maximize') @@ -197,7 +208,7 @@ function restoreApp(app, move=true) { if (app.wintile.origFrame.y+app.wintile.origFrame.height > space.y+space.height) { app.wintile.origFrame.y = space.y + space.height - app.wintile.origFrame.height - 100; } - app.move_resize_frame(true, app.wintile.origFrame.x, app.wintile.origFrame.y, app.wintile.origFrame.width, app.wintile.origFrame.height); + moveAppCoordinates(app, app.wintile.origFrame.x, app.wintile.origFrame.y, app.wintile.origFrame.width, app.wintile.origFrame.height); } else { // BUG: when clicking the maximize button, then dragging the window off, it moves to below the mouse cursor let [x, y, mask] = global.get_pointer(); @@ -208,7 +219,7 @@ function restoreApp(app, move=true) { window = app.wintile.origFrame; _log(`A) origFrame - x:${window.x} y:${window.y} w:${window.width} h:${window.height}`); } - app.move_resize_frame(true, Math.floor(x-app.wintile.origFrame.width/2), y-10, app.wintile.origFrame.width, app.wintile.origFrame.height); + moveAppCoordinates(app, Math.floor(x-app.wintile.origFrame.width/2), y-10, app.wintile.origFrame.width, app.wintile.origFrame.height); if (config.debug) { let window = app.get_frame_rect() _log(`B) mouse - x:${x} y:${y}`); diff --git a/prefs.js b/prefs.js index 14ee3ac..1769c6a 100644 --- a/prefs.js +++ b/prefs.js @@ -167,7 +167,7 @@ function buildPrefsWidget() { // Delay let previewDelayLabel = new Gtk.Label({ - label: _(" Delay in ms before preview dislpays"), + label: _(" Delay in ms before preview displays"), visible: true, hexpand: true, halign: Gtk.Align.START