l otpmenu: make wayland compatible

This commit is contained in:
lassulus 2023-07-23 23:16:07 +02:00
parent 2ff1c5d8aa
commit 56b93cb7f7
1 changed files with 3 additions and 2 deletions

View File

@ -1,10 +1,11 @@
{ pkgs }:
pkgs.writeDashBin "otpmenu" ''
pkgs.writers.writeDashBin "otpmenu" ''
set -efux
x=$(${pkgs.pass}/bin/pass git ls-files '*/otp.gpg' \
| ${pkgs.gnused}/bin/sed 's:/otp\.gpg$::' \
| ${pkgs.dmenu}/bin/dmenu
)
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 -
''