mattydebie / bitwarden-rofi

Wrapper for Bitwarden https://github.com/bitwarden/cli and Rofi
GNU General Public License v3.0
346 stars 56 forks source link
bitwarden rofi

Bitwarden Rofi Menu

This is a work in progress to get the BitWarden cli functionality in an easy Rofi menu. On selecting an entry, the password is copied to your clipboard for 5 seconds. During those 5 seconds, a notification is shown indicating which password you are copying at that time.

bitwarden-rofi

Usage

You can either execute the script from a terminal or by binding it to a key combination in your window manager.

bwmenu 0.5

Usage:
  bwmenu [options] -- [rofi options]

Options:
  --help
      Show this help text and exit.

  --version
      Show version information and exit.

  --auto-lock <SECONDS>
      Automatically lock the Vault <SECONDS> seconds after last unlock.
      Use 0 to lock immediatly.
      Use -1 to disable.
      Default: 900 (15 minutes)

  -c <SECONDS>, --clear <SECONDS>, --clear=<SECONDS>
      Clear password from clipboard after this many seconds.
      Defaults: 5 seconds.

  -C, --no-clear
      Don't automatically clear the password from the clipboard. This disables
      the default --clear option.

  --show-password
      Show the first 4 characters of the copied password in the notification.

Quick Actions:
  When hovering over an item in the rofi menu, you can make use of Quick Actions.

  Alt+r  Resync your vault

  Alt+u  Search through urls
  Alt+n  Search through names
  Alt+c  Search through folders

  Alt+t  Copy the TOTP
  Alt+1  Autotype the username and password [needs xdotool (Xorg) / ydotool (Wayland)]
  Alt+2  Autotype the username [needs xdotool (Xorg) / ydotool (Wayland)]
  Alt+3  Autotype the password [needs xdotool (Xorg) / ydotool (Wayland)]

  Alt+L  Lock your vault

Examples:
  # Default options work well
  bwmenu

  # Immediatly lock the Vault after use
  bwmenu --auto-lock 0

  # Never lock the Vault
  bwmenu --auto-lock -1

  # Place rofi on top of screen, like a Quake console
  bwmenu -- -location 2

Functions

Auto Typing

You can use bitwarden-rofi to auto type your username, password or both by using xdotool/ydotool to autofill forms.

Wayland Users: For autotyping to work in Wayland, you will need ydotool working with root permissions (it needs access to /dev/uinput) without asking for password. For example, this can be achieved by adding this line in visudo:

your_username ALL=(ALL) NOPASSWD: /usr/bin/ydotool

Install

Via package managers

Packaging status

Arch Linux (AUR)

Install the bitwarden-rofi AUR package for the latest release or the bitwarden-rofi-git for the current master.
For copying or autotyping, install:

Via source

Install these required dependencies:

Gentoo Users: It appears Gentoo does not provide a kernel with keyctl. If so, make sure to install this as well

Optionally install these requirements:

Then download the script file and place it somewhere on your $PATH and grant it the +x permission.

# Install for all users
sudo install -D --mode=755 --group=root --owner=root bwmenu /usr/local/bin/bwmenu

# Install for yourself
mkdir -p ~/.local/bin && \
  cp bwmenu ~/.local/bin/bwmenu && \
  chmod +x ~/.local/bin/bwmenu

Hall of Fame

License

Released under the GNU General Public License, version 3. See LICENSE file.

Copyright © 2018-2023