mooz / xkeysnail

Yet another keyboard remapping tool for X environment
893 stars 112 forks source link

Key sequences not defined in wm_class specific keymap are not handled #55

Open QiangF opened 4 years ago

QiangF commented 4 years ago

I use the EXWM window manager, for example, if you have this config:

define_keymap(lambda wm_class: wm_class not in ("Emacs",), {
    # C-x YYY
    K("C-x"): {
        # C-x C-f (open)
        K("C-f"): K("C-o"),
        # C-x C-s (save)
        K("C-s"): K("C-s"),
        # C-x k (kill tab)
        K("k"): K("C-f4"),
        # C-x C-c (exit)
        K("C-c"): K("C-q"),
    }
}, "Emacs-like keys")

Press C-x b, the combination is not sent to the window manager, and we have to set it explicitly

define_keymap(lambda wm_class: wm_class not in ("Emacs",), {
    # C-x YYY
    K("C-x"): {
        K("b"): [K("C-x"), K("b")],
    }
}, "Emacs-like keys")

Why not make all not specified key bindings just send themselves default?

joshgoebel commented 2 years ago

This sounds like a bug to me... if a keybinding gets an unexpected key it should probably break out and just send the keys straight thru without processing.

joshgoebel commented 2 years ago

My bad, this is correct behavior. The C-x keystroke just changes the "active" key map to the nested one... it doesn't output any keys.

If you hit b at that point you should get a b... but if you want C-x b then you need to map it explicitly, as youve seen.

Why not make all not specified key bindings just send themselves default?

It's not at all clear to me this would be what most users would expect... you're kind of wanting:

That's not currently possible and would likely make things a lot more complex.