Add lock screen background

This commit is contained in:
2026-07-16 18:35:34 -07:00
parent 0e2dc7ea5b
commit 1edfc40c6e
4 changed files with 40 additions and 25 deletions

View File

@@ -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: