Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 2.12 KB

README.md

File metadata and controls

46 lines (37 loc) · 2.12 KB

obinskit-utils

Utilities to work with ObinsKit (AnnePro) Keyboards

Usage

$ ./edit-macro.py -h
usage: edit-macro.py [-h] [--db-path DB_PATH] [--macro-name MACRO_NAME] [--dry-run] [--verbose] [--list-keycodes]

    Edit a macro contained in the kbd_macro_new table of an ObinsKit SQLITE db.

    This program makes a copy of the ObinsKit SQLITE database at the path
    specified by --db-path, and operates on this copy until changes are
    validated. It `SELECT`s the `macro_value` column of the row in the
    `kbd_macro_new` table that has the name specified by --macro-name.

    This `macro_value`, a list of ints, is converted into a list of
    tuples of helper objects with useful (more human-readable) string
    representations, then dumped into a temporary file for manual editing.
    A header containing instructions is prepended to this file to guide the
    user.

    When the $EDITOR process exits, its contents (human-readable
    representation of the "macro events) are re-serialized back into the
    "list of ints" that can be compared against the original, and converted
    into the raw list expected by `macro_value`.

    If the new `macro_value` is valid, and `dry_run` is False, it is written
    back out to the table in the db copy using an SQLITE `UPDATE` command.

    If the results are to be used in the ObinsKit app, the user must manually
    replace the SQLITE db used by their app with the one generated by this
    script. TODO: add arg to automatically update ObinsKit SQLITE db.

    Requirements:
        1. Must be using a recent version of ObinsKit that uses the new
           `kbd_macro_new` table/schema.

options:
  -h, --help            show this help message and exit
  --db-path DB_PATH     Absolute path to local SQLITE database file
  --macro-name MACRO_NAME
                        Name of macro to edit. Use `SELECT name FROM kbd_macro_new` to list all macro names
  --dry-run             When True, don't write changes to sqlite database.
  --verbose             Log all the things
  --list-keycodes       Print mappings between key values and names used by ObinsKit.Does not require other args.