rofi-yubikey/README.md
2025-01-01 16:33:34 +10:00

56 lines
1.7 KiB
Markdown

# Rofi-YubiKey
A no-bloat script for getting OATH codes from a YubiKey.
# 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 below 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 keybinds. Simply make a keybind run the script.
However, if you are unfamiliar, this is how I do it:
1. Import `EZConfig`:
Import the following:
``` haskell
import XMonad.Util.EZConfig
```
2. Add `additionalKeysP` to your defaults variable.
``` haskell
defaults = def {
-- REST OF CONFIG HERE
} `additionalKeysP` myAddKeys
```
2.a. Make sure `defaults` is being used
Add `defaults` to `main = ...`
For example:
``` haskell
main :: IO()
main = xmonad . <your-confif-here> $ defaults
```
3. Define `myAddKeys`
``` haskell
-- 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")
]
```
*PR requests are open if anyone would like to add documentation for other window managers, etc*