summaryrefslogtreecommitdiff
path: root/modules/bar
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-24 13:31:36 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-24 13:31:36 +0800
commit01b38be6afbe660e3b9f9e136870a76afb69bf31 (patch)
treea18c46b9d8fb0261addeadb89ca2a8ebd22f0ccc /modules/bar
parentdashboard: default weather (diff)
downloadcaelestia-shell-01b38be6afbe660e3b9f9e136870a76afb69bf31.tar.gz
caelestia-shell-01b38be6afbe660e3b9f9e136870a76afb69bf31.tar.bz2
caelestia-shell-01b38be6afbe660e3b9f9e136870a76afb69bf31.zip
internal: fix binding loops
Diffstat (limited to 'modules/bar')
-rw-r--r--modules/bar/components/ActiveWindow.qml6
-rw-r--r--modules/bar/components/Clock.qml8
-rw-r--r--modules/bar/components/StatusIcons.qml9
-rw-r--r--modules/bar/components/Tray.qml8
4 files changed, 27 insertions, 4 deletions
diff --git a/modules/bar/components/ActiveWindow.qml b/modules/bar/components/ActiveWindow.qml
index 75dfc43..b2b9572 100644
--- a/modules/bar/components/ActiveWindow.qml
+++ b/modules/bar/components/ActiveWindow.qml
@@ -15,12 +15,16 @@ Item {
implicitWidth: child.implicitWidth
implicitHeight: child.implicitHeight
- StyledRect {
+ Item {
id: child
+ readonly property bool vertical: root.vertical
+
anchors.centerIn: parent
clip: true
+ implicitWidth: root.vertical ? Math.max(icon.implicitWidth, text.implicitHeight) : icon.implicitWidth + text.implicitWidth + text.anchors.leftMargin
+ implicitHeight: root.vertical ? icon.implicitHeight + text.implicitWidth + text.anchors.topMargin : Math.max(icon.implicitHeight, text.implicitheight)
MaterialIcon {
id: icon
diff --git a/modules/bar/components/Clock.qml b/modules/bar/components/Clock.qml
index 3397222..bec7e30 100644
--- a/modules/bar/components/Clock.qml
+++ b/modules/bar/components/Clock.qml
@@ -3,11 +3,15 @@ import "root:/services"
import "root:/config"
import QtQuick
-StyledRect {
+Item {
id: root
+ readonly property bool vertical: parent?.vertical ?? false
property color colour: Colours.palette.peach
+ implicitWidth: vertical ? Math.max(icon.implicitWidth, text.implicitWidth) : icon.implicitWidth + text.implicitWidth + text.anchors.leftMargin
+ implicitHeight: vertical ? icon.implicitHeight + text.implicitHeight + text.anchors.topMargin : Math.max(icon.implicitHeight, text.implicitHeight)
+
MaterialIcon {
id: icon
@@ -18,6 +22,8 @@ StyledRect {
}
AnchorText {
+ id: text
+
prevAnchor: icon
horizontalAlignment: StyledText.AlignHCenter
diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml
index 62823e0..14c02f9 100644
--- a/modules/bar/components/StatusIcons.qml
+++ b/modules/bar/components/StatusIcons.qml
@@ -5,12 +5,15 @@ import "root:/config"
import Quickshell
import QtQuick
-StyledRect {
+Item {
id: root
+ readonly property bool vertical: parent?.vertical ?? false
property color colour: Colours.palette.rosewater
clip: true
+ implicitWidth: vertical ? Math.max(network.implicitWidth, bluetooth.implicitWidth, devices.implicitWidth) : network.implicitWidth + bluetooth.implicitWidth + bluetooth.anchors.leftMargin + (repeater.count > 0 ? devices.implicitWidth + devices.anchors.leftMargin : 0)
+ implicitHeight: vertical ? network.implicitHeight + bluetooth.implicitHeight + bluetooth.anchors.topMargin + (repeater.count > 0 ? devices.implicitHeight + devices.anchors.topMargin : 0) : Math.max(network.implicitHeight, bluetooth.implicitHeight, devices.implicitHeight)
MaterialIcon {
id: network
@@ -35,6 +38,8 @@ StyledRect {
}
Box {
+ id: devices
+
anchors.left: vertical ? undefined : bluetooth.right
anchors.leftMargin: vertical ? 0 : Appearance.padding.smaller
anchors.top: vertical ? bluetooth.bottom : undefined
@@ -44,6 +49,8 @@ StyledRect {
anchors.verticalCenter: vertical ? undefined : bluetooth.verticalCenter
Repeater {
+ id: repeater
+
model: ScriptModel {
values: Bluetooth.devices.filter(d => d.connected)
}
diff --git a/modules/bar/components/Tray.qml b/modules/bar/components/Tray.qml
index ccebe1f..8ccd48a 100644
--- a/modules/bar/components/Tray.qml
+++ b/modules/bar/components/Tray.qml
@@ -4,15 +4,21 @@ import "root:/config"
import Quickshell.Services.SystemTray
import QtQuick
-StyledRect {
+Item {
id: root
+ readonly property bool vertical: parent?.vertical ?? false
property color colour: Colours.palette.lavender
clip: true
visible: width > 0 && height > 0 // To avoid warnings about being visible with no size
+ implicitWidth: layout.implicitWidth
+ implicitHeight: layout.implicitHeight
+
BoxLayout {
+ id: layout
+
Repeater {
model: SystemTray.items