From 4013fe84343b15cefdec9590b5a032d67b1a6b1a Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 29 Apr 2025 12:52:01 +1000 Subject: feat: bar workspace groups --- modules/bar/components/workspaces/Workspaces.qml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'modules/bar/components/workspaces/Workspaces.qml') diff --git a/modules/bar/components/workspaces/Workspaces.qml b/modules/bar/components/workspaces/Workspaces.qml index fbee318..51ae3da 100644 --- a/modules/bar/components/workspaces/Workspaces.qml +++ b/modules/bar/components/workspaces/Workspaces.qml @@ -8,15 +8,13 @@ Item { property alias vertical: layout.vertical readonly property color colour: Appearance.colours.mauve - property int shown: 10 - property bool occupiedBg: false - property bool showWindows: false readonly property list workspaces: layout.children.filter(c => c.isWorkspace) readonly property var occupied: Hyprland.workspaces.values.reduce((acc, curr) => { acc[curr.id] = curr.lastIpcObject.windows > 0; return acc; }, {}) + readonly property int groupOffset: Math.floor(((Hyprland.activeWorkspace?.id ?? 1) - 1) / BarConfig.workspaces.shown) * BarConfig.workspaces.shown implicitWidth: layout.implicitWidth implicitHeight: layout.implicitHeight @@ -24,7 +22,6 @@ Item { BoxLayout { id: layout - anchors.fill: parent homogenous: true spacing: 0 @@ -33,25 +30,18 @@ Item { Workspace { vertical: root.vertical - homogenous: true + homogenous: layout.homogenous occupied: root.occupied + groupOffset: root.groupOffset } } } OccupiedBg { - opacity: BarConfig.workspaces.occupiedBg ? 1 : 0 vertical: root.vertical workspaces: root.workspaces occupied: root.occupied - - Behavior on opacity { - NumberAnimation { - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.standard - } - } + groupOffset: root.groupOffset } ActiveIndicator { @@ -60,12 +50,13 @@ Item { mask: layout maskWidth: root.width maskHeight: root.height + groupOffset: root.groupOffset } MouseArea { anchors.fill: parent - onPressed: event => Hyprland.dispatch(`workspace ${layout.childAt(event.x, event.y).index + 1}`) + onPressed: event => Hyprland.dispatch(`workspace ${layout.childAt(event.x, event.y).index + root.groupOffset + 1}`) onWheel: event => { if (event.angleDelta.y < 0) Hyprland.dispatch(`workspace r+1`); -- cgit v1.2.3-freya