LICENSE | ||
README.md | ||
rofi-yubikey.sh |
Rofi-YubiKey
A no-bloat script for getting OATH codes from a YubiKey.
Requirements
- ykman - interfacing with YubiKeys
(
sudo pacman -S yubikey-manager
on Arch Linux - see https://wiki.archlinux.org/title/YubiKey#Management_tools) - xclip - copying the code to the clipboard
(
sudo pacman -S xclip
on Arch Linux) - rofi - displaying a GUI for the codes
(
sudo pacman -S rofi
on Arch Linux - see https://wiki.archlinux.org/title/Rofi) - awk - formatting command outputs (you should already have this installed)
Usage
Either only download rofi-yubikey.sh
, or clone the entire repository (git clone https://git.solomon.tech/solomon/rofi-yubikey.git
).
Once you have the script on your computer, move it to wherever you desire. I personally use, and recommend ~/.local/bin/rofi-yubikey.sh
.
After that, simply execute the script. For example, if you placed the script in ~/.local/bin/rofi-yubikey.sh
, you could run any of the following commands:
sh ~/.local/bin/rofi-yubikey.sh
bash ~/.local/bin/rofi-yubikey.sh
~/.local/bin/rofi-yubikey.sh
(only pick one!)
Integration with Window Managers
Note: I will only be documenting XMonad, because I cannot guarantee the validity of my advice regarding different window managers.
If you are using XMonad, you likely already know how to set custom keybindings. Simply make a keybinding run the script. However, if you are unfamiliar, this is how I do it:
- Import
EZConfig
: Import the following:
import XMonad.Util.EZConfig
- Add
additionalKeysP
to your defaults variable.
defaults = def {
-- REST OF CONFIG HERE
} `additionalKeysP` myAddKeys
2.a. Make sure defaults
is being used
Add defaults
to main = ...
For example:
main :: IO()
main = xmonad . <your-config-here> $ defaults
- Define
myAddKeys
-- Add custom keys
myAddKeys =
-- This firefox keybinding is here to show you how to add multiple keybindings
[ ("M-b", spawn "firefox")
, ("M-<Backspace>", spawn "/home/USERNAME/.local/bin/rofi-yubikey.sh")
]