@@ 211,8 211,33 @@ class WindowManager {
}
this.activeWorkspace = this.workspaces.get(newWorkspace);
this.computeAndPosition();
+ }
+
+ windowChangedWorkspace(win) {
+ log('Window changed workspace')
+
+ let currentWorkspace = this.activeWorkspace;
+ let newWorkspace = win.get_workspace().index();
+
+ if (!this.workspaces.has(newWorkspace)) {
+ this.workspaces.set(newWorkspace, new Workspace(newWorkspace));
}
+
+ // TODO: this is a dirty workaround
+ // we have to do this, because the delete event somehow only gets called on the first workspace
+ // and not on the others, so we have to do this manually
+ if (currentWorkspace.workspaceIndex >= 1) {
+ this.windowDestroyed(null, win);
+ }
+
+ // TODO: this is a dirty workaround
+ // we can't add windows to workspaces,
+ // other than the active one, directly, so we change the
+ // active workspace under the hood and switching back, after adding
this.activeWorkspace = this.workspaces.get(newWorkspace);
+ this.windowCreated(null, win);
+
+ this.activeWorkspace = currentWorkspace;
this.computeAndPosition();
}
@@ 232,6 257,9 @@ class WindowManager {
this.computeAndPosition();
act.disconnect(id);
});
+
+ // TODO: clean this up and disconnect
+ const winWorkspaceChangeHandler = window.win.connect('workspace-changed', this.windowChangedWorkspace.bind(this));
// this.computeAndPosition();
}