From 0443a39009f28a53dbc4b9e65058ddd1c1bb5adb Mon Sep 17 00:00:00 2001 From: midn8hustlr <4visekh@gmail.com> Date: Thu, 8 Feb 2024 09:58:07 +0530 Subject: [PATCH] Fix workspace panel in bar not updating when moving to occupied workspace directly in the next group --- .config/ags/widgets/bar/workspaces_hyprland.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.config/ags/widgets/bar/workspaces_hyprland.js b/.config/ags/widgets/bar/workspaces_hyprland.js index ae841ebe1..41887c5f8 100644 --- a/.config/ags/widgets/bar/workspaces_hyprland.js +++ b/.config/ags/widgets/bar/workspaces_hyprland.js @@ -21,6 +21,7 @@ const WorkspaceContents = (count = 10) => { attribute: { initialized: false, workspaceMask: 0, + workspaceGroup: 0, updateMask: (self) => { const offset = Math.floor((Hyprland.active.workspace.id - 1) / count) * NUM_OF_WORKSPACES_SHOWN; // if (self.attribute.initialized) return; // We only need this to run once @@ -46,6 +47,12 @@ const WorkspaceContents = (count = 10) => { setup: (area) => area .hook(Hyprland.active.workspace, (self) => { self.setCss(`font-size: ${(Hyprland.active.workspace.id - 1) % count + 1}px;`); + const previousGroup = self.attribute.workspaceGroup; + const currentGroup = Math.floor((Hyprland.active.workspace.id - 1) / count); + if (currentGroup !== previousGroup) { + self.attribute.updateMask(self); + self.attribute.workspaceGroup = currentGroup; + } }) .hook(Hyprland, (self) => self.attribute.updateMask(self), 'notify::workspaces') .on('draw', Lang.bind(area, (area, cr) => {