Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom item formatting and global search #12

Open
AndreasBackx opened this issue Apr 19, 2019 · 2 comments
Open

Custom item formatting and global search #12

AndreasBackx opened this issue Apr 19, 2019 · 2 comments

Comments

@AndreasBackx
Copy link
Contributor

I've been using the great tool for a day now and I feel like I'm not seeing all of the information that I want to see or that it's not searching for the information I want it to search for. The Bitwarden's apps all search everywhere and then show this information in an overview similar to this:

---------
|favicon|  Entry name
|       |  Username
---------

The favicon gives away what website it's from, so without a GUI we can replace that with the domain (e.g. accounts.google.com). The entry name and username is something we can easily show. If this information is all shown at once, I assume we can search for it with rofi. Could this behaviour be added so there is 1 search bar that will get you everthing you need?

If we could fire up bwmenu with --item-format that would allow you to input a string that is then formatted and allows for a few parameters:

  • %name: Name of the password entry.
  • %username: Username on the service.
  • %website: Hostname of the website (github.com shortened from https://github.com/login, same as the Bitwarden extension shows).
  • %type: login, card, identity, or secure note.
  • %folder: the folder it is in.

This would allow for everyone to search for what he needs and not even show what they don't want because it is configurable. Perhaps if it is possible, we could have a separate search list that contains everything and then only show some part of that information. E.g.: for the entry for account.google.com with [email protected] and entry name Private, we could search for "Private", "google", or "[email protected]" (or combine them) and all see the entry we're looking for, but then configure it to only show "[email protected] (account.google.com)".

@AndreasBackx AndreasBackx changed the title Allow for a personalised format Custom item formatting and global search Apr 19, 2019
@Mange
Copy link
Contributor

Mange commented Apr 20, 2019

I suggest you try to implement some basic proof-of-concept of this feature; it'd be nice to have a working prototype to look at.


rofi has a -markup-rows option that allows some basic Pango formatting of strings (enabling colors, bold, italics, etc.), which could also be helpful showing more information.

@remyrd
Copy link

remyrd commented May 8, 2019

Were you thinking of something like this? imagining the string in jq's output is parametrized.

show_items() {
  if item=$(
    echo "$ITEMS" \
    | jq -r '.[] | select(has("login")) | if .login.uris[0] then "\(.name) :: \(.login.username) :: \(.login.uris[].uri)"  else "\(.name) :: \(.login.username)" end' \
    | rofi_menu
  ); then
  item=$(echo "$ITEMS" | jq -r ".[] | select(.name == \"$(echo $item | cut -d ' ' -f1)\")")
    copy_password "$(echo $item | cut -d ' ' -f1)"
  else
    on_rofi_exit $? "$(echo $item | cut -d ' ' -f1)"
  fi
}

Which feeds rofi with items following this format:
<name> :: <login.username>[ :: <login.uris[?].uri>]

The drawback feature? is each entry corresponds to a single uri (if any) from the login.uris array. And will behave the same way with any array it may encounter within an item, eg. collectionIds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants