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
xclip
options:yubikey-oath-dmenu --clipboard-cmd "xclip -selection clipboard"
-
Customize
wl-copy
options:yubikey-oath-dmenu --clipboard-cmd "wl-copy --paste-once"
-
Customize
dmenu
options: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
--notify
option, which usesnotify-send
- pinentry: To prompt for the YubiKey OATH password when needed
- xdotool: For the
--type
option under X11 - wtype: For the
--type
option under Wayland (xdotool
might also work) - A clipboard tool: For the
--clipboard
option, for example xclip or wl-clipboard
-
Arch Linux: AUR package
-
Others: Place
yubikey-oath-dmenu.py
with 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
DESTDIR
andPREFIX
variables:$ 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: