You are not logged in.

#1 2014-11-10 18:08:03

kagebe
Member
Registered: 2009-12-18
Posts: 10

passdmenu - (Yet Another) dmenu frontend to pass

Since passmenu lacked a bit in versatility for my usage, I wrote my own wrapper in python.

There are two packages in the AUR: passdmenu-git and passdmenu
The source can be found on github.com/klaasb/passdmenu.

In particular I wanted the option to also extract the username (second whitespace-separated field on second line, or the only field on the second line) from the password file and and either copy it or automatically type it.
There are some more convenience options:

usage: passdmenu [-h] [-t] [-r] [-u] [-P] [-s STORE] [-B PASS_BIN]
                 [-D DMENU_BIN]

A dmenu frontend to pass. All passed arguments not listed below, are passed to
dmenu. Requires xclip in default mode.

optional arguments:
  -h, --help            show this help message and exit
  -t, --type            Use xdotool to type the username and/or password into
                        the currently active window.
  -r, --return          Presses "Return" after typing. Forces --type.
  -u, --user            Copy/type the username.
  -P, --pw              Copy/type the password. Default, use -u -P to copy
                        both username and password.
  -s STORE, --store STORE
                        The path to the pass password store. Defaults to
                        ~/.password-store
  -B PASS_BIN, --pass PASS_BIN
                        The path to the pass binary. Defaults to /usr/bin/pass
  -D DMENU_BIN, --dmenu DMENU_BIN
                        The path to the dmenu binary. Defaults to
                        /usr/bin/dmenu

Please let me know if this is useful for you and what improvements you can think of.

Last edited by kagebe (2014-11-10 18:09:53)

Offline

#2 2014-11-23 11:24:22

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: passdmenu - (Yet Another) dmenu frontend to pass

Thank you very much for this tool! It's exactly what I was searching. I have
tested it, but I have a problem. I use sxhkd to define my shortcuts. In sxhkd I have
defined the shortcut:

mod4 + w; l
    passdmenu -uPt 

When the active window is my browser (for example firefox or dwb) and I want to connect
to my webmail, I use the shortcut "mod4 + w; l" and the following is copied in the box of my
login:

user@gmx.netkey--clearmodifiersTabtype--clearmodifierspassword

I think the tab key isn't simulated with xdotool. Do I something wrong or there is a problem ?

Offline

#3 2014-11-24 14:56:50

kagebe
Member
Registered: 2009-12-18
Posts: 10

Re: passdmenu - (Yet Another) dmenu frontend to pass

Thanks for the post. Just before reading it, I noticed that as well. Fix will be up later.

Edit: Fix is up as release v1.0.3.

Last edited by kagebe (2014-11-24 15:52:11)

Offline

#4 2014-11-24 17:03:27

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: passdmenu - (Yet Another) dmenu frontend to pass

Thank you for the fix, it works now! I can login in my webmail without problem. Unfortunately it
doesn't work with all webmail. I have an account archlinux.info. I have to login here:

https://webmail.archlinux.info/

To connect, first I click the box "Username". Then I use my shortcut to execute

passdmenu -uPt 

Then nothing is written under "Username", only some text is written in the box "Password".
If I do exactly the same for another webmail, it works. Do you have any idea
what happens here ?

Offline

#5 2014-11-24 17:58:07

kagebe
Member
Registered: 2009-12-18
Posts: 10

Re: passdmenu - (Yet Another) dmenu frontend to pass

Does the layout in your password file for archlinux.info differ somehow from the others?
You could just paste it here (password obscured of course).
Maybe the script does not get the username from the second line correctly. It should either parse "something<whitespace>username(<whitespace>)*whatever*" (e.g. "User: myusername") or just "username".

Offline

#6 2014-11-25 21:45:25

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: passdmenu - (Yet Another) dmenu frontend to pass

I have done the following:

pass insert -m Email/mykolab.com

Enter contents of Email/mykolab.com and press Ctrl+D when finished:

password
Username: user

If I try to connect on my webmail (Mykolab.com is another webmail, but the problem is the same
as for archlinux.info), I have the same problem. If I try for the same password here:

http://www.gmx.ch/

There is no problem. Do you think I should put everthing on one line ? I tried without success.

Last edited by Tristelune (2014-11-26 05:00:17)

Offline

#7 2014-12-07 16:16:56

kagebe
Member
Registered: 2009-12-18
Posts: 10

Re: passdmenu - (Yet Another) dmenu frontend to pass

Sorry, busy week.

It seems to me like you inserted a newline first into the password file.
Normally there is only a single empty line after 'Enter contents...'.
The script currently only looks at the first line and takes that as the password and gets the username like I describe above from the second line. If you shift those lines, it currently won't work as expected.
You can look at the generated file with 'pass edit Email/mykolab.com' and compare it with the file for gmx.ch.
If there's an empty line first, just delete it and save the file.

Offline

#8 2014-12-08 07:21:23

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: passdmenu - (Yet Another) dmenu frontend to pass

Thank you for your hint, but it still doesn't work. I had a look with 'pass edit Email/mykolab.com'
at the file, but there is no newline at the beginning. If I use the password stored in Email/mykolab.com
on the following website:

http://www.gmx.ch/

there is no problem, passdmenu works as expected. I first click in the box and there I use the shortcut.
But on

https://webmail.archlinux.info/

It doesn't work. I do the same: I click in the first box and then execute the shortcut. Could
try with one of your password and tell me if you have the same problem ?

Offline

#9 2014-12-09 15:42:01

kagebe
Member
Registered: 2009-12-18
Posts: 10

Re: passdmenu - (Yet Another) dmenu frontend to pass

Roundcube (the webmail software on archlinux.info) seems to handle a "key release" event of the return key by switching to the next input field (the password).
For some reason, when you press return to select the pass entry in dmenu, a "key release" event from the key press is "left over" and you browser handles it. Which leads to the problematic behaviour.
This also happens when pressing Return in the GPG-Passphrase dialog.
I'm not sure why these Key Release events are left over. I tried capturing it inside the python script, but I couldn't get it to work and am not sure whether I can fix it there.

Offline

#10 2014-12-11 16:42:45

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: passdmenu - (Yet Another) dmenu frontend to pass

Ok, I have also tried on the website and I see the difference between roundcube and
gmx. For me it would be an option to define another shortcut for roundcube (I mean
to call another tool or something like that). But if
I understand right, the problem comes from dmenu. When I will have time, I'll search if
I can find a way to suppresse a key event like the "key release".

Tell me if you find a fix and thank you for your explanation!

Offline

#11 2015-05-19 21:38:59

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: passdmenu - (Yet Another) dmenu frontend to pass

fix: Use rofi. with rofi you can use actions on return codes. if return code is =! 0 it will not affect the roundcube input field.

update: seems rofi will fix this with next release. so even enter would work

Last edited by Rasi (2015-05-20 17:46:25)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

Board footer

Powered by FluxBB