From a7698d883377ae0046b96b951a198ffde9d77b02 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Wed, 20 Mar 2024 06:25:08 -0700 Subject: [PATCH] Improve lockscreen --- .../quickshell/lockscreen/LockGlobals.qml | 17 ++++++ .../quickshell/lockscreen/Lockscreen.qml | 58 ++++++++++++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 modules/user/modules/quickshell/lockscreen/LockGlobals.qml diff --git a/modules/user/modules/quickshell/lockscreen/LockGlobals.qml b/modules/user/modules/quickshell/lockscreen/LockGlobals.qml new file mode 100644 index 0000000..70088e4 --- /dev/null +++ b/modules/user/modules/quickshell/lockscreen/LockGlobals.qml @@ -0,0 +1,17 @@ +pragma Singleton + +import QtQuick +import Quickshell + +Singleton { + property var time: new Date(); + property string text; + + Timer { + interval: 10000 + running: true + repeat: true + + onTriggered: time = new Date() + } +} diff --git a/modules/user/modules/quickshell/lockscreen/Lockscreen.qml b/modules/user/modules/quickshell/lockscreen/Lockscreen.qml index d9fa6d4..0913b67 100644 --- a/modules/user/modules/quickshell/lockscreen/Lockscreen.qml +++ b/modules/user/modules/quickshell/lockscreen/Lockscreen.qml @@ -1,5 +1,5 @@ import QtQuick -import QtQuick.Controls.Universal +import QtQuick.Controls.Basic Item { required property AuthContext context @@ -8,6 +8,44 @@ Item { anchors.centerIn: parent scale: 2 + Text { + id: timeText + anchors { + bottom: entryBox.top + bottomMargin: 50 + horizontalCenter: parent.horizontalCenter + } + + font { + pointSize: 60 + hintingPreference: Font.PreferFullHinting + family: "Noto Sans" + } + + color: "white" + + text: { + const hours = LockGlobals.time.getHours().toString().padStart(2, '0'); + const minutes = LockGlobals.time.getMinutes().toString().padStart(2, '0'); + return `${hours}:${minutes}`; + } + } + + Text { + anchors { + top: timeText.bottom + topMargin: -10 + horizontalCenter: parent.horizontalCenter + } + + font { + pointSize: 20 + } + + color: "#50ffffff" + text: "Locked" + } + TextField { id: entryBox anchors.centerIn: parent @@ -18,7 +56,23 @@ Item { horizontalAlignment: TextInput.AlignHCenter echoMode: TextInput.Password inputMethodHints: Qt.ImhSensitiveData - placeholderText: "Enter password" + onCursorVisibleChanged: { + if (cursorVisible) cursorVisible = false; + } + cursorVisible: false + + color: "white" + + background: Rectangle { + color: "#20ffffff" + border.color: "#30ffffff" + radius: height / 2 + } + + text: LockGlobals.text + onTextChanged: { + LockGlobals.text = text + } onAccepted: { if (text != "") context.tryLogin(text)