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
import QtQuick.Controls.Universal import QtQuick.Controls.Basic
Item { Item {
required property AuthContext context required property AuthContext context
@ -8,6 +8,44 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
scale: 2 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 { TextField {
id: entryBox id: entryBox
anchors.centerIn: parent anchors.centerIn: parent
@ -18,7 +56,23 @@ Item {
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
echoMode: TextInput.Password echoMode: TextInput.Password
inputMethodHints: Qt.ImhSensitiveData 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: { onAccepted: {
if (text != "") context.tryLogin(text) if (text != "") context.tryLogin(text)