dmenu interface for getting OATH codes from a YubiKey
This program lets you pick an OATH credential from your YubiKey using dmenu, and copies the corresponding OTP to the clipboard. Alternatively, it can "type" the OTP using xdotool on X11 or wtype on Wayland.
Notable features:
- Pick between all credentials on all connected YubiKeys
- No mouse interaction required
Invoke with --help to see the command line options.
$ yubikey-oath-dmenu --help
Recommended usage is to map your preferred command line to a shortcut in your window manager or desktop environment. For example, you could bind it to Super+o and Super+Shift+o in i3wm like this:
# Grab OTPs from ykman oath
bindsym $mod+o exec yubikey-oath-dmenu --notify --clipboard
bindsym $mod+Shift+o exec yubikey-oath-dmenu --notify --type
Example invocations:
-
Copy OTP to primary clipboard, no notifications
yubikey-oath-dmenu --clipboard -
Use notifications for feedback and type the OTP into the focused window:
yubikey-oath-dmenu --notify --type -
Copy the OTP to clipboard, type it and print it on standard output:
yubikey-oath-dmenu --clipboard --type --stdout -
Customize
xclipoptions:yubikey-oath-dmenu --clipboard-cmd "xclip -selection clipboard" -
Customize
wl-copyoptions:yubikey-oath-dmenu --clipboard-cmd "wl-copy --paste-once" -
Customize
dmenuoptions:yubikey-oath-dmenu --menu-cmd 'dmenu -p "Credential to copy:"'
- Python 3
- Click
- dmenu
- YubiKey Manager Python library, version 4.0.0 or later
Optional dependencies:
- libnotify: For the
--notifyoption, which usesnotify-send - pinentry: To prompt for the YubiKey OATH password when needed
- xdotool: For the
--typeoption under X11 - wtype: For the
--typeoption under Wayland (xdotoolmight also work) - A clipboard tool: For the
--clipboardoption, for example xclip or wl-clipboard
-
Arch Linux: AUR package
-
Others: Place
yubikey-oath-dmenu.pywith executable mode somewhere on your$PATH./usr/local/bin/probably works, for example. The included Makefile provides targets for this:# make install install -D -m755 "yubikey-oath-dmenu.py" "/usr/local/bin/yubikey-oath-dmenu" # make uninstall rm "/usr/local/bin/yubikey-oath-dmenu"Both targets respect the standard
DESTDIRandPREFIXvariables:$ make DESTDIR=/tmp/yubikey-oath-dmenu PREFIX=/usr install install -D -m755 "yubikey-oath-dmenu.py" "/tmp/yubikey-oath-dmenu/usr/bin/yubikey-oath-dmenu"
Big thanks to our contributors: