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

Implement global hotkey for tab selector #547

Closed
wants to merge 1 commit into from

Conversation

karlicoss
Copy link

Certain websites (e.g. Gmail, Twitter, Remember the Milk, etc.) have their own keybindings which are kinda okay to use. However, if you turn off Surfingkey on them, you end up having no means of switching a tab via Surfingkey hotkey which is pretty annoying. So to get around this I had lots of following code in my config:

if (window.location.origin === "https://www.gmail.com") {
// lots of unmap commands. Basically everything but the key to switch tab
}

...which is of course a bit annoying and not very sustainable.
So I've added a global hotkey setting which would let you set a global hotkey to invoke the awesome tab selector regardless of Surfingkey being active on current page.
It's literally the first time I am commiting to a chrome extension, so let me know if it's hacky or anything, but I think I got it right.

@brookhong
Copy link
Owner

Looks like unmapAllExcept is enough for your case.

// only keep E, R and T from Surfingkeys for gmail.com and twitter.com
unmapAllExcept(['E','R','T'], /gmail.com|twitter.com/);

You could use your own regex for the second parameter to extend sites.

@karlicoss
Copy link
Author

Ah, I see, should have read the docs :) Feel free to close then (unless you still think this PR is useful, I personally find it easier to just have a global hotkey, but given that the number of websites which have hotkeys is quite small, that's okay). Thanks!

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

Successfully merging this pull request may close these issues.

2 participants