From 1edfc40c6e1a2da74d39795cd859b29955e86eb8 Mon Sep 17 00:00:00 2001 From: chlorospingus Date: Thu, 16 Jul 2026 18:35:34 -0700 Subject: [PATCH] Add lock screen background --- .gitignore | 1 + Corners.qml | 12 ++++++------ Lock.qml | 49 +++++++++++++++++++++++++++++----------------- Widgets/Corner.qml | 3 ++- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 26708af..0febada 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ wallpaper +lockbg diff --git a/Corners.qml b/Corners.qml index a30dcd8..c3f15a1 100644 --- a/Corners.qml +++ b/Corners.qml @@ -3,11 +3,12 @@ import Quickshell import Quickshell.Hyprland import './Widgets' as Widgets -Repeater { +Variants { model: Quickshell.screens delegate: Item { id: corners readonly property real radius: 12 + required property var modelData Widgets.Corner { anchors { top: true @@ -16,7 +17,7 @@ Repeater { radius: corners.radius angle: 0 fillColor: "black" - screen: modelData + modelData: corners.modelData } Widgets.Corner { anchors { @@ -26,7 +27,7 @@ Repeater { radius: corners.radius angle: 90 fillColor: "black" - screen: modelData + modelData: corners.modelData } Widgets.Corner { anchors { @@ -36,7 +37,7 @@ Repeater { radius: corners.radius angle: 180 fillColor: "black" - screen: modelData + modelData: corners.modelData } Widgets.Corner { anchors { @@ -46,8 +47,7 @@ Repeater { radius: corners.radius angle: 270 fillColor: "black" - screen: modelData + modelData: corners.modelData } } - } diff --git a/Lock.qml b/Lock.qml index f102202..0c8b164 100644 --- a/Lock.qml +++ b/Lock.qml @@ -1,4 +1,5 @@ import Quickshell +import Quickshell.Hyprland import Quickshell.Wayland import Quickshell.Widgets import Quickshell.Io @@ -11,10 +12,10 @@ WlSessionLock { id: lock locked: false required property bool animate + property bool exit: false function instalock() {lock.animate = false; lock.locked = true} - function open() {lock.animate = true; lock.locked = true} + function open() {lock.animate = true; lock.locked = true;} function close() {lock.locked = false} - property var clock: SystemClock {} WlSessionLockSurface { id: surface color: "transparent" @@ -24,10 +25,15 @@ WlSessionLock { anchors.fill: parent opacity: !lock.animate || capture.ready color: "#000" - Rectangle { + ClippingRectangle { anchors.fill: parent radius: 16 color: "#141414" + Image { + source: Quickshell.shellPath("lockbg") + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + } } Rectangle { anchors { @@ -65,7 +71,7 @@ WlSessionLock { Behavior on x { NumberAnimation { duration: 300 - easing.type: Easing.OutQuint + easing.type: Easing.OutQuart } } } @@ -110,22 +116,17 @@ WlSessionLock { xScale: 1 yScale: xScale NumberAnimation on xScale { - running: capture.ready + running: capture.ready && Hyprland.focusedWorkspace.toplevels.values.length to: 0.80 duration: 800 - easing.type: Easing.InQuint + easing.type: Easing.InQuart } NumberAnimation on xScale { - id: exit - running: false + running: lock.exit && Hyprland.focusedWorkspace.toplevels.values.length from: 0.8 to: 1 duration: 800 - easing.type: Easing.OutQuint - onStarted: { - capture.parent.visible = true - } - onFinished: lock.locked = false + easing.type: Easing.OutQuart } } SequentialAnimation on opacity { @@ -136,19 +137,31 @@ WlSessionLock { to: 0 } } + Timer { + running: lock.exit + interval: 800 + repeat: false + onTriggered: { + lock.exit = false + lock.locked = false + } + } NumberAnimation on opacity { duration: 300 - running: exit.running + running: lock.exit from: 0 to: 1 + onStarted: { + capture.parent.visible = true + } } NumberAnimation on radius { - running: capture.ready + running: capture.ready && Hyprland.focusedWorkspace.toplevels.values.length duration: 800 - to: 32 + to: 20 } NumberAnimation on radius { - running: exit.running + running: lock.exit to: 12 duration: 800 } @@ -161,7 +174,7 @@ WlSessionLock { onCompleted: result => { switch (result) { case PamResult.Success: - exit.start() + lock.exit = true break; case PamResult.Failed: case PamResult.Error: diff --git a/Widgets/Corner.qml b/Widgets/Corner.qml index 8997f2b..85e1f97 100644 --- a/Widgets/Corner.qml +++ b/Widgets/Corner.qml @@ -9,13 +9,14 @@ PanelWindow { required property real radius required property int angle required property color fillColor + required property var modelData WlrLayershell.layer: WlrLayer.Overlay + screen: modelData color: "transparent" implicitWidth: corner.radius implicitHeight: corner.radius - function anglePointX(angle) { return (corner.radius * Math.sqrt(2) * 1/2 * Math.sin(angle)) + corner.radius/2 }