Make password manager script for fuzzel, currently only on niri desktop

configuration
This commit is contained in:
Curt Spark 2024-08-04 18:21:35 +01:00
parent 7920ff7382
commit cd572d460b
2 changed files with 28 additions and 0 deletions

View File

@ -37,6 +37,33 @@ in
swaybg -i ${config.home.homeDirectory}/Pictures/Wallpapers/justfriends.png &
wlsunset -l 51.5 -L 0.1 &
'')
(writeShellScriptBin "fuzzel-pass"
''
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
prefix=''${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "''${password_files[@]#"$prefix"/}" )
password_files=( "''${password_files[@]%.gpg}" )
password=$(printf '%s\n' "''${password_files[@]}" | fuzzel --background=fbf1c7ff --border-color=d79921ff --text-color=3c3836ff --match-color=f9f5d7ff --selection-color=d79921ff --selection-text-color=fbf1c7ff --dmenu "$@")
[[ -n $password ]] || exit
if [[ $typeit -eq 0 ]]; then
pass_output=$(pass show -c "$password" 2>/dev/null)
notify-send "$pass_output"
else
pass_output=$(pass show "$password" | { IFS= read -r pass; printf %s "$pass"; })
notify-send "$pass_output"
fi
'')
];
home.sessionVariables = {

View File

@ -259,6 +259,7 @@ binds {
Alt+Return { spawn "foot"; }
Alt+D { spawn "fuzzel" "--background=fbf1c7ff" "--border-color=d79921ff" "--text-color=3c3836ff" "--match-color=f9f5d7ff" "--selection-color=d79921ff" "--selection-text-color=fbf1c7ff"; }
Super+L { spawn "swaylock"; }
Ctrl+Alt+P { spawn "fuzzel-pass"; }
// You can also use a shell:
// Alt+T { spawn "bash" "-c" "notify-send hello && exec alacritty"; }