gdh1995 / vimium-c

A keyboard shortcut browser extension for keyboard-based navigation and tab operations with an advanced omnibar
https://chrome.google.com/webstore/detail/vimium-c/hfjbmagddngcpeloejdejnfgbamkjaeg
Other
3.41k stars 253 forks source link

Ignore modifiers when in LinkHints mode #988

Open sommerper opened 1 year ago

sommerper commented 1 year ago

What command or commands

LinkHints

Would it be possible to ignore modifiers when in LinkHints mode? I admit I have an edge case because of my zmk keyboard with home row modifiers activated. But for the certain keys that also act as shift and control the modifier action is also considered even though it was released shortly before.

For example:

  1. I activate LinkHints mode and press e to go to a new page.
  2. Because ctrl is active while I hold e down and released shortly before I get the new page in a new window. What should have happened it that it should have opened the link in the current window.

I'm thinking the ctrl keyup and e keydown are too close together for Vimium to register?

image

So would it be possible to either add an option to ignore modifiers in LinkHints mode or maybe improve the timing recognition so this doesn't happen?

Browser and OS

Thank you for a wonderful extension!

gdh1995 commented 1 year ago

Sorry I haven't got why there's a Ctrl key just before the e key.

As for how to respond on Ctrl/Shift/Alt keys in LinkHints mode, Vimium C has a different behavior from Vimium:

  1. In Vimium C, LinkHints only acts on "keydown" events of Ctrl/Shift/Alt keys
      1. for example, a Ctrl keydown event will change LinkHint's sub-mode; when the Ctrl key gets released, the new mode is still there
      1. while the original Vimium will revert such sub-mode changes on a next Ctrl keyup event

There's no parameter to change this behavior.

sommerper commented 1 year ago

Ah, that's too bad because it forces me to go back to Vimium 🙁. But thanks for the explanation!

gdh1995 commented 1 year ago

Hello, as for #992 mentioned a similar issue, now I decide to add a parameter to make LinkHints ignore those modifier keys (on certain conditions).

BTW, why is there a Ctrl key released before e being pressed? And what did you mean by with home row modifiers activated?

sommerper commented 1 year ago

It's nice of you to investigate the issue but I have to admit I'm in the minority with this...

The reason ctrl is pressed before e is because e acts as ctrl when held down.

If I press and hold e and then press s it will register ctrl + s.

If I press and release e it will register e. But while e is in the down state ctrl is registered and if nothing else is pressed it will release ctrl and register e.

It's hard to explain. This video does a decent job https://youtu.be/yiwUjLaebuw?t=199 or you can read more about it here: https://precondition.github.io/home-row-mods

It's a feature of programmable keyboards.

gdh1995 commented 1 year ago

ok,thank you for the detailed explanation.

Then, it seems LinkHints should ignore the ctrl key at all (the small time delta is hard to detect using the current architecture of Vimium C).

---Original--- From: @.> Date: Fri, Aug 18, 2023 06:47 AM To: @.>; Cc: "Dahan @.>;"State @.>; Subject: Re: [gdh1995/vimium-c] Ignore modifiers when in LinkHints mode (Issue#988)

It's nice of you to investigate the issue but I have to admit I'm in the minority with this...

The reason ctrl is pressed before e is because e acts as ctrl when held down.

If I press and hold e and then press s it will register ctrl + s.

If I press and release e it will register e. But while e is in the down state ctrl is registered and if nothing else is pressed it will release ctrl and register e.

It's hard to explain. This video does a decent job https://youtu.be/yiwUjLaebuw?t=199 or you can read more about it here: https://precondition.github.io/home-row-mods

It's a feature of programmable keyboards.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

gdh1995 commented 1 year ago

Is there any other modifier key (alt/meta/shift) which may be mixed with a letter key?

---Original--- From: @.> Date: Fri, Aug 18, 2023 06:47 AM To: @.>; Cc: "Dahan @.>;"State @.>; Subject: Re: [gdh1995/vimium-c] Ignore modifiers when in LinkHints mode (Issue#988)

It's nice of you to investigate the issue but I have to admit I'm in the minority with this...

The reason ctrl is pressed before e is because e acts as ctrl when held down.

If I press and hold e and then press s it will register ctrl + s.

If I press and release e it will register e. But while e is in the down state ctrl is registered and if nothing else is pressed it will release ctrl and register e.

It's hard to explain. This video does a decent job https://youtu.be/yiwUjLaebuw?t=199 or you can read more about it here: https://precondition.github.io/home-row-mods

It's a feature of programmable keyboards.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

sommerper commented 1 year ago

The modifiers that can be used for this are:

Shown here: https://zmk.dev/docs/codes/modifiers