115 lines
3.3 KiB
Markdown
115 lines
3.3 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 — see [Configuration](#configuration) for details.
|
|
|
|
### 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.
|
|
|
|
|
|
## Configuration
|
|
|
|
Config file location: `$XDG_CONFIG_HOME/bw-menu/config.yaml` (defaults to `~/.config/bw-menu/config.yaml`).
|
|
|
|
```yaml
|
|
keybindings:
|
|
password: Return
|
|
username: Control+Return
|
|
totp: Control+Shift+Return
|
|
```
|
|
|
|
Each entry maps a vault field to a [rofi key name](https://davatorium.github.io/rofi/current/rofi-keys.5/). Available fields: `password`, `username`, `totp`.
|
|
|
|
The **first** entry is bound to rofi's accept key (`kb-accept-entry`). Additional entries become custom keybindings (`kb-custom-1`, `kb-custom-2`, …).
|
|
|
|
|
|
## 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
|
|
```
|