forked from Shinonome/dots-hyprland
1ee08fca51
- 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)
24 lines
588 B
Bash
Executable File
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
|