l otpmenu: make wayland compatible

This commit is contained in:
lassulus 2023-07-23 23:16:07 +02:00
parent 2ff1c5d8aa
commit 56b93cb7f7

View File

@ -1,10 +1,11 @@
{ pkgs }: { pkgs }:
pkgs.writeDashBin "otpmenu" '' pkgs.writers.writeDashBin "otpmenu" ''
set -efux
x=$(${pkgs.pass}/bin/pass git ls-files '*/otp.gpg' \ x=$(${pkgs.pass}/bin/pass git ls-files '*/otp.gpg' \
| ${pkgs.gnused}/bin/sed 's:/otp\.gpg$::' \ | ${pkgs.gnused}/bin/sed 's:/otp\.gpg$::' \
| ${pkgs.dmenu}/bin/dmenu | ${pkgs.dmenu}/bin/dmenu
) )
otp=$(${(pkgs.pass.withExtensions (ext: [ ext.pass-otp ]))}/bin/pass otp code "$x/otp") otp=$(${(pkgs.pass.withExtensions (ext: [ ext.pass-otp ]))}/bin/pass otp code "$x/otp")
printf %s "$otp" | ${pkgs.xdotool}/bin/xdotool type -f - printf %s "$otp" | ${pkgs.wtype}/bin/wtype -s 1 - || printf %s "$otp" | ${pkgs.xdotool}/bin/xdotool type -f -
'' ''