A no-bloat script for getting OATH codes from a YubiKey.
Go to file
2025-01-01 17:09:36 +10:00
LICENSE Initial commit 2025-01-01 16:14:23 +10:00
README.md Gitea doesn't allow users to make a PR when signed out 2025-01-01 17:09:36 +10:00
rofi-yubikey.sh First commit 2025-01-01 16:33:34 +10:00

Rofi-YubiKey

A no-bloat script for getting OATH codes from a YubiKey.

Requirements

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:

  1. Import EZConfig: Import the following:
import XMonad.Util.EZConfig 
  1. 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
  1. 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")
    ]