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: Safari support on macOS Big Sur with new Web Extension API #3610

Open
zhigang1992 opened this issue Jun 28, 2020 · 25 comments

Comments

@zhigang1992
Copy link

zhigang1992 commented Jun 28, 2020

with Safari Web Extensions API we should be able to support Safari using the same codebase.

This would be very great since current alternatives on Safari doesn't have feature parity with Vimium.

Links:

https://developer.apple.com/documentation/safariservices/safari_web_extensions
https://developer.apple.com/videos/play/wwdc2020/10665/
https://hacks.mozilla.org/2020/06/welcoming-safari-to-the-webextensions-community/

@gdh1995
Copy link
Contributor

gdh1995 commented Jun 28, 2020

It requires an Apple Developer account, which means 99 US dollars every year...

@neilyio
Copy link

neilyio commented Jul 3, 2020

Is there anyway to donate to the Vimium effort to help cover the cost of something like this? The Safari Web Extensions API was probably the WWDC announcement that excited me most, particularly because of the potential of seeing Vimium work.

@zhigang1992
Copy link
Author

zhigang1992 commented Jul 3, 2020

We have couple of options here:

  1. We can have donations to cover the cost. (GitHub Sponsor etc)
  2. We can sale the app in AppStore to cover to cost. Like (Dark reader)
  3. Deploy with some one's personal account (I'm happy to contribute mine since we need the enroll in Apple Developer Program anyway)
  4. Not distribute to AppStore, and user can either build it with Xcode or create they own distribution method.

My only concern is that Safari's WebExtension API support isn't good enough for vimium

@nbelzer
Copy link

nbelzer commented Jul 11, 2020

I'm also interested in this. Currently I'm working a bit on Vimari, one of the Safari alternatives out there on my own fork. As I'm running the macOS Big Sur beta I was able to successfully run the Safari Web Extension converter on the Vimium project with the following result:

$ xcrun safari-web-extension-converter ./vimium --project-location ./vimium-xcode
Xcode Project Location: ./vimium-xcode
App Name: Vimium
App Bundle Identifier: com.yourCompany.Vimium
Language: Swift
Is this correct? [yes]: yes
Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:
        history
        clipboardRead
        match_about_blank
        bookmarks
        sessions
        notifications

Initially the extension could not be run as there was an error in the manifest content_scripts on line 78 where the matches key is defined for content_scripts/file_urls.css.

"matches": ["file:///", "file:///*/"],

I'm not familiar with the codebase for Vimium but I figured that removing a css file from the manifest wasn't going to break the application, if it even worked at all, so I removed this section of the manifest. After this I was able to build and activate the extension in Safari 14.

I did encounter an issue where upon activation Safari crashes due to it not being able to convert something to grayscale (presumably the logo, as all extension logos are grayscale). The icon of Vimium also doesn't show up in Safari after a restart.

Screenshot 2020-07-11 at 19 10 32

Screenshot 2020-07-11 at 19 30 26

However the extension seems to be activated and in this next image you can see all the files loaded by the extension into the page (as would happen for Vimari) after giving the tool permissions to access content on the website.

Screenshot 2020-07-11 at 19 18 31

However sadly none of the functionality of Vimium seems to be working, I'm not seeing any errors in the console (Xcode nor Safari) so it could be that some initial call is not made. If there is an interest in continuing this path to get a working version (perhaps not with all of the functionality) of Vimium in Safari I'd be willing to spend an afternoon with someone more familiar with the Vimium codebase to try and get it to work.

@gdh1995
Copy link
Contributor

gdh1995 commented Jul 11, 2020

Vimium should own a background page, so the error messages might be in the console of the bg page, instead of the options page.

@nbelzer
Copy link

nbelzer commented Jul 11, 2020

You were right, I found an error in the background page:

Screenshot 2020-07-11 at 20 50 17

@danielcompton
Copy link

danielcompton commented Jul 13, 2020

Hi folks! I'm the (sometimes absent) maintainer of Vimari, a Safari port of Vimium. Vimari was forked from the Vimium codebase many years ago and has mostly lagged behind new features in Vimium. I'm very excited by the new Safari Web Extension support, in theory it would let us unify the Vimari codebase with the Vimium one (if desired). I see a few opportunities for collaboration here, depending on what the maintainers of Vimium would like:

  • Add support for Safari Web Extensions to Vimium and have the Vimium devs manage releases outside of the App Store (updates here will be harder)
  • Add support for Safari Web Extensions to Vimium and have the Vimium devs manage releases to the App Store
  • Add support for Safari Web Extensions to Vimium and have the Vimari devs (currently me) manage releases to the App Store. This could be renamed to Vimium if you liked.
  • If you're not interested in Safari support, or want to take a wait-and-see approach, Vimari creates a new fork of the Vimium codebase to build a Safari capable port, contributing patches upstream where possible, and running our own releases through the App Store
  • Vimari branches a new fork from Vimium and just creates our own fresh codebase. This is essentially what was done many years ago and would be my least preferred option.

@gdh1995
Copy link
Contributor

gdh1995 commented Jul 14, 2020

