diff options
Diffstat (limited to 'modules/bar/components')
4 files changed, 18 insertions, 5 deletions
diff --git a/modules/bar/components/workspaces/ActiveIndicator.qml b/modules/bar/components/workspaces/ActiveIndicator.qml index 99d6275..fe5a3d0 100644 --- a/modules/bar/components/workspaces/ActiveIndicator.qml +++ b/modules/bar/components/workspaces/ActiveIndicator.qml @@ -11,7 +11,12 @@ StyledRect { required property Repeater workspaces required property Item mask - readonly property int currentWsIdx: (activeWsId - 1) % Config.bar.workspaces.shown + readonly property int currentWsIdx: { + let i = activeWsId - 1; + while (i < 0) + i += Config.bar.workspaces.shown; + return i % Config.bar.workspaces.shown; + } property real leading: workspaces.itemAt(currentWsIdx)?.y ?? 0 property real trailing: workspaces.itemAt(currentWsIdx)?.y ?? 0 diff --git a/modules/bar/components/workspaces/OccupiedBg.qml b/modules/bar/components/workspaces/OccupiedBg.qml index 37fe4c1..5e1c966 100644 --- a/modules/bar/components/workspaces/OccupiedBg.qml +++ b/modules/bar/components/workspaces/OccupiedBg.qml @@ -48,8 +48,15 @@ Item { required property var modelData - readonly property Workspace start: root.workspaces.itemAt((modelData.start - 1) % Config.bar.workspaces.shown) ?? null - readonly property Workspace end: root.workspaces.itemAt((modelData.end - 1) % Config.bar.workspaces.shown) ?? null + readonly property Workspace start: root.workspaces.itemAt(getWsIdx(modelData.start)) ?? null + readonly property Workspace end: root.workspaces.itemAt(getWsIdx(modelData.end)) ?? null + + function getWsIdx(ws: int): int { + let i = ws - 1; + while (i < 0) + i += Config.bar.workspaces.shown; + return i % Config.bar.workspaces.shown; + } anchors.horizontalCenter: root.horizontalCenter diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml index 8124024..612edb7 100644 --- a/modules/bar/components/workspaces/Workspace.qml +++ b/modules/bar/components/workspaces/Workspace.qml @@ -35,7 +35,8 @@ ColumnLayout { animate: true text: { - const label = Config.bar.workspaces.label || root.ws; + const ws = Hypr.workspaces.values.find(w => w.id === root.ws); + const label = Config.bar.workspaces.label || (!ws || ws.name == root.ws ? root.ws : ws.name[0].toUpperCase()); const occupiedLabel = Config.bar.workspaces.occupiedLabel || label; const activeLabel = Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label); return root.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label; diff --git a/modules/bar/components/workspaces/Workspaces.qml b/modules/bar/components/workspaces/Workspaces.qml index c9a90e8..192d297 100644 --- a/modules/bar/components/workspaces/Workspaces.qml +++ b/modules/bar/components/workspaces/Workspaces.qml @@ -90,7 +90,7 @@ StyledClippingRect { MouseArea { anchors.fill: layout onClicked: event => { - const ws = layout.childAt(event.x, event.y).index + root.groupOffset + 1; + const ws = layout.childAt(event.x, event.y).ws; if (Hypr.activeWsId !== ws) Hypr.dispatch(`workspace ${ws}`); else |