From 582fd49a6970d3c0d511a5d1d017b64f4900b2ad Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Thu, 1 May 2025 20:01:43 +1000 Subject: bar: optional active ws indicator --- config/BarConfig.qml | 1 + .../bar/components/workspaces/ActiveIndicator.qml | 3 --- modules/bar/components/workspaces/Workspace.qml | 2 +- modules/bar/components/workspaces/Workspaces.qml | 23 ++++++++++++++-------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/config/BarConfig.qml b/config/BarConfig.qml index 83186b6..f0899b4 100644 --- a/config/BarConfig.qml +++ b/config/BarConfig.qml @@ -28,6 +28,7 @@ Singleton { component Workspaces: QtObject { property int shown: root.vertical ? 5 : 10 property bool rounded: true + property bool activeIndicator: true property bool occupiedBg: false property bool showWindows: true property bool activeTrail: !showWindows // Doesn't work well with variable sized workspaces diff --git a/modules/bar/components/workspaces/ActiveIndicator.qml b/modules/bar/components/workspaces/ActiveIndicator.qml index 0d1768f..54f10fa 100644 --- a/modules/bar/components/workspaces/ActiveIndicator.qml +++ b/modules/bar/components/workspaces/ActiveIndicator.qml @@ -28,9 +28,6 @@ Rectangle { height: (vertical ? size : BarConfig.sizes.innerHeight) - 2 radius: BarConfig.workspaces.rounded ? Appearance.rounding.full : 0 - anchors.horizontalCenter: vertical ? parent.horizontalCenter : undefined - anchors.verticalCenter: vertical ? undefined : parent.verticalCenter - Rectangle { id: base diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml index 97c99b0..9edc8e4 100644 --- a/modules/bar/components/workspaces/Workspace.qml +++ b/modules/bar/components/workspaces/Workspace.qml @@ -34,7 +34,7 @@ Item { animate: true text: Hyprland.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label - color: BarConfig.workspaces.occupiedBg || root.isOccupied ? Appearance.colours.m3onSurface : Appearance.colours.m3outlineVariant + color: BarConfig.workspaces.occupiedBg || root.isOccupied || Hyprland.activeWsId === root.ws ? Appearance.colours.m3onSurface : Appearance.colours.m3outlineVariant horizontalAlignment: StyledText.AlignHCenter verticalAlignment: StyledText.AlignVCenter diff --git a/modules/bar/components/workspaces/Workspaces.qml b/modules/bar/components/workspaces/Workspaces.qml index e4ff787..1920ffc 100644 --- a/modules/bar/components/workspaces/Workspaces.qml +++ b/modules/bar/components/workspaces/Workspaces.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import "root:/widgets" import "root:/services" import "root:/config" @@ -50,14 +52,19 @@ Item { } } - ActiveIndicator { - color: root.colour - vertical: root.vertical - workspaces: root.workspaces - mask: layout - maskWidth: root.width - maskHeight: root.height - groupOffset: root.groupOffset + Loader { + active: BarConfig.workspaces.activeIndicator + asynchronous: true + + sourceComponent: ActiveIndicator { + color: root.colour + vertical: root.vertical + workspaces: root.workspaces + mask: layout + maskWidth: root.width + maskHeight: root.height + groupOffset: root.groupOffset + } } MouseArea { -- cgit v1.2.3-freya