[pass] Patch: ability to type out password automatically using xdotool

Anas Syed anas27 at gmail.com
Mon Feb 8 17:39:15 CET 2016

Something like this could work:

windowid="$(xdotool search --name "site name")"
if [[ "$(echo "$windowid" | wc -w)" -eq 1 ]]; then
    echo -n "$pass" | xdotool windowactivate --sync "$windowid" type --file

Many variants are possible.

Of course if the wrong window matches, you password will be typed into that
window, which is bad. I don't know if this whole thing is a good idea but
you are free to implement it.

On 8 February 2016 at 15:09, Anas Syed <anas27 at gmail.com> wrote:

> The problem with piping it to xdotool is it's tricky to add a delay that
> works in all scenarios. If gpg-agent is running, meaning you don't need to
> type out your password to decrypt your private key, then a simple sleep
> chained to xdotool works fine. But if you have to type out your password,
> then the "sleep" time is consumed while you type out the password, so you
> don't get the same delay. Also it's a lot of extra typing, as opposed to
> adding a single flag.
> With regards to the choosing the window, I haven't looked into doing
> anything like that, but it sounds possible (but tricky to get right across
> all browsers and what not). Perhaps one could store extra information in
> the password file about the title of the site, so that the appropriate
> window is found (like a regex which matches on the site title). But this
> sounds messy and platform dependent.
> On 8 February 2016 at 14:55, Dashamir Hoxha <dashohoxha at gmail.com> wrote:
>> On Mon, Feb 8, 2016 at 3:45 PM, Anas Syed <anas27 at gmail.com> wrote:
>>> Whoops, forgot to hit reply all.
>>> I focus the cursor in the browser before going to the terminal. Then I
>>> open up the terminal and use pass. A single Alt-Tab after typing out the
>>> command is all that's needed.
>>> It works well for me, but of course other people may not like the idea.
>> If you could tell `xdotool` which window (maybe based on title or url)
>> and which fields to fill (username, password, etc.), then it would be a
>> great tool. Otherwise, just piping the output of pass to xdotool could be
>> OK. Have you tried it with piping?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20160208/af7d94fd/attachment-0001.html>

More information about the Password-Store mailing list