Files
illogical-impulse/dots/.config/quickshell/ii/scripts/keyring/unlock.sh
T
end-4 1ee08fca51 keyringstorage: properly handle keyring fetching (#2108)
- if auto lock enabled, don't do anything and wait for lock password
- not try to overwrite and don't consider loaded when unlocking fails
- retry unlock and re fetch on demand (ai request)
2025-11-02 23:20:01 +01:00

24 lines
588 B
Bash
Executable File

#!/usr/bin/env bash
# Based on https://unix.stackexchange.com/a/602935
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Skip if already unlocked
if "${SCRIPT_DIR}/is_unlocked.sh"; then
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