mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-16 10:42:06 -04:00
idle/lock: add option to turn off monitors after lock explicitly
fixes #452 fixes #2156
This commit is contained in:
@@ -147,6 +147,13 @@ Scope {
|
||||
}
|
||||
}
|
||||
|
||||
Pam {
|
||||
id: sharedPam
|
||||
lockSecured: root.shouldLock
|
||||
buffer: root.sharedPasswordBuffer
|
||||
onUnlockRequested: root.unlock()
|
||||
}
|
||||
|
||||
WlSessionLock {
|
||||
id: sessionLock
|
||||
|
||||
@@ -170,6 +177,7 @@ Scope {
|
||||
anchors.fill: parent
|
||||
visible: lockSurface.isActiveScreen
|
||||
lock: sessionLock
|
||||
pam: sharedPam
|
||||
sharedPasswordBuffer: root.sharedPasswordBuffer
|
||||
screenName: lockSurface.currentScreenName
|
||||
isLocked: shouldLock
|
||||
|
||||
@@ -23,6 +23,7 @@ Item {
|
||||
|
||||
property string passwordBuffer: ""
|
||||
property bool demoMode: false
|
||||
property var pam: demoPam
|
||||
property string screenName: ""
|
||||
property bool unlocking: false
|
||||
property string pamState: ""
|
||||
@@ -58,10 +59,8 @@ Item {
|
||||
return I18n.tr("Too many attempts - locked out");
|
||||
if (root.pamState === "fail")
|
||||
return I18n.tr("Incorrect password - try again");
|
||||
if (pam.fprintState === "error") {
|
||||
const detail = (pam.fprint.message || "").trim();
|
||||
return detail.length > 0 ? I18n.tr("Fingerprint error: %1").arg(detail) : I18n.tr("Fingerprint error");
|
||||
}
|
||||
if (pam.fprintState === "error")
|
||||
return I18n.tr("Fingerprint error");
|
||||
if (pam.fprintState === "max")
|
||||
return I18n.tr("Maximum fingerprint attempts reached. Please use password.");
|
||||
if (pam.fprintState === "fail")
|
||||
@@ -745,13 +744,6 @@ Item {
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1639,49 +1631,46 @@ Item {
|
||||
}
|
||||
|
||||
Pam {
|
||||
id: pam
|
||||
lockSecured: !demoMode
|
||||
onUnlockRequested: {
|
||||
id: demoPam
|
||||
lockSecured: false
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root.pam
|
||||
|
||||
function onUnlockRequested() {
|
||||
root.unlocking = true;
|
||||
lockerReadyArmed = false;
|
||||
passwordField.text = "";
|
||||
root.passwordBuffer = "";
|
||||
root.unlockRequested();
|
||||
}
|
||||
onStateChanged: {
|
||||
root.pamState = state;
|
||||
if (state !== "") {
|
||||
root.unlocking = false;
|
||||
placeholderDelay.restart();
|
||||
passwordField.text = "";
|
||||
root.passwordBuffer = "";
|
||||
}
|
||||
}
|
||||
onU2fPendingChanged: {
|
||||
if (u2fPending) {
|
||||
passwordField.text = "";
|
||||
root.passwordBuffer = "";
|
||||
if (keyboardController.isKeyboardActive)
|
||||
keyboardController.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: pam
|
||||
function onStateChanged() {
|
||||
root.pamState = root.pam.state;
|
||||
if (root.pam.state === "")
|
||||
return;
|
||||
root.unlocking = false;
|
||||
placeholderDelay.restart();
|
||||
passwordField.text = "";
|
||||
root.passwordBuffer = "";
|
||||
}
|
||||
|
||||
function onU2fPendingChanged() {
|
||||
if (!root.pam.u2fPending)
|
||||
return;
|
||||
passwordField.text = "";
|
||||
root.passwordBuffer = "";
|
||||
if (keyboardController.isKeyboardActive)
|
||||
keyboardController.hide();
|
||||
}
|
||||
|
||||
function onUnlockInProgressChanged() {
|
||||
if (!pam.unlockInProgress && root.unlocking)
|
||||
if (!root.pam.unlockInProgress && root.unlocking)
|
||||
root.unlocking = false;
|
||||
}
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: pam
|
||||
property: "buffer"
|
||||
value: root.passwordBuffer
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: placeholderDelay
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ FocusScope {
|
||||
id: root
|
||||
|
||||
required property WlSessionLock lock
|
||||
required property var pam
|
||||
required property string sharedPasswordBuffer
|
||||
required property string screenName
|
||||
required property bool isLocked
|
||||
@@ -32,6 +33,7 @@ FocusScope {
|
||||
|
||||
anchors.fill: parent
|
||||
demoMode: false
|
||||
pam: root.pam
|
||||
passwordBuffer: root.sharedPasswordBuffer
|
||||
screenName: root.screenName
|
||||
enabled: !videoScreensaver.active
|
||||
|
||||
@@ -182,6 +182,8 @@ Scope {
|
||||
abort();
|
||||
return;
|
||||
}
|
||||
if (active)
|
||||
return;
|
||||
|
||||
tries = 0;
|
||||
errorTries = 0;
|
||||
@@ -195,22 +197,23 @@ Scope {
|
||||
if (!available)
|
||||
return;
|
||||
|
||||
if (res === PamResult.Success) {
|
||||
switch (res) {
|
||||
case PamResult.Success:
|
||||
if (!root.unlockInProgress) {
|
||||
passwd.abort();
|
||||
root.proceedAfterPrimaryAuth();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (res === PamResult.Error) {
|
||||
root.fprintState = "error";
|
||||
case PamResult.Error:
|
||||
errorTries++;
|
||||
if (errorTries < 5) {
|
||||
if (errorTries < 200) {
|
||||
abort();
|
||||
errorRetry.restart();
|
||||
return;
|
||||
}
|
||||
} else if (res === PamResult.MaxTries) {
|
||||
abort();
|
||||
return;
|
||||
case PamResult.MaxTries:
|
||||
tries++;
|
||||
if (tries < SettingsData.maxFprintTries) {
|
||||
root.fprintState = "fail";
|
||||
@@ -219,6 +222,9 @@ Scope {
|
||||
root.fprintState = "max";
|
||||
abort();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
root.flashMsg();
|
||||
@@ -297,7 +303,7 @@ Scope {
|
||||
Timer {
|
||||
id: errorRetry
|
||||
|
||||
interval: 800
|
||||
interval: 1500
|
||||
onTriggered: fprint.start()
|
||||
}
|
||||
|
||||
@@ -349,26 +355,22 @@ Scope {
|
||||
id: fprintStateReset
|
||||
|
||||
interval: 4000
|
||||
onTriggered: {
|
||||
root.fprintState = "";
|
||||
fprint.errorTries = 0;
|
||||
}
|
||||
onTriggered: root.fprintState = ""
|
||||
}
|
||||
|
||||
onLockSecuredChanged: {
|
||||
if (lockSecured) {
|
||||
SettingsData.refreshAuthAvailability();
|
||||
root.state = "";
|
||||
root.fprintState = "";
|
||||
root.u2fState = "";
|
||||
root.u2fPending = false;
|
||||
root.lockMessage = "";
|
||||
root.resetAuthFlows();
|
||||
fprint.checkAvail();
|
||||
u2f.checkAvail();
|
||||
} else {
|
||||
if (!lockSecured) {
|
||||
root.resetAuthFlows();
|
||||
return;
|
||||
}
|
||||
root.state = "";
|
||||
root.fprintState = "";
|
||||
root.u2fState = "";
|
||||
root.u2fPending = false;
|
||||
root.lockMessage = "";
|
||||
root.resetAuthFlows();
|
||||
fprint.checkAvail();
|
||||
u2f.checkAvail();
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
||||
Reference in New Issue
Block a user