import QtQuick import SddmComponents 2.0 import "components" Rectangle { id: root width: Screen.width height: Screen.height color: Theme.colors.background // Background Image Image { id: bgImage anchors.fill: parent // SDDM loads the theme.conf, but since we want the dynamic user wallpaper, // we can try reading it if SDDM has permissions, or fallback to theme.conf. // Usually, SDDM runs as user 'sddm' and might not have access to ~/.config/current-wallpaper. // We will default to theme.conf's background. source: config.background fillMode: Image.PreserveAspectCrop } Rectangle { anchors.fill: parent color: Theme.colors.background } Item { id: lockSurface anchors.fill: parent property QtObject battery: QtObject { property bool isPresent: false property real percentage: 0 } Column { anchors.centerIn: parent spacing: Theme.geometry.spacing * 3 Column { anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.geometry.spacing property date currentTime: new Date() Timer { interval: 1000; running: true; repeat: true onTriggered: parent.currentTime = new Date() } Text { anchors.horizontalCenter: parent.horizontalCenter text: Qt.formatDateTime(parent.currentTime, "hh:mm") color: Theme.colors.text font.family: Theme.font.family font.bold: true font.pixelSize: 96 } Text { anchors.horizontalCenter: parent.horizontalCenter text: Qt.formatDateTime(parent.currentTime, "dddd, d MMMM") color: Theme.colors.textMuted font.family: Theme.font.family font.pixelSize: Theme.type.title } } // Battery section kept just in case you find a way to populate it, // but hidden by default via isPresent: false Row { anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.geometry.spacing / 2 visible: lockSurface.battery.isPresent Text { text: Math.round(lockSurface.battery.percentage * 100) + "%" font.family: Theme.font.family font.pixelSize: Theme.type.body color: Theme.colors.textMuted } } Column { anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.geometry.spacing Item { id: passwordShake width: 320 height: passwordField.height anchors.horizontalCenter: parent.horizontalCenter SequentialAnimation { id: shakeAnim NumberAnimation { target: passwordShake; property: "x"; to: -8; duration: 40 } NumberAnimation { target: passwordShake; property: "x"; to: 8; duration: 40 } NumberAnimation { target: passwordShake; property: "x"; to: -6; duration: 40 } NumberAnimation { target: passwordShake; property: "x"; to: 0; duration: 40 } } Connections { target: sddm function onLoginFailed() { passwordField.text = "" errorText.text = "Incorrect password" shakeAnim.start() } function onLoginSucceeded() { errorText.text = "" } } TextField { id: passwordField width: parent.width placeholder: "Password for " + userModel.lastUser echoMode: TextInput.Password onReturnPressed: { if (text.length > 0) { sddm.login(userModel.lastUser, text, sessionModel.lastIndex) } } } } Text { id: errorText anchors.horizontalCenter: parent.horizontalCenter text: "" visible: text.length > 0 color: Theme.colors.alert font.family: Theme.font.family font.pixelSize: Theme.type.caption } HintBar { anchors.horizontalCenter: parent.horizontalCenter hints: [ { key: "↵", label: "Unlock" } ] } } } Component.onCompleted: { passwordField.focusInput(); } } }