Add lock screen background
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
wallpaper
|
||||
lockbg
|
||||
|
||||
12
Corners.qml
12
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
49
Lock.qml
49
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:
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user