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

Edit custom window titles for auto-type #197

Open
vwochnik opened this issue Jul 10, 2020 · 1 comment
Open

Edit custom window titles for auto-type #197

vwochnik opened this issue Jul 10, 2020 · 1 comment

Comments

@vwochnik
Copy link

Hello there.

I am wondering how to edit the 'Custom sequences for specific windows' for individual entries.

Thank you.

@roelderickx
Copy link

I stumbled on the same question, and I also wanted to know how to read/write the Plugin Data which is saved by KeePassXC under Properties.

Both questions have a similar answer, the key is entry.dump_xml(). You'll see the custom sequences in the tag AutoType and the plugin data tag is called CustomData.

To get the data:

def get_associations(entry):
    assocs = [ x.findall('Association') for x in entry._element.findall('AutoType') ]
    flattened_assocs = [ assoc for assoc_list in assocs for assoc in assoc_list ]
    associations = [ ( y.find('Window').text, y.find('KeystrokeSequence').text ) for y in flattened_assocs ]
    return associations

def get_custom_data(entry):
    items = [ x.findall('Item') for x in entry._element.findall('CustomData') ]
    flattened_items = [ item for item_list in items for item in item_list ]
    custom_data = { y.find('Key').text: y.find('Value').text for y in flattened_items }
    return custom_data

Saving and deleting is similar as for custom properties. See the functions set_custom_property and delete_custom_property in entry.py.

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

No branches or pull requests

2 participants