forked from Shinonome/dots-hyprland
lock: ctrl+enter to also turn on idle inhibitor
This commit is contained in:
@@ -72,7 +72,7 @@ Scope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unlock the keyring if configured to do so
|
// Unlock the keyring if configured to do so
|
||||||
if (Config.options.lock.security.unlockKeyring) root.unlockKeyring();
|
if (Config.options.lock.security.unlockKeyring) root.unlockKeyring(); // Async
|
||||||
|
|
||||||
// Unlock the screen before exiting, or the compositor will display a
|
// Unlock the screen before exiting, or the compositor will display a
|
||||||
// fallback lock you can't interact with.
|
// fallback lock you can't interact with.
|
||||||
@@ -83,6 +83,12 @@ Scope {
|
|||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
lockContext.reset();
|
lockContext.reset();
|
||||||
|
|
||||||
|
// Post-unlock actions
|
||||||
|
if (lockContext.alsoInhibitIdle) {
|
||||||
|
lockContext.alsoInhibitIdle = false;
|
||||||
|
Idle.toggleInhibit(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Scope {
|
|||||||
property bool showFailure: false
|
property bool showFailure: false
|
||||||
property bool fingerprintsConfigured: false
|
property bool fingerprintsConfigured: false
|
||||||
property var targetAction: LockContext.ActionEnum.Unlock
|
property var targetAction: LockContext.ActionEnum.Unlock
|
||||||
|
property bool alsoInhibitIdle: false
|
||||||
|
|
||||||
function resetTargetAction() {
|
function resetTargetAction() {
|
||||||
root.targetAction = LockContext.ActionEnum.Unlock;
|
root.targetAction = LockContext.ActionEnum.Unlock;
|
||||||
@@ -58,7 +59,8 @@ Scope {
|
|||||||
passwordClearTimer.restart();
|
passwordClearTimer.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryUnlock() {
|
function tryUnlock(alsoInhibitIdle = false) {
|
||||||
|
root.alsoInhibitIdle = alsoInhibitIdle;
|
||||||
root.unlockInProgress = true;
|
root.unlockInProgress = true;
|
||||||
pam.start();
|
pam.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,13 +59,23 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Key presses
|
// Key presses
|
||||||
|
property bool ctrlHeld: false
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
root.context.resetClearTimer();
|
root.context.resetClearTimer();
|
||||||
|
if (event.key === Qt.Key_Control) {
|
||||||
|
root.ctrlHeld = true;
|
||||||
|
}
|
||||||
if (event.key === Qt.Key_Escape) { // Esc to clear
|
if (event.key === Qt.Key_Escape) { // Esc to clear
|
||||||
root.context.currentText = "";
|
root.context.currentText = "";
|
||||||
}
|
}
|
||||||
forceFieldFocus();
|
forceFieldFocus();
|
||||||
}
|
}
|
||||||
|
Keys.onReleased: event => {
|
||||||
|
if (event.key === Qt.Key_Control) {
|
||||||
|
root.ctrlHeld = false;
|
||||||
|
}
|
||||||
|
forceFieldFocus();
|
||||||
|
}
|
||||||
|
|
||||||
// RippleButton {
|
// RippleButton {
|
||||||
// anchors {
|
// anchors {
|
||||||
@@ -133,7 +143,9 @@ MouseArea {
|
|||||||
|
|
||||||
// Synchronizing (across monitors) and unlocking
|
// Synchronizing (across monitors) and unlocking
|
||||||
onTextChanged: root.context.currentText = this.text
|
onTextChanged: root.context.currentText = this.text
|
||||||
onAccepted: root.context.tryUnlock()
|
onAccepted: {
|
||||||
|
root.context.tryUnlock(ctrlHeld);
|
||||||
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: root.context
|
target: root.context
|
||||||
function onCurrentTextChanged() {
|
function onCurrentTextChanged() {
|
||||||
@@ -202,7 +214,7 @@ MouseArea {
|
|||||||
iconSize: 24
|
iconSize: 24
|
||||||
text: {
|
text: {
|
||||||
if (root.context.targetAction === LockContext.ActionEnum.Unlock) {
|
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) {
|
} else if (root.context.targetAction === LockContext.ActionEnum.Poweroff) {
|
||||||
return "power_settings_new";
|
return "power_settings_new";
|
||||||
} else if (root.context.targetAction === LockContext.ActionEnum.Reboot) {
|
} else if (root.context.targetAction === LockContext.ActionEnum.Reboot) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ PanelWindow {
|
|||||||
bottom: true
|
bottom: true
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Ask: sidebar AI; Ocr: tesseract
|
// TODO: Ask: sidebar AI
|
||||||
enum SnipAction { Copy, Edit, Search, CharRecognition, Record, RecordWithSound }
|
enum SnipAction { Copy, Edit, Search, CharRecognition, Record, RecordWithSound }
|
||||||
enum SelectionMode { RectCorners, Circle }
|
enum SelectionMode { RectCorners, Circle }
|
||||||
property var action: RegionSelection.SnipAction.Copy
|
property var action: RegionSelection.SnipAction.Copy
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
pragma Singleton
|
||||||
import qs.modules.common
|
import qs.modules.common
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A nice wrapper for date and time strings.
|
* A nice wrapper for date and time strings.
|
||||||
@@ -17,21 +17,26 @@ Singleton {
|
|||||||
target: Persistent
|
target: Persistent
|
||||||
function onReadyChanged() {
|
function onReadyChanged() {
|
||||||
if (!Persistent.isNewHyprlandInstance) {
|
if (!Persistent.isNewHyprlandInstance) {
|
||||||
root.inhibit = Persistent.states.idle.inhibit
|
root.inhibit = Persistent.states.idle.inhibit;
|
||||||
} else {
|
} else {
|
||||||
Persistent.states.idle.inhibit = root.inhibit
|
Persistent.states.idle.inhibit = root.inhibit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleInhibit() {
|
function toggleInhibit(active = null) {
|
||||||
root.inhibit = !root.inhibit
|
if (active !== null) {
|
||||||
Persistent.states.idle.inhibit = root.inhibit
|
root.inhibit = active;
|
||||||
|
} else {
|
||||||
|
root.inhibit = !root.inhibit;
|
||||||
|
}
|
||||||
|
Persistent.states.idle.inhibit = root.inhibit;
|
||||||
}
|
}
|
||||||
|
|
||||||
IdleInhibitor {
|
IdleInhibitor {
|
||||||
id: idleInhibitor
|
id: idleInhibitor
|
||||||
window: PanelWindow { // Inhibitor requires a "visible" surface
|
window: PanelWindow {
|
||||||
|
// Inhibitor requires a "visible" surface
|
||||||
// Actually not lol
|
// Actually not lol
|
||||||
implicitWidth: 0
|
implicitWidth: 0
|
||||||
implicitHeight: 0
|
implicitHeight: 0
|
||||||
@@ -47,5 +52,4 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user