forked from Shinonome/dots-hyprland
Fix workspace panel in bar not updating when directly moving to occupied workspace in the next group (#247)
This commit is contained in:
@@ -21,6 +21,7 @@ const WorkspaceContents = (count = 10) => {
|
|||||||
attribute: {
|
attribute: {
|
||||||
initialized: false,
|
initialized: false,
|
||||||
workspaceMask: 0,
|
workspaceMask: 0,
|
||||||
|
workspaceGroup: 0,
|
||||||
updateMask: (self) => {
|
updateMask: (self) => {
|
||||||
const offset = Math.floor((Hyprland.active.workspace.id - 1) / count) * NUM_OF_WORKSPACES_SHOWN;
|
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
|
// if (self.attribute.initialized) return; // We only need this to run once
|
||||||
@@ -46,6 +47,12 @@ const WorkspaceContents = (count = 10) => {
|
|||||||
setup: (area) => area
|
setup: (area) => area
|
||||||
.hook(Hyprland.active.workspace, (self) => {
|
.hook(Hyprland.active.workspace, (self) => {
|
||||||
self.setCss(`font-size: ${(Hyprland.active.workspace.id - 1) % count + 1}px;`);
|
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')
|
.hook(Hyprland, (self) => self.attribute.updateMask(self), 'notify::workspaces')
|
||||||
.on('draw', Lang.bind(area, (area, cr) => {
|
.on('draw', Lang.bind(area, (area, cr) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user