mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
lock: also unlock keyring on unlock
This commit is contained in:
@@ -268,6 +268,7 @@ Singleton {
|
||||
}
|
||||
property bool centerClock: true
|
||||
property bool showLockedText: true
|
||||
property bool unlockKeyring: true
|
||||
}
|
||||
|
||||
property JsonObject media: JsonObject {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import qs
|
||||
import qs.modules.common
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pam
|
||||
@@ -55,6 +56,7 @@ Scope {
|
||||
onCompleted: result => {
|
||||
if (result == PamResult.Success) {
|
||||
root.unlocked();
|
||||
if (Config.options.lock.unlockKeyring) root.unlockKeyring();
|
||||
} else {
|
||||
root.showFailure = true;
|
||||
GlobalStates.screenUnlockFailed = true;
|
||||
@@ -64,4 +66,13 @@ Scope {
|
||||
root.unlockInProgress = false;
|
||||
}
|
||||
}
|
||||
|
||||
function unlockKeyring() {
|
||||
Quickshell.execDetached({
|
||||
environment: ({
|
||||
UNLOCK_PASSWORD: root.currentText
|
||||
}),
|
||||
command: ["bash", "-c", Quickshell.shellPath("scripts/keyring/unlock.sh")]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# Based on https://unix.stackexchange.com/a/602935
|
||||
|
||||
# Skip if already unlocked
|
||||
locked_state=$(busctl --user get-property org.freedesktop.secrets \
|
||||
/org/freedesktop/secrets/collection/login \
|
||||
org.freedesktop.Secret.Collection Locked)
|
||||
if [[ "${locked_state}" == "b false" ]]; then
|
||||
echo 'Keyring is already unlocked.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prompt for password if not provided
|
||||
if [[ -z "${UNLOCK_PASSWORD}" ]]; then
|
||||
echo -n 'Login password: ' >&2
|
||||
read -s UNLOCK_PASSWORD || return
|
||||
fi
|
||||
|
||||
# Unlock
|
||||
killall -q -u "$(whoami)" gnome-keyring-daemon
|
||||
eval $(echo -n "${UNLOCK_PASSWORD}" \
|
||||
| gnome-keyring-daemon --daemonize --login \
|
||||
| sed -e 's/^/export /')
|
||||
unset UNLOCK_PASSWORD
|
||||
echo '' >&2
|
||||
Reference in New Issue
Block a user