Merge branch 'master' of github.com:jle64/gnome-pass-search-provider into pass-otp
This commit is contained in:
commit
47ab26d892
@ -29,7 +29,7 @@ sudo SYSCONFDIR=/etc DATADIR=/usr/share LIBDIR=/usr/lib LIBEXECDIR=/usr/lib ./in
|
|||||||
|
|
||||||
# Post-installation
|
# 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 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.
|
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
|
# 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
|
# Troubleshooting
|
||||||
|
|
||||||
|
3
TODO.md
3
TODO.md
@ -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.
|
|
@ -7,4 +7,4 @@ Comment=GNOME Shell search provider for pass
|
|||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
OnlyShowIn=GNOME;
|
OnlyShowIn=GNOME;
|
||||||
NoDisplay=true;
|
NoDisplay=true
|
||||||
|
@ -72,7 +72,7 @@ class SearchPassService(dbus.service.Object):
|
|||||||
|
|
||||||
@dbus.service.method(in_signature='as', out_signature='aa{sv}', **sbn)
|
@dbus.service.method(in_signature='as', out_signature='aa{sv}', **sbn)
|
||||||
def GetResultMetas(self, ids):
|
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)
|
@dbus.service.method(in_signature='asas', out_signature='as', **sbn)
|
||||||
def GetSubsearchResultSet(self, previous_results, new_terms):
|
def GetSubsearchResultSet(self, previous_results, new_terms):
|
||||||
@ -111,11 +111,11 @@ class SearchPassService(dbus.service.Object):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
def send_password_to_gpaste(self, base_args, name):
|
def send_password_to_gpaste(self, base_args, name):
|
||||||
pass_cmd = subprocess.run(base_args + [name], stdout=subprocess.PIPE,
|
try:
|
||||||
stderr=subprocess.PIPE)
|
pass_output = subprocess.check_output(base_args + [name],
|
||||||
password = re.sub(b'\n$', b'', pass_cmd.stdout)
|
stderr=subprocess.STDOUT,
|
||||||
error = re.sub(b'\n$', b'', pass_cmd.stderr)
|
universal_newlines=True)
|
||||||
if not pass_cmd.returncode:
|
password = pass_output.split('\n', 1)[0]
|
||||||
self.session_bus.get_object(
|
self.session_bus.get_object(
|
||||||
'org.gnome.GPaste.Daemon',
|
'org.gnome.GPaste.Daemon',
|
||||||
'/org/gnome/GPaste'
|
'/org/gnome/GPaste'
|
||||||
@ -124,21 +124,26 @@ class SearchPassService(dbus.service.Object):
|
|||||||
password,
|
password,
|
||||||
dbus_interface='org.gnome.GPaste1'
|
dbus_interface='org.gnome.GPaste1'
|
||||||
)
|
)
|
||||||
|
|
||||||
if 'otp' in base_args:
|
if 'otp' in base_args:
|
||||||
self.notify(f'OTP password {name} copied to clipboard.')
|
self.notify('Copied OTP password to clipboard:',
|
||||||
|
body=f'<b>{name}</b>')
|
||||||
else:
|
else:
|
||||||
self.notify(f'Password {name} copied to clipboard.')
|
self.notify('Copied password to clipboard:',
|
||||||
else:
|
body=f'<b>{name}</b>')
|
||||||
self.notify('Failed to copy password', body=error, error=True)
|
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):
|
def send_password_to_native_clipboard(self, base_args, name):
|
||||||
pass_cmd = subprocess.run(base_args + ['-c', name])
|
pass_cmd = subprocess.run(base_args + ['-c', name])
|
||||||
if pass_cmd.returncode:
|
if pass_cmd.returncode:
|
||||||
self.notify('Failed to copy password!', error=True)
|
self.notify('Failed to copy password!', error=True)
|
||||||
elif 'otp' in base_args:
|
elif 'otp' in base_args:
|
||||||
self.notify(f'OTP password {name} copied to clipboard.')
|
self.notify('Copied OTP password to clipboard:',
|
||||||
|
body=f'<b>{name}</b>')
|
||||||
else:
|
else:
|
||||||
self.notify(f'Password {name} copied to clipboard.')
|
self.notify('Copied password to clipboard:', body=f'<b>{name}</b>')
|
||||||
|
|
||||||
def send_password_to_clipboard(self, name):
|
def send_password_to_clipboard(self, name):
|
||||||
if name.startswith('otp '):
|
if name.startswith('otp '):
|
||||||
@ -162,7 +167,7 @@ class SearchPassService(dbus.service.Object):
|
|||||||
).Notify(
|
).Notify(
|
||||||
'Pass',
|
'Pass',
|
||||||
0,
|
0,
|
||||||
'',
|
'dialog-password',
|
||||||
message,
|
message,
|
||||||
body,
|
body,
|
||||||
'',
|
'',
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 1.9 MiB |
Loading…
x
Reference in New Issue
Block a user