From 14d4d05acc235ab7033316d16530783c90e95faa Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 5 Sep 2025 23:31:35 +0200 Subject: ... --- .../gkleen@sif/shell/quickshell/Lockscreen.qml | 222 ++------------------- 1 file changed, 20 insertions(+), 202 deletions(-) (limited to 'accounts/gkleen@sif/shell/quickshell/Lockscreen.qml') diff --git a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml index 7cb1cc67..cc82a275 100644 --- a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml +++ b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml @@ -2,14 +2,7 @@ import Quickshell import Quickshell.Wayland import Quickshell.Io import Quickshell.Services.Pam -import Quickshell.Widgets -import QtQuick.Effects -import QtQuick.Layouts -import QtQuick -import QtQuick.Controls -import QtQuick.Controls.Fusion -import qs.Services -// import QtQml.Models +import QtQml Scope { id: lockscreen @@ -53,205 +46,30 @@ Scope { WlSessionLockSurface { id: lockSurface - color: "#000000" + color: "black" - Item { - id: background + LockSurface { + id: surfaceContent - anchors.fill: parent - - property Img current: one - property string source: selector.selected - - WallpaperSelector { - id: selector - seed: lockSurface.screen?.name || "" - } - - onSourceChanged: { - if (!source) - current = null; - else if (current === one) - two.update() - else - one.update() - } - - Img { id: one } - Img { id: two } - - component Img: Item { - id: img - - property string source - - function update() { - source = background.source || "" - } - - anchors.fill: parent - - Image { - id: imageSource - - source: img.source - sourceSize: Qt.size(parent.width, parent.height) - fillMode: Image.PreserveAspectCrop - smooth: true - visible: false - asynchronous: true - cache: false - - onStatusChanged: { - if (status === Image.Ready) { - background.current = img - } - } - } - - MultiEffect { - id: imageEffect - - source: imageSource - anchors.fill: parent - blurEnabled: true - blur: 1 - blurMax: 64 - blurMultiplier: 2 - - opacity: 0 - - states: State { - name: "visible" - when: background.current === img - - PropertyChanges { - imageEffect.opacity: 1 - } - StateChangeScript { - name: "unloadOther" - script: { - if (img === one) - two.source = "" - if (img === two) - one.source = "" - } - } - } - - transitions: Transition { - SequentialAnimation { - NumberAnimation { - target: imageEffect - properties: "opacity" - duration: 5000 - easing.type: Easing.OutCubic - } - ScriptAction { - scriptName: "unloadOther" - } - } - } - } - } - } - - Item { - anchors { - top: lockSurface.top - left: lockSurface.left - right: lockSurface.right - } - - implicitWidth: lockSurface.width - implicitHeight: 21 - - Rectangle { - anchors.fill: parent - color: Qt.rgba(0, 0, 0, 0.75) + onResponse: responseText => pam.respond(responseText) + onAuthRunningChanged: { + if (authRunning) + pam.start(); } - - Clock { - anchors.centerIn: parent - calendarPopup: false + Connections { + target: pam + function onMessagesChanged() { surfaceContent.messages = pam.messages; } + function onResponseRequiredChanged() { surfaceContent.responseRequired = pam.responseRequired; } + function onActiveChanged() { surfaceContent.authRunning = pam.active; } } - } - - WrapperRectangle { - id: unlockUi - - Keys.onPressed: event => { - if (!pam.active) { - event.accepted = true; - pam.start(); - } + onCurrentTextChanged: lockscreen.currentText = currentText + Connections { + target: lockscreen + function onCurrentTextChanged() { surfaceContent.currentText = lockscreen.currentText; } } - focus: !passwordBox.visible - - visible: pam.active - - color: Qt.rgba(0, 0, 0, 0.75) - margin: 8 - - anchors.centerIn: parent - - ColumnLayout { - spacing: 4 - - BusyIndicator { - visible: running - running: !Array.from(pam.messages).length && !pam.responseRequired - } - - Repeater { - model: pam.messages - - Text { - required property var modelData - - font.pointSize: 10 - font.family: "Fira Sans" - color: modelData.error ? "#f28a21" : "#ffffff" - - text: modelData.text - - Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - } - } - - TextField { - id: passwordBox - - visible: pam.responseRequired - echoMode: pam.responseVisible ? TextInput.Normal : TextInput.Password - inputMethodHints: Qt.ImhSensitiveData - - onTextChanged: lockscreen.currentText = passwordBox.text - onAccepted: { - passwordBox.readOnly = true; - pam.respond(lockscreen.currentText); - } - - Connections { - target: lockscreen - function onCurrentTextChanged() { - passwordBox.text = lockscreen.currentText - } - } - Connections { - target: pam - function onResponseRequiredChanged() { - if (pam.responseRequired) - passwordBox.readOnly = false; - passwordBox.focus = true; - passwordBox.selectAll(); - } - } - - Layout.topMargin: 4 - Layout.fillWidth: true - } + Connections { + target: lockSurface + function onScreenChanged() { surfaceContent.screen = lockSurface.screen; } } } } -- cgit v1.2.3