diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-25 16:56:07 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-25 16:56:07 +1000 |
| commit | e79895b8f2c2b071e1af889247c3dd26a314aad9 (patch) | |
| tree | 680175518f8fbac9fee585731096f149fd58b8e1 /modules/lock | |
| parent | lock: increase large screen size (diff) | |
| download | caelestia-shell-e79895b8f2c2b071e1af889247c3dd26a314aad9.tar.gz caelestia-shell-e79895b8f2c2b071e1af889247c3dd26a314aad9.tar.bz2 caelestia-shell-e79895b8f2c2b071e1af889247c3dd26a314aad9.zip | |
lock: completely hide media if screen too small
Diffstat (limited to 'modules/lock')
| -rw-r--r-- | modules/lock/Backgrounds.qml | 3 | ||||
| -rw-r--r-- | modules/lock/LockSurface.qml | 66 |
2 files changed, 39 insertions, 30 deletions
diff --git a/modules/lock/Backgrounds.qml b/modules/lock/Backgrounds.qml index 2b08ab1..3ac4999 100644 --- a/modules/lock/Backgrounds.qml +++ b/modules/lock/Backgrounds.qml @@ -10,6 +10,7 @@ Item { required property bool locked required property real weatherWidth + required property bool isNormal required property bool isLarge readonly property real clockBottom: innerMask.anchors.margins + clockPath.height @@ -277,7 +278,7 @@ Item { readonly property real roundingY: height < rounding * 2 ? height / 2 : rounding strokeWidth: -1 - fillColor: Config.border.colour + fillColor: root.isNormal ? Config.border.colour : "transparent" startX: root.isLarge ? 0 : Math.ceil(innerMask.width) startY: root.isLarge ? height + roundingY : Math.ceil(innerMask.height) - height - roundingY diff --git a/modules/lock/LockSurface.qml b/modules/lock/LockSurface.qml index 423d29d..084c275 100644 --- a/modules/lock/LockSurface.qml +++ b/modules/lock/LockSurface.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import "root:/widgets" import "root:/services" import "root:/config" @@ -71,6 +73,7 @@ WlSessionLockSurface { locked: root.locked weatherWidth: weather.implicitWidth + isNormal: root.screen.width > Config.lock.sizes.smallScreenWidth isLarge: root.screen.width > Config.lock.sizes.largeScreenWidth visible: false } @@ -108,42 +111,47 @@ WlSessionLockSurface { anchors.rightMargin: -backgrounds.weatherRight } - MediaPlaying { - id: media + Loader { + active: root.screen.width > Config.lock.sizes.smallScreenWidth + asynchronous: true - isLarge: root.screen.width > Config.lock.sizes.largeScreenWidth + sourceComponent: MediaPlaying { + id: media - state: isLarge ? "tl" : "br" - states: [ - State { - name: "tl" + isLarge: root.screen.width > Config.lock.sizes.largeScreenWidth - AnchorChanges { - target: media - anchors.bottom: media.parent.top - anchors.right: media.parent.left - } + state: isLarge ? "tl" : "br" + states: [ + State { + name: "tl" - PropertyChanges { - media.anchors.bottomMargin: -backgrounds.mediaY - media.anchors.rightMargin: -backgrounds.mediaX - } - }, - State { - name: "br" + AnchorChanges { + target: media + anchors.bottom: media.parent.top + anchors.right: media.parent.left + } - AnchorChanges { - target: media - anchors.top: media.parent.bottom - anchors.left: media.parent.right - } + PropertyChanges { + media.anchors.bottomMargin: -backgrounds.mediaY + media.anchors.rightMargin: -backgrounds.mediaX + } + }, + State { + name: "br" + + AnchorChanges { + target: media + anchors.top: media.parent.bottom + anchors.left: media.parent.right + } - PropertyChanges { - media.anchors.topMargin: -backgrounds.mediaY - media.anchors.leftMargin: -backgrounds.mediaX + PropertyChanges { + media.anchors.topMargin: -backgrounds.mediaY + media.anchors.leftMargin: -backgrounds.mediaX + } } - } - ] + ] + } } component Anim: NumberAnimation { |