Skip to content

Instantly share code, notes, and snippets.

@jhakonen
Created June 22, 2019 12:16
Show Gist options
  • Select an option

  • Save jhakonen/4a4f02fff920d4232e598c98f26916b8 to your computer and use it in GitHub Desktop.

Select an option

Save jhakonen/4a4f02fff920d4232e598c98f26916b8 to your computer and use it in GitHub Desktop.
Debug logging for "Put Windows" gnome extension
diff --git a/extension.js b/extension.js
index 485e604..f500894 100644
--- a/extension.js
+++ b/extension.js
@@ -481,58 +481,60 @@ MoveWindow.prototype = {
// no special handling for first time move
if (ignoreCornerSettings || !this._utils.changeCornerFirstTime()) {
// window was moved to an other corner
if ((!keepHeight && !keepWidth) && (!sameWidth || !sameHeight)) {
useWidth = 0;
useHeight = 0;
}
this._resize(win, widths[useWidth].x, heights[useHeight].y, widths[useWidth].width, heights[useHeight].height);
return;
}
// moveToCornerKeepSize returns true, if the window must be moved (not already in the given corner)
if (this._moveToCornerKeepSize(win, screenIndex, direction)) {
+ log('_moveToCorner :: moving to corner, keeping size');
return;
}
let x, y, width, height;
if (this._utils.changeCornerWidth()) {
x = widths[useWidth].x;
width = widths[useWidth].width;
} else {
width = pos.width;
if (direction.indexOf("w") == -1) {
x = s.x + (s.totalWidth - pos.width);
} else {
x = s.x;
}
}
if (this._utils.changeCornerHeight()) {
y = heights[useHeight].y;
height = heights[useHeight].height;
} else {
height = pos.height;
if (direction.indexOf("s") == -1) {
y = s.y;
} else {
y = (s.totalHeight - pos.height);
}
}
this._resize(win, x, y, width, height);
+ log(`_moveToCorner :: resize with: useWidth=${useWidth}, useHeight=${useHeight}`);
},
_moveToCornerKeepSize: function(win, screenIndex, direction) {
let s = this._screens[screenIndex];
let pos = win.get_frame_rect();
let x,y;
if (direction.indexOf("s") == -1) {
y = s.y;
} else {
y = s.y + (s.totalHeight - pos.height);
}
if (direction.indexOf("w") == -1) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment