mooz / xkeysnail

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

Any way to achieve this kind of multipurpose keymap? #121

Open llcc opened 3 years ago

llcc commented 3 years ago

I would like to rebind ctrl modifier key as follows:

  1. Pressed or released to simulate ctrl-c ctrl-c in Emacs
  2. Left ctrl when held down.

The following code is not working, any way to make it work? Appreciate for any help.

import re
from xkeysnail.transform import *

define_timeout(1)

define_conditional_multipurpose_modmap(lambda wm_class: wm_class in ("Emacs"), {
   Key.LEFT_CTRL: [K("C-c-C-c"), Key.LEFT_CTRL],
})
joshgoebel commented 2 years ago

Pressed or released

I assume you mean pressed AND released.

No, sorry. Modifiers alone cannot currently be used on their own type of "combo".... ie pressing a single modifier cannot trigger a combo. You can't do this with modmaps or keymaps.

It's an interesting idea though, I wonder if it would have potentially bad interactions with other functionality.