fwextensions / QuicKey

Jump between recent tabs in Chrome via keyboard shortcuts or a most recently used (MRU) menu.
https://fwextensions.github.io/QuicKey
214 stars 21 forks source link

When switching instantly between tab A and B, tab B isn't stored as the current tab until 750ms elapses #51

Closed vexersa closed 3 years ago

vexersa commented 3 years ago

I'm getting some inconsistent behaviour when using the "Switch Instantly Between The Two Most Recent Tabs" function.

I've bound the keyboard shortcut as below:

image

For the most part, this works as expected, where pressing the Alt+Q combination switches between the tabs as expected. However, occasionally it won't work as expected.

I have three tabs open: Tab A Tab B Tab C

Tab A to Tab B = Works Tab A to Tab C = Works Tab A to Tab C, click Tab B, press hotkey = Goes to Tab A, hotkey will then jump between Tabs A and B, not between the expected Tab C and B

This seems to be related to some sort of timeout. If I perform the tab switching quickly manually, as in quickly click between Tabs A and B, then press the hotkey, the unexpected behaviour occurs. If I click more slowly between Tabs A and B, then press the hotkey, the expected behaviour occurs.

Is there any way I can decrease the time needed for the system to "capture" which tabs I'd like to switch between? This is quite important for me as often I know which tabs need to be switched between and click between them in rapid succession, but obviously need the functionality of this plugin to be able to do the switching for me via the keyboard.

I hope that this explanation makes sense. If someone could try the below steps to replicate it that would be appreciated:

  1. Open three tabs (Google, Bing and DuckDuckGo in my instance)
  2. Rapidly click between Tabs A and B slowly and press the "Switch Instantly Between The Two Most Recent Tabs" hotkey
  3. The tabs should switch as expected.
  4. Now, click quickly between the tab you are on and Tab C, then press the hotkey.
  5. There will likely be some unexpected/undesirable behaviour as a result.

Thanks!

fwextensions commented 3 years ago

Thanks for the detailed feedback! You're right, the 750ms timeout that applies while navigating through the recent stack with the Switch to next/previous tab commands can also apply after using the Switch instantly command if you then switch to another tab using some other method (like manually clicking). If you wait at least 750ms after switching from tab A to tab C with the command, clicking tab B and then pressing the shortcut will switch between B and C, as desired.

I've fixed this in a branch I've been working on for awhile, so I'd forgotten it was happening. I'm not sure how easy it would be to bring that fix into the main branch without everything else.

vexersa commented 3 years ago

Great! I'm happy my explanation actually made sense.

It would be great to decrease this time or make it possible to do so with a slider, etc.

fwextensions commented 3 years ago

Looks like it may just be a one line change to fix this use case, so I should probably just bring it into the main branch and do a point release.

vexersa commented 3 years ago

That would be 🧙

fwextensions commented 3 years ago

Hmm, the one line fix didn't fix this in all cases, so I'm looking into it some more.

fwextensions commented 3 years ago

Wait, nvm, it was fixed. I just confused myself with too many test versions of the extension installed. :|

vexersa commented 3 years ago

👌