Giter Site home page Giter Site logo

Comments (12)

pmlopes avatar pmlopes commented on May 14, 2024 2

I've got it working for me with this code:

def send_password_to_native_clipboard(self, name):
        pass_cmd = subprocess.run(['pass', 'show', '-c', name])

        if pass_cmd.returncode:
            self.notify('Failed to copy password!', error=True)
        else:
            self.notify('Password {} copied to clipboard.'.format(name))

By not creating pipes from the stdin/stdout it works, but I loose the context for error messages, not optimal but works for me...

from gnome-pass-search-provider.

pmlopes avatar pmlopes commented on May 14, 2024 1

if you use the hints:

{'transient': True}

then they do not stay in the history (hints is the argument before the timeout.

from gnome-pass-search-provider.

jle64 avatar jle64 commented on May 14, 2024

Whoah, I didn't realize there was any user of this beside me yet :)

Yeah, good points I'll look into adding some libnotify notifications with stderr output when pass exits != 0 and when a password is copied to clipboard.

from gnome-pass-search-provider.

pmlopes avatar pmlopes commented on May 14, 2024

I guess you can use DBus directly e.g.:

                
notifications_dbus = session_bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
notify = dbus.Interface(notifications_dbus, 'org.freedesktop.Notifications')
notify.Notify (name, 0, '', ' password copied.', '', '', '', 3000)

I'm no dbus expert or python but this gives me some hints, it probably needs some polishing specially with the messages and defaults but again i just looked at the spec for 5 minutes....

from gnome-pass-search-provider.

jle64 avatar jle64 commented on May 14, 2024

I've added it. Notifications seems to stay indefinitely in Gnome notifications history despite setting a 3s timeout though. Also I barely tested :)

from gnome-pass-search-provider.

pmlopes avatar pmlopes commented on May 14, 2024

👍

from gnome-pass-search-provider.

pmlopes avatar pmlopes commented on May 14, 2024

Also for some strange reason on my Fedora 26 notifications have a huge delay before they show up. How do you debug this?

from gnome-pass-search-provider.

jle64 avatar jle64 commented on May 14, 2024

I changed notifications to be transient. I have no idea why you would have a delay when notifications show up, I don't have the problem.

from gnome-pass-search-provider.

pmlopes avatar pmlopes commented on May 14, 2024

it seems like a deadlock on the subprocess until some timeout happens

from gnome-pass-search-provider.

matze avatar matze commented on May 14, 2024

Also for some strange reason on my Fedora 26 notifications have a huge delay before they show up.

And it's pretty annoying as well …

from gnome-pass-search-provider.

matze avatar matze commented on May 14, 2024

Thanks, that works well. However, that means no GPaste support but I personally do not use that anyway.

from gnome-pass-search-provider.

jle64 avatar jle64 commented on May 14, 2024

@pmlopes : I imported your version of the function.

@matze : The problem doesn't occur with GPaste support anyway (which is why I didn't see it) as it seems to be due to the subprocess call blocking until the end of the 45 seconds before clearing the clipboard content, which isn't used in the case of GPaste.

from gnome-pass-search-provider.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.