Skip to content

New setting type: key #24

Open
Open
@Hans5958

Description

@Hans5958

No addon uses it yet, but we'll support settings of type "key". I don't think there's a real way of verifying default key combinations are correct, all I got is the JS code that detects the keys and outputs a string with them. If you wanna go crazy, build a regex for it :P

const string = e.ctrlKey
        ? "Ctrl" +
          (e.shiftKey ? " + Shift" : "") +
          (e.key == "Control" || e.key == "Shift"
            ? ""
            : (e.ctrlKey ? " + " : "") +
              (e.key.toUpperCase() === e.key
                ? e.code.includes("Digit")
                  ? e.code.substring(5, e.code.length)
                  : e.key
                : e.key.toUpperCase()))
        : "";

Originally posted by @WorldLanguages in #13 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions