.+?)$", output, flags=re.I | re.M
)
if match:
password = match.group("value")
else:
raise RuntimeError(f"The field {field} was not found in the pass file.")
else:
password = output.split("\n", 1)[0]
try:
gpaste.AddPassword(name, password, dbus_interface="org.gnome.GPaste1")
except dbus.DBusException:
gpaste.AddPassword(name, password, dbus_interface="org.gnome.GPaste2")
def send_password_to_native_clipboard(self, base_args, name, field=None):
if field is not None:
raise RuntimeError("This feature requires GPaste.")
if self.password_mode == "bw":
p1 = subprocess.Popen(base_args + [name], stdout=subprocess.PIPE)
p2 = subprocess.run(self.clipboard_executable, stdin=p1.stdout)
if p1.returncode or p2.returncode:
raise RuntimeError(
f"Error while running rbw: got return codes: {p1.returncode} {p2.returncode}."
)
else:
result = subprocess.run(base_args + ["-c", name])
if result.returncode:
raise RuntimeError(
f"Error while running pass: got return code: {result.returncode}."
)
def send_password_to_clipboard(self, name):
if name.startswith(":"):
field, name = name.split(" ", 1)
field = field[1:]
else:
field = None
if self.password_mode == "bw":
base_args = [self.password_executable, "get", "--full"]
elif name.startswith("otp "):
base_args = [self.password_executable, "otp", "code"]
name = name[4:]
field = None
else:
base_args = [self.password_executable, "show"]
try:
try:
self.send_password_to_gpaste(base_args, name, field)
except dbus.DBusException:
# We couldn't join GPaste over D-Bus, use native clipboard
self.send_password_to_native_clipboard(base_args, name, field)
if "otp" in base_args:
self.notify("Copied OTP password to clipboard:", body=f"{name}")
elif field is not None:
self.notify(
f"Copied field {field} to clipboard:", body=f"{name}"
)
else:
self.notify("Copied password to clipboard:", body=f"{name}")
except (subprocess.CalledProcessError, FileNotFoundError, RuntimeError) as e:
self.notify("Failed to copy password or field!", body=str(e), error=True)
def notify(self, message, body="", error=False):
if not error and self.disable_notifications:
return
try:
self.session_bus.get_object(
"org.freedesktop.Notifications", "/org/freedesktop/Notifications"
).Notify(
"Pass",
0,
"dialog-password",
message,
body,
"",
{"transient": False if error else True},
0 if error else 3000,
dbus_interface="org.freedesktop.Notifications",
)
except dbus.DBusException as err:
print(f"Error {err} while trying to display {message}.")
if __name__ == "__main__":
DBusGMainLoop(set_as_default=True)
SearchPassService()
GLib.MainLoop().run()
gnome-pass-search-provider-1.3.0/gnome-pass-search-provider.spec 0000664 0000000 0000000 00000002472 14326626345 0024717 0 ustar 00root root 0000000 0000000 Name: gnome-pass-search-provider
Version: master
Release: 1
License: GPL-3.0+
Summary: Gnome Shell search provider for zx2c4/pass
Url: https://github.com/jle64/gnome-pass-search-provider
Source: https://github.com/jle64/%{name}/archive/master.tar.gz
Requires: gnome-shell
Requires: pass
Requires: python3-gobject
Requires: python3-dbus
Requires: python3-fuzzywuzzy
Requires: python3-Levenshtein
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global debug_package %{nil}
%description
A Gnome Shell passwords search provider for zx2c4/pass (passwordstore.org) or compatibles and Bitwarden/Vaultwarden that sends passwords to clipboard (or GPaste).
%prep
%setup -q -n %{name}-%{version}
%build
%install
sed -i -e 's|DATADIR=|DATADIR=$RPM_BUILD_ROOT|' install.sh
sed -i -e 's|LIBDIR=|LIBDIR=$RPM_BUILD_ROOT|' install.sh
./install.sh
%files
%defattr(-,root,root,-)
%doc README.md
%{_prefix}/lib/gnome-pass-search-provider/gnome-pass-search-provider.py
%{_prefix}/lib/systemd/user/org.gnome.Pass.SearchProvider.service
%{_prefix}/share/dbus-1/services/org.gnome.Pass.SearchProvider.service
%{_prefix}/share/applications/org.gnome.Pass.SearchProvider.desktop
%{_prefix}/share/gnome-shell/search-providers/org.gnome.Pass.SearchProvider.ini
gnome-pass-search-provider-1.3.0/install.sh 0000775 0000000 0000000 00000001642 14326626345 0020702 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
set -eu -o pipefail
cd "$(dirname "$(realpath "${0}")")"
DATADIR=${DATADIR:-/usr/share}
LIBDIR=${LIBDIR:-/usr/lib}
# The actual executable
install -Dm 0755 gnome-pass-search-provider.py "${LIBDIR}"/gnome-pass-search-provider/gnome-pass-search-provider.py
# Search provider definition
install -Dm 0644 conf/org.gnome.Pass.SearchProvider.ini "${DATADIR}"/gnome-shell/search-providers/org.gnome.Pass.SearchProvider.ini
# Desktop file (for having an icon)
install -Dm 0644 conf/org.gnome.Pass.SearchProvider.desktop "${DATADIR}"/applications/org.gnome.Pass.SearchProvider.desktop
# DBus configuration (no-systemd)
install -Dm 0644 conf/org.gnome.Pass.SearchProvider.service.dbus "${DATADIR}"/dbus-1/services/org.gnome.Pass.SearchProvider.service
# DBus configuration (systemd)
install -Dm 0644 conf/org.gnome.Pass.SearchProvider.service.systemd "${LIBDIR}"/systemd/user/org.gnome.Pass.SearchProvider.service
gnome-pass-search-provider-1.3.0/misc/ 0000775 0000000 0000000 00000000000 14326626345 0017625 5 ustar 00root root 0000000 0000000 gnome-pass-search-provider-1.3.0/misc/screencapture.gif 0000664 0000000 0000000 00013122552 14326626345 0023172 0 ustar 00root root 0000000 0000000 GIF89aX1
7`
#G0[6]+R=g6W8a!*IkAjIeJoKsUg M Tr!! !()!X"Te"Tt#S$$&$@7v78q8v8889889989y99y:i::;9:;9;;:9;KS;f;w;|;<:9<<<==j=x=>==>QV>h?@@AtA{A}B~BBBBCDCBFgIJIIJUYJJJJJKMMONNOOOPSSSSTTTUUUUWYYZXW\!8^^``cbaddeggfiODkjiorsprtvxyyyz|^t|~~Ձ~"3H$˦|Eȩj [D0J/v