diff --git a/README.md b/README.md index eaf56d7..0bf014f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ sudo SYSCONFDIR=/etc DATADIR=/usr/share LIBDIR=/usr/lib LIBEXECDIR=/usr/lib ./in # Post-installation -Recommended : set gpg agent to use pinentry-gnome3 by adding `pinentry-program /usr/bin/pinentry-gnome3` to `~/.gnupg/.gpg-agent.conf`. +Recommended : set gpg agent to use pinentry-gnome3 by adding `pinentry-program /usr/bin/pinentry-gnome3` to `~/.gnupg/gpg-agent.conf`. If you are on Xorg, restart GNOME Shell by typing 'alt + f2' then entering 'r' as command. If you are on Wayland, you need to close and reopen your GNOME session. @@ -48,7 +48,7 @@ Otherwise they are sent to the clipboard using `pass -c` which defaults to expir # Compatibility -This implements the `org.gnome.Shell.SearchProvider2` D-Bus API which seems to be present in GNOME Shell since around 2012 and has been tested with GNOME Shell 3.22-3.26. +This implements the `org.gnome.Shell.SearchProvider2` D-Bus API which seems to be present in GNOME Shell since around 2012 and has been tested with GNOME Shell 3.22-3.30. # Troubleshooting diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 7ccb010..0000000 --- a/TODO.md +++ /dev/null @@ -1,3 +0,0 @@ -* Make packages. -* Find something to do when LaunchSearch is called. -* Change icon to one that is present in GNOME default theme. diff --git a/conf/org.gnome.Pass.SearchProvider.desktop b/conf/org.gnome.Pass.SearchProvider.desktop index 9a17c40..9a15878 100644 --- a/conf/org.gnome.Pass.SearchProvider.desktop +++ b/conf/org.gnome.Pass.SearchProvider.desktop @@ -7,4 +7,4 @@ Comment=GNOME Shell search provider for pass Terminal=false Type=Application OnlyShowIn=GNOME; -NoDisplay=true; +NoDisplay=true diff --git a/gnome-pass-search-provider.py b/gnome-pass-search-provider.py index fe71806..5b1d0ff 100755 --- a/gnome-pass-search-provider.py +++ b/gnome-pass-search-provider.py @@ -72,7 +72,7 @@ class SearchPassService(dbus.service.Object): @dbus.service.method(in_signature='as', out_signature='aa{sv}', **sbn) def GetResultMetas(self, ids): - return [dict(id=id, name=id,) for id in ids] + return [dict(id=id, name=id, gicon="password-manager") for id in ids] @dbus.service.method(in_signature='asas', out_signature='as', **sbn) def GetSubsearchResultSet(self, previous_results, new_terms): @@ -111,11 +111,11 @@ class SearchPassService(dbus.service.Object): return results def send_password_to_gpaste(self, base_args, name): - pass_cmd = subprocess.run(base_args + [name], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - password = re.sub(b'\n$', b'', pass_cmd.stdout) - error = re.sub(b'\n$', b'', pass_cmd.stderr) - if not pass_cmd.returncode: + try: + pass_output = subprocess.check_output(base_args + [name], + stderr=subprocess.STDOUT, + universal_newlines=True) + password = pass_output.split('\n', 1)[0] self.session_bus.get_object( 'org.gnome.GPaste.Daemon', '/org/gnome/GPaste' @@ -124,21 +124,26 @@ class SearchPassService(dbus.service.Object): password, dbus_interface='org.gnome.GPaste1' ) + if 'otp' in base_args: - self.notify(f'OTP password {name} copied to clipboard.') + self.notify('Copied OTP password to clipboard:', + body=f'{name}') else: - self.notify(f'Password {name} copied to clipboard.') - else: - self.notify('Failed to copy password', body=error, error=True) + self.notify('Copied password to clipboard:', + body=f'{name}') + except subprocess.CalledProcessError as error: + self.notify('Failed to copy password!', body=error.output, + error=True) def send_password_to_native_clipboard(self, base_args, name): pass_cmd = subprocess.run(base_args + ['-c', name]) if pass_cmd.returncode: self.notify('Failed to copy password!', error=True) elif 'otp' in base_args: - self.notify(f'OTP password {name} copied to clipboard.') + self.notify('Copied OTP password to clipboard:', + body=f'{name}') else: - self.notify(f'Password {name} copied to clipboard.') + self.notify('Copied password to clipboard:', body=f'{name}') def send_password_to_clipboard(self, name): if name.startswith('otp '): @@ -162,7 +167,7 @@ class SearchPassService(dbus.service.Object): ).Notify( 'Pass', 0, - '', + 'dialog-password', message, body, '', diff --git a/misc/screencapture.gif b/misc/screencapture.gif index ee2d8b1..24ba792 100644 Binary files a/misc/screencapture.gif and b/misc/screencapture.gif differ