aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-08-16 19:32:27 -0300
committerEuAndreh <eu@euandre.org>2022-08-16 19:32:44 -0300
commit9f8e9ca03f7e7a6512a6429c063a7cabafb98293 (patch)
treea49b35b7e5d902185738b30be12e24e365202aa0 /bin
parentbin/lines: Add working version (diff)
downloaddotfiles-9f8e9ca03f7e7a6512a6429c063a7cabafb98293.tar.gz
dotfiles-9f8e9ca03f7e7a6512a6429c063a7cabafb98293.tar.xz
bin/menu: Implement "yubikey" ACTION using ykman
Diffstat (limited to 'bin')
-rwxr-xr-xbin/menu18
1 files changed, 12 insertions, 6 deletions
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