From 5591950f1302c4a090820ee5adb1410aa44a6c4c Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:41:06 +0700 Subject: [PATCH] workspaces: fewer hooks; fix drawing --- .config/ags/widgets/bar/workspaces_hyprland.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.config/ags/widgets/bar/workspaces_hyprland.js b/.config/ags/widgets/bar/workspaces_hyprland.js index 87353da6..ae841ebe 100644 --- a/.config/ags/widgets/bar/workspaces_hyprland.js +++ b/.config/ags/widgets/bar/workspaces_hyprland.js @@ -35,21 +35,19 @@ const WorkspaceContents = (count = 10) => { // console.log('Mask:', workspaceMask.toString(2)); self.attribute.workspaceMask = workspaceMask; // self.attribute.initialized = true; + self.queue_draw(); }, toggleMask: (self, occupied, name) => { if (occupied) self.attribute.workspaceMask |= (1 << parseInt(name)); else self.attribute.workspaceMask &= ~(1 << parseInt(name)); + self.queue_draw(); }, }, setup: (area) => area .hook(Hyprland.active.workspace, (self) => { self.setCss(`font-size: ${(Hyprland.active.workspace.id - 1) % count + 1}px;`); - self.attribute.updateMask(self); - self.queue_draw(); }) .hook(Hyprland, (self) => self.attribute.updateMask(self), 'notify::workspaces') - .hook(Hyprland, (self, name) => self.attribute.toggleMask(self, true, name), 'workspace-added') - .hook(Hyprland, (self, name) => self.attribute.toggleMask(self, false, name), 'workspace-removed') .on('draw', Lang.bind(area, (area, cr) => { const offset = Math.floor((Hyprland.active.workspace.id - 1) / count) * NUM_OF_WORKSPACES_SHOWN;