diff options
-rwxr-xr-x | rofi/.local/bin/rofi-ykman | 33 | ||||
-rw-r--r-- | sway/.config/sway/config | 3 |
2 files changed, 36 insertions, 0 deletions
diff --git a/rofi/.local/bin/rofi-ykman b/rofi/.local/bin/rofi-ykman new file mode 100755 index 0000000..3d4ca99 --- /dev/null +++ b/rofi/.local/bin/rofi-ykman @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# rofi-ykman +# Yubikey oath utility + +#2019 nukeop + +if [ ! "$(ykman info)" ]; then + notify-send "rofi-ykman" "Yubikey not detected." -a "rofi-ykman" + exit 1 +fi + +OPTIONS=$(ykman oath accounts list) +LAUNCHER="rofi -dmenu -i -p YubikeyOATH" + +option=$(echo "${OPTIONS/, TOTP/\n}" | $LAUNCHER) +code=$(ykman oath accounts code "$option") +IFS=', ' read -r -a code <<<"$code" +if [ "$XDG_SESSION_TYPE" == "wayland" ]; then + cliptool=wl-copy + typer="wtype -" +else + cliptool="xclip -selection clipboard" + typer="xargs xdotool type" +fi +if [ "$1" == "type" ]; then + action=$typer +else + action=$cliptool +fi + +notify-send "rofi-ykman" "Touch Yubikey..." -a "rofi-ykman" +echo "${code[-1]}" | $action diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 1065d1c..bd7a47b 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -217,6 +217,9 @@ bindsym $mod+v exec clipman pick --tool=rofi # Password manager bindsym $mod+b exec rofi-rbw +# Yubikey TOTP manager +bindsym $mod+y exec rofi-ykman + include ~/.config/sway/config.d/* include /etc/sway/config.d/* |