@danielcompton I'm curious whether the 1st idea is possible or not - is developers allowed to load a dev version of Vimium to Safari without an Apple account?

@philc
Copy link
Owner

philc commented Jul 14, 2020

@danielcompton great to have you! I am very interested in Safari support. Of the options you presented, the second is the goal. I manage releases to the Chrome and Firefox store and can do so to the App store (I have an active developer account).

Where do we begin?

@cooperpellaton
Copy link

cooperpellaton commented Sep 19, 2020

Safari 14 has publicly shipped. Anyone have open issues they need help with to further this effort?

@srikat
Copy link

srikat commented Sep 26, 2020

Hi. Wondering if there is any progress on this front.

I use Vimium on Chrome and would love to have it in Safari as well.

@benwoodward
Copy link

Would love to see this, Vimium is the one of the very few reasons I still use Chrome. Would love to switch to Safari and have and have my battery life back.

@abrampers
Copy link

Hi. I'm wondering if there's any progress on this.

I've been waiting to use vimium on Safari.

@oxyplugins
Copy link

I am using Vimari just fine in Safari on macOS Big Sur.

@cupcakearmy
Copy link

@philc @danielcompton is there any progress/roadmap? can we help in some way?
Love that vimium wants to embrace the merging of vimari ❤️
I really would like to switch to safari for the sheer speed on there, but without the T (Search through your open tabs) command I'm lost xD

@liangquanzhou
Copy link

@philc @danielcompton is there any progress/roadmap? can we help in some way?
Love that vimium wants to embrace the merging of vimari ❤️
I really would like to switch to safari for the sheer speed on there, but without the T (Search through your open tabs) command I'm lost xD

I'm also waiting for the vimium for Safari. For switching open tabs, maybe this Alfred workflow can help: https://github.com/mandrigin/AlfredSwitchWindows

@arjenzhou
Copy link

@philc can't wait to use vimiim on safari, is there any progress? we would like provide some support if needed ;)

@srikat
Copy link

srikat commented May 10, 2021

For those missing the full Vimium in Safari, check out Orion a Webkit-based browser currently in beta.

It lets us use Firefox and Chrome extensions.

@vegerot
Copy link

vegerot commented Jun 9, 2021

Related to this, with the announcement of Web Extensions for iPadOS, it would be interesting to look into into support for iPadOS as well.

@nnothstine
Copy link

Basic support for this is super easy to get up and running locally — all you have to do, from what I can tell, is check for/remove references to APIs that Safari doesn't support (such as chrome.webNavigation.{onHistoryStateUpdated,onReferenceFragmentUpdated}). Doing that and removing the section for file:// URLs, which I'm not sure Safari actively supports, got the extension up and running for me without issue.

Doing some more debugging now to see what else works and doesn't work, but it's been pretty smooth sailing so far.

@nnothstine
Copy link

Here's what's not working so far:

  1. Commands requiring the clipboard (yy, visual mode copy, P, etc.)
  2. B doesn't have access to bookmarks
  3. F loads a URL in the currently selected tab rather than a new one
  4. X doesn't seem to restore the last closed tab

Everything else seems to be working. This would also probably need some cosmetic changes to be a good citizen in Safari (maybe the icon set from the Vimari repo could be used?), since the icons have the Chromium icon behind them.

Haven't gotten around to testing this on iPadOS, but I'll give it a try later today.

@vprelovac
Copy link

As a heads up, Vimium (and Vimium C) extensions now work natively in Orion Browser.

https://browser.kagi.com

image

@FIRETRAPS
Copy link

@nnothstine, I was wondering if you'd be willing to share a more in-depth guide on how we could port the extension from Chrome to Safari. I was able to get my browser to recognize the extension using Xcode to port it, yet it doesn't work because of an error stating that the extension can't run for 'security reasons'. In what directories exactly do I have to remove some paths or references to the old chrome language in order for it to work? Thanks in advance!

@cheif cheif mentioned this issue Aug 12, 2021
10 tasks
@cagdassalur
Copy link

cagdassalur commented Nov 14, 2021

@nnothstine, I was wondering if you'd be willing to share a more in-depth guide on how we could port the extension from Chrome to Safari. I was able to get my browser to recognize the extension using Xcode to port it, yet it doesn't work because of an error stating that the extension can't run for 'security reasons'. In what directories exactly do I have to remove some paths or references to the old chrome language in order for it to work? Thanks in advance!

What steps did you follow?

For me i did only 2 changes:

  1. Remove the second object in content_scripts (file:// section) from manifest.json:70
  2. Remove lines main.js:104 and main.js:105

After that it was working nearly perfectly on my ipadOS, except the issues @nnothstine mentioned.

@srikat
Copy link

srikat commented Nov 14, 2021

@nnothstine, I was wondering if you'd be willing to share a more in-depth guide on how we could port the extension from Chrome to Safari. I was able to get my browser to recognize the extension using Xcode to port it, yet it doesn't work because of an error stating that the extension can't run for 'security reasons'. In what directories exactly do I have to remove some paths or references to the old chrome language in order for it to work? Thanks in advance!

If you are ok with shortcuts like yy not working, you might as well simply use Vimari instead.

https://github.com/televator-apps/vimari

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