Update selectedWindow when a window in a inactive WS is closed/moved

This commit is contained in:
Ole Jørgen Brønner
2017-09-23 11:29:01 +02:00
parent ac62fa75ae
commit 0d1fc33d98
+14
View File
@@ -431,6 +431,20 @@ remove_handler = (workspace, meta_window) => {
delete meta_window[focus_signal];
}
if (space.selectedWindow === meta_window) {
// Window closed or moved when other workspace is active so no new focus
// has been assigned in this workspace.
// Ideally we'd get the window that will get focus when this workspace
// is activated again, but the function mutter use doesn't seem to be
// exposed to javascript.
// Use the top window in the MRU list as a proxy:
let mru_list = global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
// The mru list might contain needy windows from other workspaces
space.selectedWindow =
mru_list.filter(w => w.get_workspace() === workspace)[0];
}
// Force a new ensure, since the focus_handler is run before window-removed
ensure_viewport(space.selectedWindow, true)
}