From f7df2a2f85c4f523c7d8ecefaf27ab20378aef63 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:14:35 +0700 Subject: [PATCH] overview: fix windows from other ws groups showing --- .../ags/modules/overview/overview_hyprland.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.config/ags/modules/overview/overview_hyprland.js b/.config/ags/modules/overview/overview_hyprland.js index 68688927..812f23fc 100644 --- a/.config/ags/modules/overview/overview_hyprland.js +++ b/.config/ags/modules/overview/overview_hyprland.js @@ -272,11 +272,15 @@ export default () => { fixed.attribute.put(WorkspaceNumber(offset + index), 0, 0); widget.clear = () => { 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) => { - if (!client || client.ws !== offset + index) return; - client.destroy(); - client = null; - clientMap.delete(address); + if (!client) return; + if ((client.attribute.ws <= offset || client.attribute.ws > offset + NUM_OF_WORKSPACES_SHOWN) || + (client.attribute.ws == offset + index)) { + client.destroy(); + client = null; + clientMap.delete(address); + } }); } widget.set = (clientJson, screenCoords) => { @@ -416,13 +420,13 @@ export default () => { box.attribute.updateWorkspace(box, client.workspace.id); }, 'client-added') .hook(Hyprland.active.workspace, (box) => { + // Full update when going to new ws group const previousGroup = box.attribute.workspaceGroup; const currentGroup = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN); if (currentGroup !== previousGroup) { box.attribute.update(box); - workspaceGroup = currentGroup; + box.attribute.workspaceGroup = currentGroup; } - // box.attribute.update(box); }) .hook(App, (box, name, visible) => { // Update on open if (name == 'overview' && visible) box.attribute.update(box);