-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Matthias Klass <[email protected]>
There was a problem hiding this 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 clone
d 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?
def clear_field_content(): | ||
os.system("""echo 'tell application "System Events" to keystroke "a" using command down' | osascript""") | ||
do_stroke(51) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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 {} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
Add autotyping
"gpa" for general autotyping based on an "autotype" field
"gpf" to type a single field