lock: ctrl+enter to also turn on idle inhibitor

This commit is contained in:
end-4
2025-12-04 20:40:33 +01:00
parent e9b5e7d7d2
commit 8e704e4009
5 changed files with 38 additions and 14 deletions
@@ -59,10 +59,20 @@ MouseArea {
}
// Key presses
property bool ctrlHeld: false
Keys.onPressed: event => {
root.context.resetClearTimer();
if (event.key === Qt.Key_Control) {
root.ctrlHeld = true;
}
if (event.key === Qt.Key_Escape) { // Esc to clear
root.context.currentText = "";
}
forceFieldFocus();
}
Keys.onReleased: event => {
if (event.key === Qt.Key_Control) {
root.ctrlHeld = false;
}
forceFieldFocus();
}
@@ -133,7 +143,9 @@ MouseArea {
// Synchronizing (across monitors) and unlocking
onTextChanged: root.context.currentText = this.text
onAccepted: root.context.tryUnlock()
onAccepted: {
root.context.tryUnlock(ctrlHeld);
}
Connections {
target: root.context
function onCurrentTextChanged() {
@@ -202,7 +214,7 @@ MouseArea {
iconSize: 24
text: {
if (root.context.targetAction === LockContext.ActionEnum.Unlock) {
return "arrow_right_alt";
return root.ctrlHeld ? "emoji_food_beverage" : "arrow_right_alt";
} else if (root.context.targetAction === LockContext.ActionEnum.Poweroff) {
return "power_settings_new";
} else if (root.context.targetAction === LockContext.ActionEnum.Reboot) {