Surfingkeys
Surfingkeys copied to clipboard
Feature to disable Surfingkeys by default
Currently Surfingkeys are enabled by default and we can disable it by shortcut Alt-S. Would there be a way to reverse this behavior like Alt-S to enable it for new tab, then Alt-S again if wanted to disable for that tab.
Thanks.
I would like the same thing. Example use case:
On certain sites which provide a lot of their own keybindings (e.g. github.com or youtube.com), I want Surfingkeys disabled by default so that it does not interfere with the keybindings of that site. However occasionally I want to use some Surfingkey shortcut, e.g. W
to move a tab to a different window. Currently this requires:
-
Alt-S
to enable Surfingkeys - Use the Surfingkey shortcut
W
- Remember to do
Alt-S
to disable Surfingkeys again
It gets messed up if I forget the last step, and also this has the unwanted side effect of temporarily enabling Surfingkeys on any other github or youtube tab I have open at the same time.
Proposed solution
Implement some inverse of both Alt-i
for PassThrough mode, and p
for ephemeral PassThrough, e.g. so that even when Surfingkeys is disabled:
-
Alt-i
(or some other binding) would temporarily re-enable it for the current tab, until the tab is closed, orEscape
is pressed -
Alt-p
(or some other binding) would re-enable it just for some milliseconds in the same way thatp
activates ephemeral PassThrough.
The only catch is that these bindings would have to be carefully chosen not to conflict with any keybindings of the website, and since this applies across multiple sites, they might need to be configurable per site.
What about the having the ability to disable it based on a list of hosts? Ex: have it disabled for mail.google.com etc...
@fabiomcosta
Disabling Surfingkeys by default for certain sites is already possible. I believe you're looking for settings.blocklistPattern
(which takes a Javascript Regex). Example:
settings.blocklistPattern = /.*stadia\\.google\\.com.*/"
Note that adding a site (or sites) to this setting does not prevent Alt-s from re-enabling SurfingKeys. If I had to guess, that's by design. ...so @nchicong this setting might solve your problem too. Disabling SK for everything might also be possible if you just wildcard everything in settigns.blocklistPattern with something like ".*", but I haven't tried that.
@aspiers If you want to disable SurfingKeys stuff for a site except for the W
, you can probably use unmapAllExcept
. Give it a shot? 🤷
@aspiers If you want to disable SurfingKeys stuff for a site except for the
W
, you can probably useunmapAllExcept
. Give it a shot? 🤷
Thanks but that's not what I want. The W
was just an example of one use case.
I found out about this extension today and would like to have this behaviour. I tried this:
Note that adding a site (or sites) to this setting does not prevent Alt-s from re-enabling SurfingKeys. If I had to guess, that's by design. ...so @nchicong this setting might solve your problem too. Disabling SK for everything might also be possible if you just wildcard everything in settigns.blocklistPattern with something like ".*", but I haven't tried that.
but unfortunately it doesn't work. The hotkey runs but surfing key will always be disabled
@brookhong Any thoughts on this? Thanks!
@aspiers If you want to disable SurfingKeys stuff for a site except for the
W
, you can probably useunmapAllExcept
. Give it a shot? 🤷Thanks but that's not what I want. The
W
was just an example of one use case.
unmapAllExcept
accepts an array as parameter, such as
unmapAllExcept(['E','R','T'], /google.com|twitter.com/);
Any other use cases?
Oh wow, that's awesome, thanks! I didn't know it was possible to selectively map/unmap keys per site. That opens up a ton of new possibilities.
However it still doesn't really solve the problem. The challenge is finding the best way to gain immediate access to all standard SurfingKeys shortcuts and all shortcuts defined by a site. For example, here on GitHub, there are a ton of native shortcuts:
If I use unmapAllExcept
, then for each shortcut key, I'm forced to choose between either GitHub or SurfingKeys. But I want both sets of shortcuts!
For example, gi
is really useful for jumping to the GitHub issue tracker, but the g
prefix key in SurfingKeys is also really useful. None of the existing approaches are perfect:
Approach | Problem |
---|---|
unmapAllExcept
| Forces choice between site shortcut and SK shortcut |
Use map / unmap with domain parameter
| Forces choice between site shortcut and SK shortcut |
Use Alt-i or p for ephemeral pass-through
| Doesn't default to the site shortcuts |
Remap SK shortcuts to other keys just for specific sites | Means that you have to remember two shortcuts for each SK command. Also configuration takes a lot of work. |
So I think that my previously proposed solution of an "ephemeral overlay" would still be very helpful to have.
Another way of thinking about it is as follows:
Currently, when SurfingKeys is disabled on a site (via Alt-s
), then all that site's shortcuts are available, except for Alt-s
which will re-enable SurfingKeys. I'm proposing that in addition to Alt-s
re-enabling SK, two other key-bindings are available (in an optional and configurable way) which also re-enable SK, but only in an ephemeral manner for the current tab: Alt-i
and p
as described above.
Looks like this kind of reverse mode is working partly now, please try following steps,
- Click the Surfingkeys icon on top right corner of your browser.
- Click
Disable Surfingkeys x.x.x
from the menu. - Now you're in this kind of reverse mode.
Surfingkeys is turned off by default for every site, you can enable Surfingkeys with Alt-s
only for current site. But there're two issues now,
- The enablement of the site is gone after page reload (but this behavior happens to be what you want).
- The Surfingkeys icon does not reflect its status, which means surfing keys are available though the icon is grayed out.
Regarding Alt-i
or p
in disable mode to enable Surfingkeys, it might confuse users considering the complexity.
Thanks a lot for working on this! Which version adds this new behaviour? I'm on 1.1.0, and if I globally disabled it then Alt-s
just generates a popup "Surfing keys is globally disabled, please enable it globally from popup menu."
However, sorry if I wasn't clear but the new behaviour described isn't quite what I was hoping for. Ideally Surfingkeys would be on by default for every site, since most sites do not offer their own key bindings. It would only make sense to have it off by default for sites like GitHub which offer their own key bindings, to avoid the conflicts. On those sites, Alt-i
and p
(or similar) would pass-through from the native bindings to Surfingkeys. So they would be the exact opposite of how they work when Surfingkeys is enabled. If there is a concern that this "mirrored" behaviour would confuse users, then it could be made optional instead of a default binding.
To be clear, the main problem with the new behaviour described above is that for the majority of sites, pressing Alt-s
would be required every time a site is loaded into a tab, and then the user also has to remember in which tabs they have pressed Alt-s
and which still need it pressing. I think that would introduce quite a lot of friction.
I am looking for this exact thing as well. I would love it if there were a key combo that would ephemerally enable SurfingKeys on a website when SurfingKeys is disabled. There are a few pages where I find that SurfingKeys gets in the way (Confluence page editing is the big culprit) and I just need to keep SurfingKeys disabled there or I go mad.
But then I need to jump to another page during my edit session, and I would love to be able to type <Alt-i> og How to build a widget<enter>
to quickly get to a google search. When I go back to the Confluence tab I would feel more comfortable if SurfingKeys were back off so I could get back to typing. To be clear, it wouldn't need to be <Alt-i>
, any key combo would do.
@brookhong, is this something I could do in my own personal config by recreating the disabled
mode and overwriting it? I've remapped a number of keys but I'm not familiar enough with the API to know whether this would work or just cause chaos.
Any more thoughts on this @brookhong?
Ok, here is the plan.
A new mode will be introduced, which might be named as lurk
, user can specify the pages where Surfingkeys will lurk until it is called out by Alt-i
or p
(for ephemeral case), such as
settings.lurkingPattern = /https:\/\/github\.com|.*confluence.*/i;
If the loading page matches with the lurkingPattern
, Surfingkeys will enter lurk
mode by default, in which mode only Alt-i
and p
are registered by Surfingkeys to activate normal
mode. When user presses Esc
or timeout, Surfingkeys reverts back to lurk
mode.
The extension icon in toolbar will also be updated to reflect current status of Surfingkeys, which will be
- Grey -- disabled.
- Half Grey/Half Color -- lurking.
- Color -- enabled.
@brookhong This sounds perfect! Thanks so much! :heart:
Can't wait to try this out @brookhong! Any ideas when it will be included in a new release?
1.14.0 has been submitted to CWS, it's pending review now.
1.14.0 has been approved and released now, please upgrade to it and try.
@brookhong it almost works perfectly! I found a few small issues:
- For some reason I'm no longer seeing any
statusLine
popups: neither when switching fromlurk
tonormal
nor in the previous pass-through mode. (EDIT: filed as #2005) - I realised that having
p
as the binding for ephemeral activation ofnormal
mode isn't a good idea, because that conflicts with normal use of that key. For example, if I'm on https://github.com/brookhong/Surfingkeys with lurk mode activated, and I want to search forpopup
, I would expect to be able to type/popup
, but that results in a search foropup
because the firstp
gets swallowed. MaybeAlt-p
would be a better binding. - Having
Alt-i
as the binding for sticky activation ofnormal
mode has problems too. E.g. in https://docs.google.com/ that clashes with activation of theInsert
menu. - Based on 3. and 4. above, I think the key-bindings for this feature need to be configurable: not just the defaults for all sites, but also with an extra option of configuring per-site for some sites. If per-site configuration is not available, that would require the user to find single key bindings to replace
Alt-i
andp
which work on all sites, but it's impossible to guarantee that such a key binding would work on every site. - When in
lurk
mode on https://github.com/brookhong/Surfingkeys, if I press/pp
then the extension always crashes:
Thanks @aspiers for the findings.
The issues related with lurk mode should have been fixed in 1.15.0. p
should works fine now. And to resolve the conflict of Alt-i
, please try to use api.lmap
to change it.
Feel free to reopen this, if there is more issue related with lurk
mode.
I don't have permissions in GitHub to reopen this issue, but I found bugs with 1.15.0:
- Enable lurk mode on twitter.com
- Set
settings.showModeStatus = true;
- Visit twitter.com
- Press
p
?
to show SK help - The status line changes to
Lurk
, which doesn't seem quite right - Press
Escape
to exit SK help - The status line changes to
Normal
, which is definitely not right, because pressing?
shows Twitter help, proving that we're actually inLurk
mode instead of normal. - For further proof that the status line of
Normal
is wrong, pressp
and then wait for timeout. Now the status line changes fromNormal
toLurk
, which is finally correct.