overview: fix windows from other ws groups showing

This commit is contained in:
end-4
2024-02-21 23:14:35 +07:00
parent 2fde1dd96a
commit f7df2a2f85
@@ -272,11 +272,15 @@ export default () => {
fixed.attribute.put(WorkspaceNumber(offset + index), 0, 0); fixed.attribute.put(WorkspaceNumber(offset + index), 0, 0);
widget.clear = () => { widget.clear = () => {
const offset = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN) * NUM_OF_WORKSPACES_SHOWN; const offset = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN) * NUM_OF_WORKSPACES_SHOWN;
console.log('clearing ws with id', index, ' | shown:', offset + index)
clientMap.forEach((client, address) => { clientMap.forEach((client, address) => {
if (!client || client.ws !== offset + index) return; if (!client) return;
client.destroy(); if ((client.attribute.ws <= offset || client.attribute.ws > offset + NUM_OF_WORKSPACES_SHOWN) ||
client = null; (client.attribute.ws == offset + index)) {
clientMap.delete(address); client.destroy();
client = null;
clientMap.delete(address);
}
}); });
} }
widget.set = (clientJson, screenCoords) => { widget.set = (clientJson, screenCoords) => {
@@ -416,13 +420,13 @@ export default () => {
box.attribute.updateWorkspace(box, client.workspace.id); box.attribute.updateWorkspace(box, client.workspace.id);
}, 'client-added') }, 'client-added')
.hook(Hyprland.active.workspace, (box) => { .hook(Hyprland.active.workspace, (box) => {
// Full update when going to new ws group
const previousGroup = box.attribute.workspaceGroup; const previousGroup = box.attribute.workspaceGroup;
const currentGroup = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN); const currentGroup = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN);
if (currentGroup !== previousGroup) { if (currentGroup !== previousGroup) {
box.attribute.update(box); box.attribute.update(box);
workspaceGroup = currentGroup; box.attribute.workspaceGroup = currentGroup;
} }
// box.attribute.update(box);
}) })
.hook(App, (box, name, visible) => { // Update on open .hook(App, (box, name, visible) => { // Update on open
if (name == 'overview' && visible) box.attribute.update(box); if (name == 'overview' && visible) box.attribute.update(box);