mirror of
https://github.com/FranP-code/wintile.git
synced 2025-10-13 00:33:46 +00:00
Monitor for moving window
This commit is contained in:
18
extension.js
18
extension.js
@@ -11,6 +11,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
|
|||||||
const Me = ExtensionUtils.getCurrentExtension();
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
let onWindowGrabBegin, onWindowGrabEnd;
|
let onWindowGrabBegin, onWindowGrabEnd;
|
||||||
|
let windowMoving = false;
|
||||||
|
|
||||||
// View logs with `journalctl -qf |grep WinTile`
|
// View logs with `journalctl -qf |grep WinTile`
|
||||||
var _log = function(str) {
|
var _log = function(str) {
|
||||||
@@ -565,17 +566,32 @@ function requestMove(direction) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkForMove(curFrameBefore, app) {
|
||||||
|
_log('checkForMove')
|
||||||
|
if (windowMoving) {
|
||||||
|
Mainloop.timeout_add(10, function () {
|
||||||
|
var curFrameAfter = app.get_frame_rect();
|
||||||
|
if (curFrameBefore.x != curFrameAfter.x || curFrameBefore.y != curFrameBefore.y) {
|
||||||
|
restoreApp(app, false);
|
||||||
|
} else {
|
||||||
|
checkForMove(curFrameBefore, app);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function windowGrabBegin(meta_display, meta_screen, meta_window, meta_grab_op, gpointer) {
|
function windowGrabBegin(meta_display, meta_screen, meta_window, meta_grab_op, gpointer) {
|
||||||
_log('windowGrabBegin')
|
_log('windowGrabBegin')
|
||||||
|
windowMoving = true;
|
||||||
var app = global.display.focus_window;
|
var app = global.display.focus_window;
|
||||||
if (app.wintile) {
|
if (app.wintile) {
|
||||||
restoreApp(app, false);
|
checkForMove(app.get_frame_rect(), app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function windowGrabEnd(meta_display, meta_screen, meta_window, meta_grab_op, gpointer) {
|
function windowGrabEnd(meta_display, meta_screen, meta_window, meta_grab_op, gpointer) {
|
||||||
_log('windowGrabEnd')
|
_log('windowGrabEnd')
|
||||||
|
windowMoving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeBinding(settings, key, oldBinding, newBinding) {
|
function changeBinding(settings, key, oldBinding, newBinding) {
|
||||||
|
|||||||
Reference in New Issue
Block a user