Improve lockscreen

This commit is contained in:
outfoxxed 2024-03-20 06:25:08 -07:00
parent 85ca402006
commit a7698d8833
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 73 additions and 2 deletions

View file

@ -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()
}
}

View file

@ -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)