Improve lockscreen
This commit is contained in:
parent
85ca402006
commit
a7698d8833
17
modules/user/modules/quickshell/lockscreen/LockGlobals.qml
Normal file
17
modules/user/modules/quickshell/lockscreen/LockGlobals.qml
Normal 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()
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue