mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
lock: key presses also reset inactivity timer
This commit is contained in:
@@ -15,6 +15,10 @@ Scope {
|
|||||||
property bool unlockInProgress: false
|
property bool unlockInProgress: false
|
||||||
property bool showFailure: false
|
property bool showFailure: false
|
||||||
|
|
||||||
|
function resetClearTimer() {
|
||||||
|
passwordClearTimer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: passwordClearTimer
|
id: passwordClearTimer
|
||||||
interval: 10000
|
interval: 10000
|
||||||
|
|||||||
@@ -14,17 +14,26 @@ MouseArea {
|
|||||||
property bool active: false
|
property bool active: false
|
||||||
property bool showInputField: active || context.currentText.length > 0
|
property bool showInputField: active || context.currentText.length > 0
|
||||||
|
|
||||||
|
// Force focus on entry
|
||||||
function forceFieldFocus() {
|
function forceFieldFocus() {
|
||||||
passwordBox.forceActiveFocus();
|
passwordBox.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: context
|
target: context
|
||||||
function onShouldReFocus() {
|
function onShouldReFocus() {
|
||||||
forceFieldFocus();
|
forceFieldFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
onPressed: mouse => {
|
||||||
|
forceFieldFocus();
|
||||||
|
}
|
||||||
|
onPositionChanged: mouse => {
|
||||||
|
forceFieldFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toolbar appearing animation
|
||||||
property real toolbarScale: 0.9
|
property real toolbarScale: 0.9
|
||||||
property real toolbarOpacity: 0
|
property real toolbarOpacity: 0
|
||||||
Behavior on toolbarScale {
|
Behavior on toolbarScale {
|
||||||
@@ -38,30 +47,22 @@ MouseArea {
|
|||||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
forceFieldFocus();
|
forceFieldFocus();
|
||||||
toolbarScale = 1;
|
toolbarScale = 1;
|
||||||
toolbarOpacity = 1;
|
toolbarOpacity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: event => { // Esc to clear
|
// Key presses
|
||||||
if (event.key === Qt.Key_Escape) {
|
Keys.onPressed: event => {
|
||||||
|
root.context.resetClearTimer();
|
||||||
|
if (event.key === Qt.Key_Escape) { // Esc to clear
|
||||||
root.context.currentText = "";
|
root.context.currentText = "";
|
||||||
}
|
}
|
||||||
forceFieldFocus();
|
forceFieldFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
hoverEnabled: true
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
onPressed: mouse => {
|
|
||||||
forceFieldFocus();
|
|
||||||
}
|
|
||||||
onPositionChanged: mouse => {
|
|
||||||
forceFieldFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
// RippleButton {
|
// RippleButton {
|
||||||
// anchors {
|
// anchors {
|
||||||
// top: parent.top
|
// top: parent.top
|
||||||
@@ -77,7 +78,7 @@ MouseArea {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Controls
|
// Main toolbar: password box
|
||||||
Toolbar {
|
Toolbar {
|
||||||
id: mainIsland
|
id: mainIsland
|
||||||
anchors {
|
anchors {
|
||||||
@@ -114,6 +115,10 @@ MouseArea {
|
|||||||
passwordBox.text = root.context.currentText;
|
passwordBox.text = root.context.currentText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
root.context.resetClearTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
@@ -136,6 +141,7 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Left toolbar
|
||||||
Toolbar {
|
Toolbar {
|
||||||
id: leftIsland
|
id: leftIsland
|
||||||
anchors {
|
anchors {
|
||||||
@@ -207,6 +213,7 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Right toolbar
|
||||||
Toolbar {
|
Toolbar {
|
||||||
id: rightIsland
|
id: rightIsland
|
||||||
anchors {
|
anchors {
|
||||||
|
|||||||
Reference in New Issue
Block a user