mirror of
https://github.com/FranP-code/wintile.git
synced 2025-10-13 00:33:46 +00:00
Merge branch 'develop' of github.com:Fmstrat/wintile into config-use-minimize
This commit is contained in:
@@ -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/
|
||||
|
||||
<img src='demo.gif'>
|
||||
|
||||
# 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.
|
||||
|
||||
19
extension.js
19
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}`);
|
||||
|
||||
Reference in New Issue
Block a user