Skip to content

Add autotyping#2

Open
klassm wants to merge 8 commits intogopasspw:masterfrom
klassm:master
Open

Add autotyping#2
klassm wants to merge 8 commits intogopasspw:masterfrom
klassm:master

Conversation

@klassm
Copy link
Copy Markdown

@klassm klassm commented Aug 1, 2020

Add autotyping
"gpa" for general autotyping based on an "autotype" field
"gpf" to type a single field

Signed-off-by: Matthias Klass <matthias.klass@gmail.com>
Copy link
Copy Markdown
Member

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, LGTM.

Maybe adding some documentation somewhere, maybe in the README.md could help, because I have never used Alfred and wouldn't know how to set this up currently.

From what I'm reading in the makefile it would work if this is git cloned in a direct sub directory of one's home folder and then you run make release in there, correct?

@dominikschulz I sadly don't have a MacOs device handy for testing anymore right now...
Any chance you could test it?

Comment on lines +61 to +63
def clear_field_content():
os.system("""echo 'tell application "System Events" to keystroke "a" using command down' | osascript""")
do_stroke(51)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced how this is actually clearing a field? Isn't it just adding 51 times a char a to the field?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is a bit special - how do you clear a field only from the command line? What I came up with is just issue a Ctrl+a and issue a backspace.
You can find the full reference of available keystrokes here.

Comment on lines +24 to +35
def get_additional_autotype_handlers_filename():
base_path = os.getenv("XDG_CONFIG", home)
return '{base_path}/{filename}'.format(base_path=base_path, filename=".gopass_autotype_handlers.json")


def load_additional_autotype_handlers_config():
handlers_path = get_additional_autotype_handlers_filename()
if os.path.exists(handlers_path):
with open(handlers_path) as f:
return json.load(f)
else:
return {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we need this?

What's supposed to be in the .gopass_autotype_handlers.json file?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a bit of extra documentation. In the end it allows to include output from external commands in the autotype command. I explicitly use it to type YubiKey TOTP tokens in authentication forms, so I don't have to do it manually. It allows to fill forms completely, without any manual interaction (as long as you can code any part as bash commands)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general there is an updated documentation for the autotyping, also including the special commands and the additional handlers. Maybe that makes it more clear on how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants