Skip to content

Commit

Permalink
Fix open keychain-db with absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
sschmid committed May 18, 2024
1 parent fb6adf8 commit e18555c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/plugins/macos_keychain/plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ PW_ACCOUNT=""
declare -ig PW_FZF=0

pw::init() { security create-keychain -P "${PW_KEYCHAIN}"; }
pw::open() { open -a "Keychain Access" ~/Library/Keychains/"${PW_KEYCHAIN}"; }

pw::open() {
if [[ -f "${PW_KEYCHAIN}" ]]; then
open -a "Keychain Access" "${PW_KEYCHAIN}"
elif [[ -f "${HOME}/Library/Keychains/${PW_KEYCHAIN}" ]]; then
open -a "Keychain Access" "${HOME}/Library/Keychains/${PW_KEYCHAIN}"
fi
}

pw::lock() { security lock-keychain "${PW_KEYCHAIN}"; }
pw::unlock() { security unlock-keychain "${PW_KEYCHAIN}"; }

Expand Down

0 comments on commit e18555c

Please sign in to comment.