# 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 # requires rbw >= 1.14.0 # install bw-menu git clone https://git.navidsassan.ch/navid.sassan/bw-menu.git 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** | | Shift+Enter | Copy **totp** | | 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\|name` | 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 `max_history_entries` entries (default 5). The most recent selection is at index 0. ## Configuration Config file location: `$XDG_CONFIG_HOME/bw-menu/config.yaml` (or `config.yml`), defaults to `~/.config/bw-menu/config.yaml`. ```yaml rbw_path: '~/.cargo/bin/rbw' max_history_entries: 5 keybindings: password: 'Return' username: 'Control+Return' totp: 'Shift+Return' ``` | Key | Description | Default | |------------------------|----------------------------------------------------|------------| | `rbw_path` | Path to the `rbw` binary (`~` is expanded) | `rbw` | | `max_history_entries` | Maximum number of history entries to keep/display | `5` | | `keybindings` | Map of vault fields to rofi key names (see below) | see above | ### `keybindings` 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`, `name`. The **first** entry is bound to rofi's accept key (`kb-accept-entry`). Additional entries become custom keybindings (`kb-custom-1`, `kb-custom-2`, …). ### `rbw_path` By default, `bw-menu` calls `rbw` from `$PATH`. If `rbw` is not on your PATH (e.g. when launching via `swaymsg exec`), set `rbw_path` to the full path of the binary. **Note:** `rbw` must be unlocked before launching `bw-menu` from a window manager keybinding. `rbw unlock` requires pinentry, which cannot run without a terminal. Run `rbw unlock` manually in a terminal once after login — the session stays unlocked until the configured idle timeout. ## Inspired by - [rofi-rbw](https://github.com/fdw/rofi-rbw) ## Limitations - **No collections support.** Entries are displayed with their folder path (e.g. `foldername/itemname`), but Bitwarden collections are not shown. This is a limitation of `rbw`, which [does not expose collection data](https://github.com/doy/rbw). ## 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 ```