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

1
.gitignore vendored
View File

@@ -1 +1,2 @@
wallpaper wallpaper
lockbg

View File

@@ -3,11 +3,12 @@ import Quickshell
import Quickshell.Hyprland import Quickshell.Hyprland
import './Widgets' as Widgets import './Widgets' as Widgets
Repeater { Variants {
model: Quickshell.screens model: Quickshell.screens
delegate: Item { delegate: Item {
id: corners id: corners
readonly property real radius: 12 readonly property real radius: 12
required property var modelData
Widgets.Corner { Widgets.Corner {
anchors { anchors {
top: true top: true
@@ -16,7 +17,7 @@ Repeater {
radius: corners.radius radius: corners.radius
angle: 0 angle: 0
fillColor: "black" fillColor: "black"
screen: modelData modelData: corners.modelData
} }
Widgets.Corner { Widgets.Corner {
anchors { anchors {
@@ -26,7 +27,7 @@ Repeater {
radius: corners.radius radius: corners.radius
angle: 90 angle: 90
fillColor: "black" fillColor: "black"
screen: modelData modelData: corners.modelData
} }
Widgets.Corner { Widgets.Corner {
anchors { anchors {
@@ -36,7 +37,7 @@ Repeater {
radius: corners.radius radius: corners.radius
angle: 180 angle: 180
fillColor: "black" fillColor: "black"
screen: modelData modelData: corners.modelData
} }
Widgets.Corner { Widgets.Corner {
anchors { anchors {
@@ -46,8 +47,7 @@ Repeater {
radius: corners.radius radius: corners.radius
angle: 270 angle: 270
fillColor: "black" fillColor: "black"
screen: modelData modelData: corners.modelData
} }
} }
} }

View File

@@ -1,4 +1,5 @@
import Quickshell import Quickshell
import Quickshell.Hyprland
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
import Quickshell.Io import Quickshell.Io
@@ -11,10 +12,10 @@ WlSessionLock {
id: lock id: lock
locked: false locked: false
required property bool animate required property bool animate
property bool exit: false
function instalock() {lock.animate = false; lock.locked = true} 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} function close() {lock.locked = false}
property var clock: SystemClock {}
WlSessionLockSurface { WlSessionLockSurface {
id: surface id: surface
color: "transparent" color: "transparent"
@@ -24,10 +25,15 @@ WlSessionLock {
anchors.fill: parent anchors.fill: parent
opacity: !lock.animate || capture.ready opacity: !lock.animate || capture.ready
color: "#000" color: "#000"
Rectangle { ClippingRectangle {
anchors.fill: parent anchors.fill: parent
radius: 16 radius: 16
color: "#141414" color: "#141414"
Image {
source: Quickshell.shellPath("lockbg")
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
}
} }
Rectangle { Rectangle {
anchors { anchors {
@@ -65,7 +71,7 @@ WlSessionLock {
Behavior on x { Behavior on x {
NumberAnimation { NumberAnimation {
duration: 300 duration: 300
easing.type: Easing.OutQuint easing.type: Easing.OutQuart
} }
} }
} }
@@ -110,22 +116,17 @@ WlSessionLock {
xScale: 1 xScale: 1
yScale: xScale yScale: xScale
NumberAnimation on xScale { NumberAnimation on xScale {
running: capture.ready running: capture.ready && Hyprland.focusedWorkspace.toplevels.values.length
to: 0.80 to: 0.80
duration: 800 duration: 800
easing.type: Easing.InQuint easing.type: Easing.InQuart
} }
NumberAnimation on xScale { NumberAnimation on xScale {
id: exit running: lock.exit && Hyprland.focusedWorkspace.toplevels.values.length
running: false
from: 0.8 from: 0.8
to: 1 to: 1
duration: 800 duration: 800
easing.type: Easing.OutQuint easing.type: Easing.OutQuart
onStarted: {
capture.parent.visible = true
}
onFinished: lock.locked = false
} }
} }
SequentialAnimation on opacity { SequentialAnimation on opacity {
@@ -136,19 +137,31 @@ WlSessionLock {
to: 0 to: 0
} }
} }
Timer {
running: lock.exit
interval: 800
repeat: false
onTriggered: {
lock.exit = false
lock.locked = false
}
}
NumberAnimation on opacity { NumberAnimation on opacity {
duration: 300 duration: 300
running: exit.running running: lock.exit
from: 0 from: 0
to: 1 to: 1
onStarted: {
capture.parent.visible = true
}
} }
NumberAnimation on radius { NumberAnimation on radius {
running: capture.ready running: capture.ready && Hyprland.focusedWorkspace.toplevels.values.length
duration: 800 duration: 800
to: 32 to: 20
} }
NumberAnimation on radius { NumberAnimation on radius {
running: exit.running running: lock.exit
to: 12 to: 12
duration: 800 duration: 800
} }
@@ -161,7 +174,7 @@ WlSessionLock {
onCompleted: result => { onCompleted: result => {
switch (result) { switch (result) {
case PamResult.Success: case PamResult.Success:
exit.start() lock.exit = true
break; break;
case PamResult.Failed: case PamResult.Failed:
case PamResult.Error: case PamResult.Error:

View File

@@ -9,13 +9,14 @@ PanelWindow {
required property real radius required property real radius
required property int angle required property int angle
required property color fillColor required property color fillColor
required property var modelData
WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.layer: WlrLayer.Overlay
screen: modelData
color: "transparent" color: "transparent"
implicitWidth: corner.radius implicitWidth: corner.radius
implicitHeight: corner.radius implicitHeight: corner.radius
function anglePointX(angle) { function anglePointX(angle) {
return (corner.radius * Math.sqrt(2) * 1/2 * Math.sin(angle)) + corner.radius/2 return (corner.radius * Math.sqrt(2) * 1/2 * Math.sin(angle)) + corner.radius/2
} }