mattydebie / bitwarden-rofi

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

Feature: Secondary actions menu #32

Open nwallace opened 5 years ago

nwallace commented 5 years ago

I would often like more options when interacting with the items in my vault. Currently, bwmenu allows you to:

  1. Copy your password
  2. Copy your TOTP
  3. Auto-type username
  4. Auto-type password
  5. Auto-type username & password

Here are some things I would love to be able to do, but currently cannot:

  1. Open the item's URI in my default browser
  2. Copy the username and password at the same time (one to clipboard, the other to primary selection)
  3. Copy the username and password while opening the URI in my browser
  4. Copy custom fields
  5. ??

This pull request is a work-in-progress take on how this could work. With these changes, when you select a vault item with Enter, instead of copying the password, it opens a second menu that provides you with a list of actions for that item, which execute when selected.

The list of actions is dynamic and particular to the selected item. If the item doesn't have a URI, the URI-related actions aren't included. Actions should depend, also, on the type of item (credit card, login item, identity, etc).

I think the additional abilities and control you get with this secondary menu are great. Being able to copy both your username and password at the same time is a huge speed boon as well.

The code is not ready to be merged yet, but I wanted to open the PR now anyway to start the discussion. Is this something you'd be interested in? I don't believe there need to be any real drawbacks.

Here's the current status of the code:

nwallace commented 5 years ago

@mattydebie Have you had a chance to try this out? It's mostly fleshed out, but there are refactorings I think would be great, but some of the existing functionality will be difficult (though not impossible) to preserve.

The biggest behavior that's going to be difficult to preserve is the Alt shortcuts for copying & autotyping. At the moment, they work, but the code for the Alt shortcut duplicates knowledge in the secondary menu generation. I'd like to DRY that up, and I have an idea to do so that might work, but it's going to get pretty ugly because Bash just doesn't have great support for structured data.

Personally, I think this secondary menu is better than the Alt shortcuts, but it would be slower for someone with muscle memory for the Alt shortcuts. Can I ditch them, or should I try to preserve them with some wild bashery?