31 lines
815 B
Nix
31 lines
815 B
Nix
{ config, pkgs, ... }:
|
|
|
|
let
|
|
bash = "${pkgs.bash}/bin/bash";
|
|
wofi = "${pkgs.wofi}/bin/wofi";
|
|
pass = "${pkgs.pass}/bin/pass";
|
|
wtype = "${pkgs.wtype}/bin/wtype";
|
|
xargs = "${pkgs.findutils}/bin/xargs";
|
|
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
|
|
prefix = "${config.home.homeDirectory}/.password-store";
|
|
in
|
|
pkgs.writeScriptBin "wofi-pass" ''
|
|
#!${bash}
|
|
|
|
password_files=( "${prefix}"/**/*.gpg )
|
|
password_files=( "''${password_files[@]#"${prefix}"/}" )
|
|
password_files=( "''${password_files[@]%.gpg}" )
|
|
|
|
sel=$(
|
|
printf '%s\n' "''${password_files[@]}" | \
|
|
${wofi} --dmenu "$@"
|
|
)
|
|
|
|
#[ -n "''${sel}" ] && \
|
|
# ${pass} show "''${sel}" | \
|
|
# ${xargs} ${wtype}
|
|
|
|
[ -n "''${sel}" ] && \
|
|
${pass} show "''${sel}" | ${wl-copy}
|
|
''
|