Skip to content

Incorrect documentation: name is not an optional argument to define_keymap #169

@mangelozzi

Description

@mangelozzi

Great project, have tried for 4 days solid trying to remap keys in linux, this has been the only reliable solution for me, well done!

The documentation says:

Argument name specifies the keymap name. This is an optional argument.

However this code:

from xkeysnail.transform import Key, define_keymap

define_keymap(None, {
    Key.CAPSLOCK:  Key.LEFT_META,
    Key.LEFT_META: Key.ESC,
    Key.ESC : Key.CAPSLOCK,
}, None)  # <-- Name is None here

Results in this error:

  File "/usr/local/lib/python3.10/dist-packages/xkeysnail/transform.py", line 457, in transform_key
    print("WM_CLASS '{}' | active keymaps = [{}]".format(wm_class, ", ".join(keymap_names)))
TypeError: sequence item 0: expected str instance, NoneType found

However adding a name makes it work fine:

from xkeysnail.transform import Key, define_keymap
define_keymap(None, {
    Key.CAPSLOCK:  Key.LEFT_META,
    Key.LEFT_META: Key.ESC,
    Key.ESC : Key.CAPSLOCK,
}, "Michael") # <-- Name is set here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions