(desktop) Gen 484: Improved keyring formatting

This commit is contained in:
pagedMov
2024-10-14 05:47:25 -04:00
parent 32ae27ac0a
commit 694e373b94
4 changed files with 117 additions and 7 deletions

View File

@@ -3,17 +3,18 @@
pkgs.writeShellScriptBin "passhelper" (''
#!/run/current-system/sw/bin/bash
# prevent multiple instances, conditional check happens in the hyprland bind
# prevent multiple instances, conditional check happens in the hyprland bind
touch /tmp/passhelperfile
trap "[ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile" EXIT SIGHUP SIGINT
# get passwords from password store, remove .password store/ prefix and .gpg suffix, exlude .gpg-id file, open results in fzf
# get passwords from password store, remove .password store/ prefix and .gpg suffix, exlude .gpg-id file, open results in fzf
pass_string=$(find $HOME/.password-store -type f | sed 's|.*/.password-store/||; s|\.gpg$||' | sed 's|^\([^/]*\)|\x1b[32m\1\x1b[0m|' | rg -v "\.git|.gpg-id" | sort -r | fzf --border --border-label="$(whoami)'s keyring" --ansi --layout=reverse)
[ $? = 0 ] || { [ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile; exit 1; }
pass -c "$pass_string"
sleep 1.5
# pass it through fmt for soft word wrapping
pass -c "$pass_string" | fmt -w 45
/run/current-system/sw/bin/rm /tmp/passhelperfile
sleep 1.5
exit 0
'')

View File

@@ -0,0 +1,17 @@
#!/run/current-system/sw/bin/bash
# prevent multiple instances, conditional check happens in the hyprland bind
touch /tmp/passhelperfile
trap "[ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile" EXIT SIGHUP SIGINT
# get passwords from password store, remove .password store/ prefix and .gpg suffix, exlude .gpg-id file, open results in fzf
pass_string=$(find $HOME/.password-store -type f | sed 's|.*/.password-store/||; s|\.gpg$||' | sed 's|^\([^/]*\)|\x1b[32m\1\x1b[0m|' | rg -v "\.git|.gpg-id" | sort -r | fzf --border --border-label="$(whoami)'s keyring" --ansi --layout=reverse)
[ $? = 0 ] || { [ -f /tmp/passhelperfile ] && /run/current-system/sw/bin/rm /tmp/passhelperfile; exit 1; }
# pass it through fmt for soft word wrapping
pass -c "$pass_string" | fmt -w 45
/run/current-system/sw/bin/rm /tmp/passhelperfile
sleep 10
exit 0