From 02192368d2c5d99fff0cc819a91f9388c4be3902 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 13 Oct 2025 12:16:42 +0200 Subject: [PATCH] add option to use hyprlock instead of quickshell --- .config/quickshell/ii/GlobalStates.qml | 17 -------------- .../quickshell/ii/modules/common/Config.qml | 1 + .config/quickshell/ii/modules/lock/Lock.qml | 23 +++++++++++++++++++ .../ii/modules/settings/InterfaceConfig.qml | 12 ++++++++++ 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.config/quickshell/ii/GlobalStates.qml b/.config/quickshell/ii/GlobalStates.qml index caf94ab16..62eb69ce6 100644 --- a/.config/quickshell/ii/GlobalStates.qml +++ b/.config/quickshell/ii/GlobalStates.qml @@ -28,23 +28,6 @@ Singleton { property bool superReleaseMightTrigger: true property bool workspaceShowNumbers: false - Connections { - target: Config - function onReadyChanged() { - if (Config.options.lock.launchOnStartup && Config.ready && Persistent.ready && Persistent.isNewHyprlandInstance) { - GlobalStates.screenLocked = true; - } - } - } - Connections { - target: Persistent - function onReadyChanged() { - if (Config.options.lock.launchOnStartup && Config.ready && Persistent.ready && Persistent.isNewHyprlandInstance) { - GlobalStates.screenLocked = true; - } - } - } - onSidebarRightOpenChanged: { if (GlobalStates.sidebarRightOpen) { Notifications.timeoutAll(); diff --git a/.config/quickshell/ii/modules/common/Config.qml b/.config/quickshell/ii/modules/common/Config.qml index 6621d1643..3cb5edef6 100644 --- a/.config/quickshell/ii/modules/common/Config.qml +++ b/.config/quickshell/ii/modules/common/Config.qml @@ -299,6 +299,7 @@ Singleton { } property JsonObject lock: JsonObject { + property bool useHyprlock: false property bool launchOnStartup: false property JsonObject blur: JsonObject { property bool enable: false diff --git a/.config/quickshell/ii/modules/lock/Lock.qml b/.config/quickshell/ii/modules/lock/Lock.qml index 4b086970f..76cbfe17a 100644 --- a/.config/quickshell/ii/modules/lock/Lock.qml +++ b/.config/quickshell/ii/modules/lock/Lock.qml @@ -112,6 +112,10 @@ Scope { description: "Locks the screen" onPressed: { + if (Config.options.lock.useHyprlock) { + Quickshell.execDetached(["hyprlock"]) + return; + } GlobalStates.screenLocked = true; } } @@ -125,4 +129,23 @@ Scope { lockContext.shouldReFocus(); } } + + Connections { + target: Config + function onReadyChanged() { + print("lock after config") + if (Config.options.lock.launchOnStartup && Config.ready && Persistent.ready && Persistent.isNewHyprlandInstance) { + Hyprland.dispatch("global quickshell:lock") + } + } + } + Connections { + target: Persistent + function onReadyChanged() { + print("lock after persistent") + if (Config.options.lock.launchOnStartup && Config.ready && Persistent.ready && Persistent.isNewHyprlandInstance) { + Hyprland.dispatch("global quickshell:lock") + } + } + } } diff --git a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml index 6828625f5..cb67a7e90 100644 --- a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml +++ b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml @@ -462,6 +462,18 @@ ContentPage { icon: "lock" title: Translation.tr("Lock screen") + ConfigSwitch { + buttonIcon: "water_drop" + text: Translation.tr('Use Hyprlock (instead of Quickshell)') + checked: Config.options.lock.useHyprlock + onCheckedChanged: { + Config.options.lock.useHyprlock = checked; + } + StyledToolTip { + text: Translation.tr("If you want to somehow use fingerprint unlock...") + } + } + ConfigSwitch { buttonIcon: "account_circle" text: Translation.tr('Launch on startup')