mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
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
|
||||
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
|
||||
// fallback lock you can't interact with.
|
||||
@@ -83,6 +83,12 @@ Scope {
|
||||
|
||||
// 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 fingerprintsConfigured: false
|
||||
property var targetAction: LockContext.ActionEnum.Unlock
|
||||
property bool alsoInhibitIdle: false
|
||||
|
||||
function resetTargetAction() {
|
||||
root.targetAction = LockContext.ActionEnum.Unlock;
|
||||
@@ -58,7 +59,8 @@ Scope {
|
||||
passwordClearTimer.restart();
|
||||
}
|
||||
|
||||
function tryUnlock() {
|
||||
function tryUnlock(alsoInhibitIdle = false) {
|
||||
root.alsoInhibitIdle = alsoInhibitIdle;
|
||||
root.unlockInProgress = true;
|
||||
pam.start();
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -26,7 +26,7 @@ PanelWindow {
|
||||
bottom: true
|
||||
}
|
||||
|
||||
// TODO: Ask: sidebar AI; Ocr: tesseract
|
||||
// TODO: Ask: sidebar AI
|
||||
enum SnipAction { Copy, Edit, Search, CharRecognition, Record, RecordWithSound }
|
||||
enum SelectionMode { RectCorners, Circle }
|
||||
property var action: RegionSelection.SnipAction.Copy
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
pragma Singleton
|
||||
import qs.modules.common
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
pragma Singleton
|
||||
|
||||
/**
|
||||
* A nice wrapper for date and time strings.
|
||||
@@ -17,21 +17,26 @@ Singleton {
|
||||
target: Persistent
|
||||
function onReadyChanged() {
|
||||
if (!Persistent.isNewHyprlandInstance) {
|
||||
root.inhibit = Persistent.states.idle.inhibit
|
||||
root.inhibit = Persistent.states.idle.inhibit;
|
||||
} else {
|
||||
Persistent.states.idle.inhibit = root.inhibit
|
||||
Persistent.states.idle.inhibit = root.inhibit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleInhibit() {
|
||||
root.inhibit = !root.inhibit
|
||||
Persistent.states.idle.inhibit = root.inhibit
|
||||
function toggleInhibit(active = null) {
|
||||
if (active !== null) {
|
||||
root.inhibit = active;
|
||||
} else {
|
||||
root.inhibit = !root.inhibit;
|
||||
}
|
||||
Persistent.states.idle.inhibit = root.inhibit;
|
||||
}
|
||||
|
||||
IdleInhibitor {
|
||||
id: idleInhibitor
|
||||
window: PanelWindow { // Inhibitor requires a "visible" surface
|
||||
window: PanelWindow {
|
||||
// Inhibitor requires a "visible" surface
|
||||
// Actually not lol
|
||||
implicitWidth: 0
|
||||
implicitHeight: 0
|
||||
@@ -46,6 +51,5 @@ Singleton {
|
||||
item: null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user