Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] option to use (just) <shift> to trigger actions #4612

Open
kkimdev opened this issue Jan 19, 2025 · 8 comments
Open

[Feature Request] option to use (just) <shift> to trigger actions #4612

kkimdev opened this issue Jan 19, 2025 · 8 comments

Comments

@kkimdev
Copy link

kkimdev commented Jan 19, 2025

Hi, f key often conflicts with website-defined shortcuts (like f is Fullscreen on YouTube), and personally would prefer to use just <shift> for quick access, not combined with other keys.

This is not possible with vimium now to my understanding, and it would be super useful to me, thanks!

@2zs8ik22
Copy link

youtube

@philg-dev
Copy link
Contributor

If you're frequently "annoyed" by "F" for fullscreen on websites with video players, you don't necessarily need to unmap / exclude the Vimium f key in order to use the fullscreen hotkey. You could simply go into insert mode with i to pass all of your next key events to the underlying website until you exit insert mode again.

Another option is to bind Vimium's passNextKey command to a key of your choice to only pass the very next key you press to the website. That way you wouldn't need to enter and exit insert mode.

Maybe this helps.

@kkimdev
Copy link
Author

kkimdev commented Jan 20, 2025

Thanks for the answer and tips! I really appreciate this awesome extension you're maintaining!

Personally, I prefer using Shift. I first encountered using Shift for quick link shortcuts on a random browser a few years ago (I can't remember the name), and I really enjoyed the experience.

I might be in the minority, so please feel free to close this issue. I'm considering creating a private fork to have this feature for myself, but I opened an issue just in case.

@philg-dev
Copy link
Contributor

I really appreciate this awesome extension you're maintaining!

I'm just a mere Vimium user - I'm not a maintainer. I just try to help out when people have issues.

Maybe your feature request will get traction, so I guess let's see if anybody else has an opinion on this before you close it.

@kkimdev
Copy link
Author

kkimdev commented Jan 21, 2025

Actually, I wonder if I can trigger a Vimium action programmatically. I can enable the following shift detection snippet on every page using this extension https://chromewebstore.google.com/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld

let isShiftKeyDown = false;

document.addEventListener('keydown', (event) => {
  if (event.key === 'Shift') {
    isShiftKeyDown = true;
  }
});

document.addEventListener('keyup', (event) => {
  if (event.key === 'Shift' && isShiftKeyDown) {
    executeShiftSequence();
    isShiftKeyDown = false;
  }
});

function executeShiftSequence() {
  // Your code here to handle shift down-shift up sequence
  console.log('Shift down-shift up detected!');
}

@UncleSnail
Copy link
Contributor

UncleSnail commented Jan 21, 2025

I'd think it would be easier to just make your own fork, but you could try doing it that way.

As far as having modifier keys alone trigger actions, it seems doable, but a major conflict is that many of the default shortcuts use shift as part of the shortcut. For example, we have j, k, and J, and K. If we added a mapping for <shift> then we couldn't do J or K without triggering the quicklinks <shift> binding.

Of course, a user could always remap all keys to not use any with shift, but since many defaults use shifted keys, I wouldn't see this being a very used feature.

Those are just my thoughts. Having it as an option could be good. If we did, we might need to implement a warning to let people know they would break their other bindings.

@kkimdev
Copy link
Author

kkimdev commented Jan 21, 2025

but a major conflict is that many of the default shortcuts use shift as part of the shortcut. For example, we have j, k, and J, and K. If we added a mapping for <shift> then we couldn't do J or K without triggering the quicklinks <shift> binding.

Yeah right, this case is handled in the above code fwiw. When another key is pressed after , like -, isShiftKenDown becomes false and keyup event wouldn't call executeShiftSequence.

@kbilsted
Copy link

consider installing https://github.com/houmain/keymapper and create a binding for shift that is specific to your browser task.

something like

[path="FIREFOXEXE"]
ShiftLeft >> Q 

then in vimium bind Q to your liking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants