Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autotyping #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Add autotyping #2

wants to merge 8 commits into from

Conversation

klassm
Copy link

@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 <[email protected]>
Copy link
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
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
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
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
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
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