From 9f8e9ca03f7e7a6512a6429c063a7cabafb98293 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Aug 2022 19:32:27 -0300 Subject: bin/menu: Implement "yubikey" ACTION using ykman --- bin/menu | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'bin/menu') diff --git a/bin/menu b/bin/menu index 242c7c0..532e123 100755 --- a/bin/menu +++ b/bin/menu @@ -100,8 +100,8 @@ case "$ACTION" in CHOICE="$(pass_list | show 'username')" if [ -n "$CHOICE" ]; then if pass show -c2 "$CHOICE"; then - notify-send -t 5000 -u normal -- "$CHOICE" \ - 'username copied to clipboard' + notify-send -t 5000 -u normal -- \ + "$CHOICE" 'username copied to clipboard' fi fi ;; @@ -111,8 +111,8 @@ case "$ACTION" in echo trap 'clipctl enable' EXIT # FIXME echo clipctl disable if pass show -c1 "$CHOICE"; then - notify-send -t 5000 -u critical -- "$CHOICE" \ - 'password copied to clipboard' + notify-send -t 5000 -u critical -- \ + "$CHOICE" 'password copied to clipboard' fi fi ;; @@ -123,8 +123,14 @@ case "$ACTION" in clipmgr -l | show 'clipboard' | copy ;; yubikey) - echo 'yubikey-oath-dmenu' # FIXME - exit 2 + CHOICE="$(ykman oath accounts list | show 'OTP')" + if [ -n "$CHOICE" ]; then + ykman oath accounts code "$CHOICE" | + awk '{ print $(NF) }' | + copy -n + notify-send -t 5000 -u critical -- \ + "$CHOICE" 'code copied to clipboard' + fi ;; *) printf 'Bad ACTION: %s.\n\n' "$ACTION" >&2 -- cgit v1.2.3