Track already created windows

This commit is contained in:
2023-05-11 17:15:29 +09:00
parent 8db7d58431
commit d0ada7f04e
2 changed files with 15 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ var Layout = GObject.registerClass(
// */
// this._monitorsTags = new Map();
// TODO: duplicate this layout for each monitors.
this._layout = {
type: "tiled",
nmaster: 1,
@@ -48,7 +49,6 @@ var Layout = GObject.registerClass(
const window = this.windows.find((x) => x.actor === actor);
if (!window) return null;
this.windows = this.windows.filter((x) => x !== window);
console.log("Popped", this.windows.length);
return window;
}

View File

@@ -24,8 +24,9 @@ var WindowManager = GObject.registerClass(
enable() {
this._bindSignals();
// TODO: Add all existing windows to the layout and render.
// this.render();
for (const window of global.display.list_all_windows())
this.trackWindow(window);
this.renderAll();
}
// Stolen from https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/183
@@ -109,6 +110,17 @@ var WindowManager = GObject.registerClass(
this._layout.newWindow(window);
}
renderAll() {
const monN = global.display.get_n_monitors();
// TODO: Support different tags on different monitors.
const tags = global.display
.get_workspace_manager()
.get_active_workspace_index() + 1;
for (let mon = 0; mon < monN; mon++) {
this.render(mon, tags);
}
}
renderForWindow(window) {
const mon = window.get_monitor();
// TODO: The on_all_workspaces handling is faulty.