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

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

Open
mangelozzi opened this issue Jan 20, 2023 · 0 comments

Comments

@mangelozzi
Copy link

mangelozzi commented Jan 20, 2023

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
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

1 participant