1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/packages/passmenu.nix

19 lines
643 B
Nix
Raw Permalink Normal View History

2025-08-26 07:50:31 +02:00
{ writers, wofi, pass, fd, libnotify, ... }:
2025-08-26 07:19:54 +02:00
writers.writeBashBin "passmenu" ''
shopt -s nullglob globstar
IFS=$'\n'
2025-08-26 07:50:31 +02:00
prefix=$(readlink -f ''${PASSWORD_STORE_DIR-~/.password-store})
password_files=( $( ${fd}/bin/fd -L ".gpg\$" "$prefix" ) )
password_files=( "''${password_files[@]#"$prefix"/}" )
password_files=( "''${password_files[@]%.gpg}" )
2025-08-26 07:19:54 +02:00
2025-08-26 07:50:31 +02:00
password=$( printf '%s\n' "''${password_files[@]}" | ${wofi}/bin/wofi -i -k /dev/null -d menu -- "$@" )
2025-08-26 07:19:54 +02:00
[[ -n $password ]] || exit
OUT=$(${pass}/bin/pass show --clip "$password")
${libnotify}/bin/notify-send -t 5000 "$(echo "$OUT" | grep '^login:' | sed 's/^login: //')"
''