-
Notifications
You must be signed in to change notification settings - Fork 8
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
OpenNewTab: Support Vivaldi #89
Conversation
Vivaldi is a Chromium-based browser that has decided to present itself as Chrome but that differs from Chrome in a number of ways. In particular, Vivaldi uses shift+click to open a link in a new foreground tab and ctrl+shift+click to open a link in a new foreground *window*. This adds support to detect Vivaldi and change the simulated click that the "OpenNewTab" command executes accordingly. Per this SO answer[1], we must use the extension tabs API to identify Vivaldi, and this requires some extra work that we'd prefer to do just once, so we do it as part of the options setup on the background Program. Additionally, the check requires accessing a property that the WebExtension definition of `browser.tabs.Tab` doesn't know about, so we have to extend that interface in @types.globals.d.ts for this special case. [1]: https://stackoverflow.com/a/77047611 Closes lydell#39
I've successfully run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I like it! I left some comments.
There's no need for it to be a method. Also, move the initialization of `chromiumVariant` a bit to avoid breaking up a sequence of related assignments.
We know the valid values are "", "chrome", and "vivaldi".
We'd like to avoid adding new state until we need it. In the meantime, we're willing to live with a little more complexity where we dispatch the OpenNewTab message in order to handle the asynchronous `browser.tabs.query()` API.
I've pushed some changes to address comments. I went with the approach of detecting Vivaldi "online", right before dispatching the |
Vivaldi uses ctrl+click to open a tab in the background. So when we detect Vivaldi, we _do_ want to ctrl-click if we're asked to open a tab in the background rather than the foreground.
Fixed a bug I introduced while focusing on opening tabs in the foreground. We do want to ctrl-click in Vivaldi when opening a tab in the background (we just don't want |
Thanks for working on this with me! I see now what you meant about using |
Status: Hoping to get some time to merge and make a release soon. |
Vivaldi is a Chromium-based browser that has decided to present itself as Chrome but that differs from Chrome in a number of ways. In particular, Vivaldi uses shift+click to open a link in a new foreground tab and ctrl+shift+click to open a link in a new foreground window.
This adds support to detect Vivaldi and change the simulated click that the "OpenNewTab" command executes accordingly. Per this SO answer, we must use the extension tabs API to identify Vivaldi, and this requires some extra work that we'd prefer to do just once, so we do it as part of the options setup on the background Program. Additionally, the check requires accessing a property that the WebExtension definition of
browser.tabs.Tab
doesn't know about, so we have to extend that interface in @types.globals.d.ts for this special case.Closes #39