Replace --custom-field, --kb-accept, and --kb-custom CLI flags with a YAML config file at $XDG_CONFIG_HOME/bw-menu/config.yaml. The config maps rofi key names to vault fields (e.g. Return: password), making keybinding configuration simpler and more intuitive.
107 lines
3.0 KiB
Markdown
107 lines
3.0 KiB
Markdown
# bw-menu
|
|
|
|
A rofi/fzf frontend for Bitwarden via the `rbw` CLI.
|
|
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
# dependencies
|
|
sudo dnf install -y rofi fzf wl-clipboard # or xclip instead of wl-clipboard
|
|
cargo install rbw
|
|
|
|
# install bw-menu
|
|
git clone https://git.navidsassan.ch/navid.sassan/bw-menu.git
|
|
cd bw-menu
|
|
uv sync
|
|
```
|
|
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# interactive selection (rofi)
|
|
bw-menu select
|
|
|
|
# interactive selection (fzf)
|
|
bw-menu select --selector fzf
|
|
|
|
# select and print to stdout instead of clipboard
|
|
bw-menu select --field username --print
|
|
|
|
# list recent selections
|
|
bw-menu history list
|
|
|
|
# get password of last selected entry
|
|
bw-menu history get 0 --field password
|
|
|
|
# get username and print to stdout
|
|
bw-menu history get 0 --field username --print
|
|
```
|
|
|
|
|
|
## Selectors
|
|
|
|
### rofi
|
|
|
|
Runs in rofi's [script mode](https://davatorium.github.io/rofi/current/rofi-script.5/). Recently used entries appear at the top with a clock icon. Custom input is disabled — only existing vault entries can be selected.
|
|
|
|
Default keybindings:
|
|
|
|
| Key | Action |
|
|
|--------------|-------------------|
|
|
| Enter | Copy **password** |
|
|
| Ctrl+Enter | Copy **username** |
|
|
| Escape | Cancel |
|
|
|
|
Keybindings are configurable via `$XDG_CONFIG_HOME/bw-menu/config.yaml` (defaults to `~/.config/bw-menu/config.yaml`):
|
|
|
|
```yaml
|
|
keybindings:
|
|
Return: password
|
|
Control+Return: username
|
|
```
|
|
|
|
Each entry maps a rofi key name to the vault field it copies. The first entry is bound to rofi's accept key, additional entries become custom keybindings.
|
|
|
|
### fzf
|
|
|
|
Launches fzf in the terminal with fuzzy matching. Recently used entries appear at the top, prefixed with `*`. Sorting is disabled so history entries stay on top.
|
|
|
|
| Key | Action |
|
|
|--------------|-----------------------------------------------------|
|
|
| Enter | Select the highlighted entry and copy to clipboard |
|
|
| Ctrl-C / Esc | Cancel without selecting |
|
|
|
|
|
|
## Options
|
|
|
|
| Flag | Description | Default |
|
|
|--------------------------|--------------------------------------|------------|
|
|
| `--selector rofi\|fzf` | Which selector UI to use | `rofi` |
|
|
| `--field password\|username\|totp` | Which field to retrieve (fzf / history) | `password` |
|
|
| `--print` | Print to stdout instead of clipboard | off |
|
|
|
|
The selected field is copied to the clipboard using `wl-copy` (Wayland) or `xclip` (X11). When `--print` is passed, the value is printed to stdout instead.
|
|
|
|
|
|
## History
|
|
|
|
Selections are saved to `$XDG_CACHE_HOME/bw-menu/history.json` (defaults to `~/.cache/bw-menu/history.json`), up to 10 entries. The most recent selection is at index 0.
|
|
|
|
|
|
## Sway keybindings
|
|
|
|
Example keybindings for `~/.config/sway/config`:
|
|
|
|
```
|
|
# open bw-menu selector
|
|
bindsym $mod+p exec bw-menu select
|
|
|
|
# copy password of last selected entry
|
|
bindsym $mod+Shift+p exec bw-menu history get 0 --field password
|
|
|
|
# copy username of last selected entry
|
|
bindsym $mod+Shift+u exec bw-menu history get 0 --field username
|
|
```
|