diff --git a/modules/lock/Center.qml b/modules/lock/Center.qml index bfd747de2..c443a8d9f 100644 --- a/modules/lock/Center.qml +++ b/modules/lock/Center.qml @@ -9,7 +9,9 @@ ColumnLayout { id: root required property var lock - readonly property real centerScale: Math.min(1, (lock.screen?.height ?? 1440) / 1440) + required property real lockHeight + + readonly property real centerScale: Math.min(1, root.lockHeight / 1440) readonly property int centerWidth: Tokens.sizes.lock.centerWidth * centerScale Layout.preferredWidth: centerWidth diff --git a/modules/lock/Content.qml b/modules/lock/Content.qml index 0d47502ae..9850a7edb 100644 --- a/modules/lock/Content.qml +++ b/modules/lock/Content.qml @@ -4,25 +4,61 @@ import Caelestia.Config import qs.components import qs.services -RowLayout { +Item { id: root required property var lock + required property bool isPortrait + required property real lockHeight - spacing: Tokens.spacing.largeIncreased * 2 - + // Portrait layout ColumnLayout { - Layout.fillWidth: true + anchors.fill: parent + visible: root.isPortrait spacing: Tokens.spacing.medium - WeatherInfo { + RowLayout { Layout.fillWidth: true - rootHeight: root.height + spacing: Tokens.spacing.largeIncreased + + WeatherInfo { + Layout.fillWidth: true + rootHeight: root.height / Tokens.sizes.lock.ratio + } + + Resources { + Layout.fillWidth: true + } } - Fetch { + Center { + Layout.alignment: Qt.AlignHCenter + lock: root.lock + lockHeight: root.lockHeight + } + + RowLayout { Layout.fillWidth: true - rootHeight: root.height + + spacing: Tokens.spacing.largeIncreased + + Fetch { + Layout.fillWidth: true + rootHeight: root.height + } + + StyledRect { + Layout.fillWidth: true + Layout.fillHeight: true + + bottomRightRadius: Tokens.rounding.extraLarge + radius: Tokens.rounding.medium + color: Colours.tPalette.m3surfaceContainer + + NotifDock { + lock: root.lock + } + } } Media { @@ -32,28 +68,58 @@ RowLayout { } } - Center { - lock: root.lock - } + // Landscape layout + RowLayout { + anchors.fill: parent + visible: !root.isPortrait + spacing: Tokens.spacing.largeIncreased * 2 - ColumnLayout { - Layout.fillWidth: true - spacing: Tokens.spacing.medium - - Resources { + ColumnLayout { Layout.fillWidth: true + spacing: Tokens.spacing.medium + + WeatherInfo { + Layout.fillWidth: true + rootHeight: root.height + } + + Fetch { + Layout.fillWidth: true + rootHeight: root.height + } + + Media { + Layout.fillWidth: true + Layout.fillHeight: true + + lock: root.lock + } } - StyledRect { + Center { + lock: root.lock + lockHeight: root.lockHeight + } + + ColumnLayout { Layout.fillWidth: true - Layout.fillHeight: true + spacing: Tokens.spacing.medium - bottomRightRadius: Tokens.rounding.extraLarge - radius: Tokens.rounding.medium - color: Colours.tPalette.m3surfaceContainer + Resources { + Layout.fillWidth: true + } - NotifDock { - lock: root.lock + StyledRect { + Layout.fillWidth: true + Layout.fillHeight: true + + bottomRightRadius: Tokens.rounding.extraLarge + radius: Tokens.rounding.medium + color: Colours.tPalette.m3surfaceContainer + + NotifDock { + lock: root.lock + } } } } diff --git a/modules/lock/LockSurface.qml b/modules/lock/LockSurface.qml index 2c97248d6..05b3c903f 100644 --- a/modules/lock/LockSurface.qml +++ b/modules/lock/LockSurface.qml @@ -14,6 +14,8 @@ WlSessionLockSurface { required property Pam pam readonly property alias unlocking: unlockAnim.running + readonly property real lockHeight: Math.min(root.screen?.width ?? 0, root.screen?.height ?? 0) + readonly property bool isPortrait: (root.screen?.width ?? 0) < (root.screen?.height ?? 0) contentItem.Config.screen: screen.name contentItem.Tokens.screen: screen.name @@ -143,12 +145,12 @@ WlSessionLockSurface { Anim { target: lockContent property: "implicitWidth" - to: (root.screen?.height ?? 0) * lockContent.Tokens.sizes.lock.heightMult * lockContent.Tokens.sizes.lock.ratio + to: root.isPortrait ? lockContent.lockShort : lockContent.lockLong } Anim { target: lockContent property: "implicitHeight" - to: (root.screen?.height ?? 0) * lockContent.Tokens.sizes.lock.heightMult + to: root.isPortrait ? lockContent.lockLong : lockContent.lockShort } } } @@ -177,6 +179,11 @@ WlSessionLockSurface { readonly property int size: lockIcon.implicitHeight + Tokens.padding.large * 4 readonly property int radius: size / 4 * Tokens.rounding.scale + // Long/short axis of the lock surface relative to the monitor's short edge. + // Portrait swaps which axis maps to width/height. + readonly property real lockLong: root.lockHeight * Tokens.sizes.lock.heightMult * Tokens.sizes.lock.ratio + readonly property real lockShort: root.lockHeight * Tokens.sizes.lock.heightMult + anchors.centerIn: parent implicitWidth: size implicitHeight: size @@ -212,9 +219,12 @@ WlSessionLockSurface { Content { id: content + isPortrait: root.isPortrait + lockHeight: root.lockHeight + anchors.centerIn: parent - width: (root.screen?.height ?? 0) * Tokens.sizes.lock.heightMult * Tokens.sizes.lock.ratio - Tokens.padding.extraLargeIncreased - height: (root.screen?.height ?? 0) * Tokens.sizes.lock.heightMult - Tokens.padding.extraLargeIncreased + width: (root.isPortrait ? lockContent.lockShort : lockContent.lockLong) - Tokens.padding.extraLargeIncreased + height: (root.isPortrait ? lockContent.lockLong : lockContent.lockShort) - Tokens.padding.extraLargeIncreased lock: root opacity: 0