Vertical bar: simpler management

This commit is contained in:
LemmyCook 2025-09-13 13:06:17 -04:00
parent b443c9f492
commit 101e3125a9
11 changed files with 25 additions and 139 deletions

View file

@ -15,9 +15,9 @@ Rectangle {
property ShellScreen screen
property real scaling: 1.0
property string barPosition: "top"
readonly property real itemSize: 24 * scaling
readonly property string barPosition: Settings.data.bar.position
function onLoaded() {
// When the widget is fully initialized with its props
@ -27,17 +27,6 @@ Rectangle {
}
}
// React to bar position changes
Connections {
target: BarService
function onBarPositionChanged(newPosition) {
root.barPosition = newPosition
// Force re-evaluation of implicitWidth and implicitHeight
root.implicitWidth = Qt.binding(() => (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (trayLayout.implicitWidth + Style.marginM * scaling * 2))
root.implicitHeight = Qt.binding(() => (barPosition === "left" || barPosition === "right") ? Math.round(trayLayout.implicitHeight + Style.marginM * scaling * 2) : Math.round(Style.capsuleHeight * scaling))
}
}
visible: SystemTray.items.values.length > 0
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (trayLayout.implicitWidth + Style.marginM * scaling * 2)
implicitHeight: (barPosition === "left" || barPosition === "right") ? Math.round(trayLayout.implicitHeight + Style.marginM * scaling * 2) : Math.round(Style.capsuleHeight * scaling)