ZevEisenberg / Keyb

Type with one hand on a Mac
MIT License
55 stars 2 forks source link

Odd behavior with Alfred keybinding and sticky keys #30

Open aleph-naught2tog opened 2 years ago

aleph-naught2tog commented 2 years ago

This is about an odd behavior regarding Alfred, although based on the below I believe it is non-specific to Alfred.

Assuming you have Alfred, and it is on and running, and bound to cmd-space to open:

  1. Turn on sticky keys (default Mac version)
  2. Turn on Keyb
  3. Tap cmd twice to ensure it is in stay-on mode for sticky-keys (designated by the cmd symbol staying lit up in the upper-left hand corner)
  4. Tap space
  5. Tap the ] key
  6. Alfred appears

Given the fact that the binding for Alfred involves the trigger for Keyb, I'm not surprised there's an issue, and this isn't really a problem, but it's fascinating and on further investigation seems like a bug.

So after some light testing, the key in step 5 doesn't HAVE to be the ] key -- [ also works, as do others, _as long as no action is bound to them, Alfred will open and stay open for use.

Other keys also work, but assuming a given key $key has an actual action bound with cmd (say, cmd-\ for opening 1password), what we see is that the above flow with \ instead of ] in step 5 will open alfred momentarily but disappear once 1password opens. Similarly, m opens Alfred instantaneously before minimizing the window.

Based on this, it looooooks to me like the alfred action does trigger, but not on the keyup of space; rather it seems to wait for the next key down to fire the bound cmd-space event.

ZevEisenberg commented 2 years ago

Thanks for bringing this up! I haven't done any testing with sticky keys. I'm guessing that's where the problem lies, but I'd have to dig in more. Without checking the code, I vaguely recall something where I don't actually send the space-down until I get a space up, which could be partially related? Not sure.

aleph-naught2tog commented 2 years ago

Thanks for bringing this up! I haven't done any testing with sticky keys. I'm guessing that's where the problem lies, but I'd have to dig in more.

Absolutely, no worries!

RE sticky keys: turning it off means Alfred just never opens at all, as another data point.

Without checking the code, I vaguely recall something where I don't actually send the space-down until I get a space up, which could be partially related? Not sure.

I looked at it quickly this morning and I thiiiiiink that's correct?

aleph-naught2tog commented 2 years ago

(ahhhh, I didn't mean to close as completed, I am still getting used to sticky keys/new keyboard setup!)