From 894fc9bfe6889539ab5a52a4b72474236cbc4bd6 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Thu, 1 May 2025 17:01:28 +1000 Subject: bar: use loaders Use loaders for all optional components e.g. workspace windows and occupied background Fix bar preset loader usage Fix occupied group Change text on active ws colour Tray no extension for paths (use qt auto resolution) --- modules/bar/components/workspaces/Workspace.qml | 42 +++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'modules/bar/components/workspaces/Workspace.qml') diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml index bd28f7a..a29e61b 100644 --- a/modules/bar/components/workspaces/Workspace.qml +++ b/modules/bar/components/workspaces/Workspace.qml @@ -16,14 +16,14 @@ Item { readonly property bool isWorkspace: true // Flag for finding workspace children // Unanimated prop for others to use as reference - readonly property real size: childrenRect[vertical ? "height" : "width"] + (shouldPad ? Appearance.padding.normal : 0) + readonly property real size: childrenRect[vertical ? "height" : "width"] + (hasWindows ? Appearance.padding.normal : 0) readonly property int ws: groupOffset + index + 1 readonly property bool isOccupied: occupied[ws] ?? false - readonly property bool shouldPad: isOccupied && BarConfig.workspaces.showWindows + readonly property bool hasWindows: isOccupied && BarConfig.workspaces.showWindows - Layout.preferredWidth: childrenRect.width + (shouldPad && !vertical ? Appearance.padding.normal : 0) - Layout.preferredHeight: childrenRect.height + (shouldPad && vertical ? Appearance.padding.normal : 0) + Layout.preferredWidth: childrenRect.width + (hasWindows && !vertical ? Appearance.padding.normal : 0) + Layout.preferredHeight: childrenRect.height + (hasWindows && vertical ? Appearance.padding.normal : 0) StyledText { id: indicator @@ -42,22 +42,30 @@ Item { height: BarConfig.sizes.innerHeight } - Box { - anchors.left: vertical ? undefined : indicator.right - anchors.top: vertical ? indicator.bottom : undefined - anchors.verticalCenter: vertical ? undefined : indicator.verticalCenter - anchors.horizontalCenter: vertical ? indicator.horizontalCenter : undefined + Loader { + active: BarConfig.workspaces.showWindows + asynchronous: true - Repeater { - model: ScriptModel { - values: BarConfig.workspaces.showWindows ? Hyprland.clients.filter(c => c.workspace?.id === root.ws) : [] - } + anchors.left: root.vertical ? undefined : indicator.right + anchors.top: root.vertical ? indicator.bottom : undefined + anchors.verticalCenter: root.vertical ? undefined : indicator.verticalCenter + anchors.horizontalCenter: root.vertical ? indicator.horizontalCenter : undefined + + sourceComponent: Box { + anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined + anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter + + Repeater { + model: ScriptModel { + values: Hyprland.clients.filter(c => c.workspace?.id === root.ws) + } - MaterialIcon { - required property Hyprland.Client modelData + MaterialIcon { + required property Hyprland.Client modelData - text: Icons.getAppCategoryIcon(modelData.wmClass, "terminal") - color: Appearance.colours.m3onSurfaceVariant + text: Icons.getAppCategoryIcon(modelData.wmClass, "terminal") + color: Appearance.colours.m3onSurfaceVariant + } } } } -- cgit v1.2.3-freya