Allow password input from monitors without LockScreen

This commit is contained in:
Aitor
2026-02-25 09:16:58 +01:00
parent fe8e23f1d0
commit a589506da3
+53 -16
View File
@@ -25,12 +25,6 @@ Loader {
} else {
CavaService.unregisterComponent("lockscreen");
}
if (root.active) {
LockKeysService.registerComponent("lockscreen");
} else {
LockKeysService.unregisterComponent("lockscreen");
}
}
onNeedsCavaChanged: {
@@ -46,11 +40,6 @@ Loader {
PanelService.lockScreen = this;
}
Component.onDestruction: {
CavaService.unregisterComponent("lockscreen");
LockKeysService.unregisterComponent("lockscreen");
}
Timer {
id: unloadAfterUnlockTimer
interval: 250
@@ -280,13 +269,21 @@ Loader {
height: 0
visible: false
enabled: !lockContext.unlockInProgress
font.pointSize: Style.fontSizeM
color: Color.mPrimary
echoMode: TextInput.Password
passwordCharacter: "•"
passwordMaskDelay: 0
text: lockContext.currentText
onTextChanged: lockContext.currentText = text
// Bidirectional sync — avoids a declarative binding which breaks on input
onTextChanged: {
if (lockContext.currentText !== text)
lockContext.currentText = text;
}
Connections {
target: lockContext
function onCurrentTextChanged() {
if (passwordInput.text !== lockContext.currentText)
passwordInput.text = lockContext.currentText;
}
}
Keys.onPressed: function (event) {
if (Keybinds.checkKey(event, 'enter', Settings)) {
@@ -317,9 +314,49 @@ Loader {
Component {
id: blackScreenComponent
// Black surface for disabled monitors — still captures keyboard for password entry
Rectangle {
anchors.fill: parent
color: "black"
TextInput {
id: blackScreenPasswordInput
width: 0
height: 0
visible: false
enabled: !lockContext.unlockInProgress
echoMode: TextInput.Password
passwordMaskDelay: 0
// Bidirectional sync — avoids a declarative binding which breaks on input
onTextChanged: {
if (lockContext.currentText !== text)
lockContext.currentText = text;
}
Connections {
target: lockContext
function onCurrentTextChanged() {
if (blackScreenPasswordInput.text !== lockContext.currentText)
blackScreenPasswordInput.text = lockContext.currentText;
}
}
Keys.onPressed: function (event) {
if (Keybinds.checkKey(event, 'enter', Settings)) {
lockContext.tryUnlock();
event.accepted = true;
}
}
Component.onCompleted: forceActiveFocus()
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
onPositionChanged: blackScreenPasswordInput.forceActiveFocus()
}
}
}
}