diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-29 12:07:44 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-29 12:07:44 +1000 |
| commit | 82139e9c2d04bae0d40fa5702751d6bf7edfce05 (patch) | |
| tree | 24e325f64accb6e9927fe6d2cb3035f04e5d3ad9 /modules | |
| parent | refactor: bar clock use anchors (diff) | |
| download | caelestia-shell-82139e9c2d04bae0d40fa5702751d6bf7edfce05.tar.gz caelestia-shell-82139e9c2d04bae0d40fa5702751d6bf7edfce05.tar.bz2 caelestia-shell-82139e9c2d04bae0d40fa5702751d6bf7edfce05.zip | |
refactor: workspaces use inner bar height
Also simplify boxpadding
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/bar/components/workspaces/OccupiedBg.qml | 6 | ||||
| -rw-r--r-- | modules/bar/components/workspaces/Workspace.qml | 6 | ||||
| -rw-r--r-- | modules/bar/components/workspaces/Workspaces.qml | 24 |
3 files changed, 15 insertions, 21 deletions
diff --git a/modules/bar/components/workspaces/OccupiedBg.qml b/modules/bar/components/workspaces/OccupiedBg.qml index f6998c5..7ffd436 100644 --- a/modules/bar/components/workspaces/OccupiedBg.qml +++ b/modules/bar/components/workspaces/OccupiedBg.qml @@ -1,9 +1,7 @@ import "root:/widgets" -import "root:/services" import "root:/config" import QtQuick import QtQuick.Layouts -import Qt5Compat.GraphicalEffects BoxLayout { id: root @@ -33,8 +31,8 @@ BoxLayout { bottomRightRadius: roundRight // Ugh stupid size errors on reload - Layout.preferredWidth: root.vertical ? layout.width : root.workspaces[index]?.width ?? 1 - Layout.preferredHeight: root.vertical ? root.workspaces[index]?.height ?? 1 : layout.height + Layout.preferredWidth: root.vertical ? BarConfig.sizes.innerHeight : root.workspaces[index]?.width ?? 1 + Layout.preferredHeight: root.vertical ? root.workspaces[index]?.height ?? 1 : BarConfig.sizes.innerHeight Behavior on opacity { NumberAnimation { diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml index d8d0f4d..e404c83 100644 --- a/modules/bar/components/workspaces/Workspace.qml +++ b/modules/bar/components/workspaces/Workspace.qml @@ -7,12 +7,12 @@ StyledText { required property int index required property BoxLayout layout required property var occupied - readonly property bool isWorkspace: true + readonly property bool isWorkspace: true // Flag for finding workspace children text: index + 1 color: BarConfig.workspaces.occupiedBg || occupied[index + 1] ? Appearance.colours.text : Appearance.colours.subtext0 horizontalAlignment: StyledText.AlignHCenter - Layout.preferredWidth: layout.homogenous && !layout.vertical ? layout.height : -1 - Layout.preferredHeight: layout.homogenous && layout.vertical ? layout.width : -1 + Layout.preferredWidth: layout.homogenous && !layout.vertical ? BarConfig.sizes.innerHeight : -1 + Layout.preferredHeight: layout.homogenous && layout.vertical ? BarConfig.sizes.innerHeight : -1 } diff --git a/modules/bar/components/workspaces/Workspaces.qml b/modules/bar/components/workspaces/Workspaces.qml index 26dc23a..b95497c 100644 --- a/modules/bar/components/workspaces/Workspaces.qml +++ b/modules/bar/components/workspaces/Workspaces.qml @@ -28,8 +28,7 @@ Item { BoxLayout { id: layout - padding: vertical ? [0, Appearance.padding.smaller / 2] : [Appearance.padding.smaller / 2, 0] - anchors.centerIn: parent + anchors.fill: parent homogenous: true spacing: 0 @@ -72,8 +71,8 @@ Item { Rectangle { id: active - property int currentIdx: 0 - property int lastIdx: 0 + property int currentIdx: (Hyprland.activeWorkspace?.id ?? 1) - 1 + property int lastIdx: currentIdx property real leading: root.workspaces[currentIdx][root.vertical ? "y" : "x"] property real trailing: root.workspaces[lastIdx][root.vertical ? "y" : "x"] property real currentSize: root.workspaces[currentIdx][root.vertical ? "height" : "width"] @@ -83,19 +82,13 @@ Item { clip: true x: root.vertical ? 0 : offset y: root.vertical ? offset : 0 - width: root.vertical ? layout.width : size - height: root.vertical ? size : layout.height + width: root.vertical ? BarConfig.sizes.innerHeight : size + height: root.vertical ? size : BarConfig.sizes.innerHeight color: Appearance.colours.mauve radius: Appearance.rounding.full - Connections { - target: Hyprland - - function onActiveWorkspaceChanged() { - active.currentIdx = (Hyprland.activeWorkspace?.id ?? 1) - 1; - active.lastIdx = active.currentIdx; - } - } + anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined + anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter Rectangle { id: base @@ -113,6 +106,9 @@ Item { y: root.vertical ? -parent.offset : 0 width: root.width height: root.height + + anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined + anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter } Behavior on leading { |