From 53384f9eaf74d55967ae572a0bec9be4af6500dc Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sat, 19 Feb 2011 20:33:51 +0100 Subject: [PATCH] AutoMoveWindows: try harder to get an application for a window First of all, remove windows that are not interesting (like popup menus and tooltips). Then, queue once an idle if the app is null, in the hope that ShellWindowTracker picks up the window. --- extensions/auto-move-windows/extension.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js index 48afa758..ec966c24 100644 --- a/extensions/auto-move-windows/extension.js +++ b/extensions/auto-move-windows/extension.js @@ -32,10 +32,24 @@ WindowMover.prototype = { } }, - _findAndMove: function(display, window) { + _findAndMove: function(display, window, noRecurse) { + if (!this._windowTracker.is_window_interesting(window)) + return; + let spaces = this._settings.get_strv(SETTINGS_KEY); let app = this._windowTracker.get_window_app(window); + if (!app) { + if (!noRecurse) { + // window is not tracked yet + Mainloop.idle_add(Lang.bind(this, function() { + this._findAndMove(display, window, true); + return false; + })); + } else + log ('Cannot find application for window'); + return; + } let app_id = app.get_id(); for ( let j = 0 ; j < spaces.length; j++ ) { let apps_to_space = spaces[j].split(":");