Skip to content
Snippets Groups Projects
Unverified Commit 12171fe6 authored by Varac's avatar Varac
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
# Ulauncher rbw extension
Lets you search for Bitwarden passwords using [rbw](https://github.com/doy/rbw).
Uses the new [API v3](https://github.com/Ulauncher/Ulauncher/blob/v6/docs/extensions/tutorial.rst).
## To-do
- Fuzzy matching
images/bitwarden-icon.png

5.37 KiB

main.py 0 → 100644
# noqa: INP001
"""rbw ulauncher extension."""
import logging
import subprocess
from ulauncher.api import Extension, Result
from ulauncher.api.shared.action.ExtensionCustomAction import ExtensionCustomAction
from ulauncher.internals import actions
class RbwExtension(Extension):
"""rbw extension."""
def on_input(self, input_text: str, trigger_id: str) -> list: # noqa: ARG002
"""Filter entries by input_text."""
matching = [s for s in entries if input_text in s[1] + s[2]]
for entry in matching:
data = {"id": entry[0]}
yield Result(
name=entry[1],
description=entry[2],
on_enter=ExtensionCustomAction(data),
)
def on_item_enter(self, data: dict) -> None:
"""Copy password for entry to clipboard."""
# logging.info("rbw extension: entry selected: id=%s", data["id"])
pw = subprocess.check_output(["rbw", "get", data["id"]]).decode("utf-8") # noqa: S607
return actions.copy(pw)
if __name__ == "__main__":
logging.info("rbw extension: started")
entries_str = subprocess.check_output(
["rbw", "list", "--fields", "id,name,user"] # noqa: S607
).decode("utf-8")
entries_raw = entries_str.splitlines()
entries = [entry.split("\t") for entry in entries_raw]
logging.info("rbw extension: Loaded entries %s", len(entries))
RbwExtension().run()
{
"api_version": "3",
"authors": "Varac",
"name": "rbw",
"icon": "./images/bitwarden-icon.png",
"instructions": "Get passwords from Bitwarden using rbw.",
"preferences": [
{
"id": "rbw",
"type": "keyword",
"name": "rbw",
"default_value": "rbw"
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment