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

Safari support #64

Open
avernet opened this issue Jun 27, 2018 · 17 comments
Open

Safari support #64

avernet opened this issue Jun 27, 2018 · 17 comments

Comments

@avernet
Copy link

avernet commented Jun 27, 2018

This extension is available for Chrome, Firefox, and Edge. Excellent, but what about Safari? ;)

@infokiller
Copy link
Owner

I welcome PRs that add support to Safari. It shouldn't be hard, but it should be implemented and maintained by someone who is regularly using Safari.

@infokiller infokiller added seeking user feedback Need more feedback from users to make an informed decision on this issue waiting labels Jun 22, 2020
@rhozacc
Copy link

rhozacc commented Jun 23, 2021

Tried converting current release of this extension with Safari Web Extension Converter (Xcode 12.5.1) using:

xcrun safari-web-extension-converter <folder>

..but I encounter an error:

Unable to parse manifest.json at …

Any hints?

@srikat
Copy link

srikat commented Nov 12, 2021

Got it working in Safari via https://www.youtube.com/watch?v=V5UPRseAhq4 and https://stackoverflow.com/questions/39524148/xcode-error-code-signing-is-required-for-product-type-application-in-sdk-ios.

@badrbouslikhin
Copy link

badrbouslikhin commented Dec 15, 2021

@srikat any way you can distribute your Safari port?

@tiktuk
Copy link

tiktuk commented Dec 27, 2021

Yeah, @srikat, would love to try your port!

@cerenkeklik
Copy link

Tried converting current release of this extension with Safari Web Extension Converter (Xcode 12.5.1) using:

xcrun safari-web-extension-converter <folder>

..but I encounter an error:

Unable to parse manifest.json at …

Any hints?

have you found any solution about that?

@rhozacc
Copy link

rhozacc commented Apr 6, 2022 via email

@infokiller infokiller removed the seeking user feedback Need more feedback from users to make an informed decision on this issue label May 31, 2022
@jackhodkinson
Copy link

jackhodkinson commented Jun 25, 2022

I have figured out how to get the converter to work but the extension is not working as expected on Safari. I see the blue arrow but when I press j or k the arrow does not move :(

  1. I cloned the repo git clone https://github.com/infokiller/web-search-navigator
  2. I ran the converter from the src directory xcrun safari-web-extension-converter --macos-only .
  3. This created an Xcode project which complied successfully and prompted me to activate it from Safari.
  4. Following the instructions from the video linked by @srikat I enabled the "Develop" menu (by going to the Advanced tab of Safari preferences and checking the box for "Show Develop menu in menu bar").
  5. I enabled unsigned extensions by going to Develop > Allow Unsigned Extensions in the menu bar.
  6. I went to the Extensions tab of the Safari preferences and found Web Search Navigator and checked it to activate it.
  7. I went to Google and ran a search, I was prompted to allow the extension to run which I enabled.
  8. Now I can see a blue arrow on the first search result but it does not move when I press j or k :(

I'm a bit stuck, not sure what to try next. Any tips @srikat?

I'm not very familiar with debugging Safari extensions. Any resources or advice?

P.s. I also followed the instructions for signing the target but still same thing.

@jackhodkinson
Copy link

jackhodkinson commented Jun 25, 2022

I did a bit of debugging and it looks like the program is hanging the first time Mousetrap is called in main.js:238 (link to part of the code)

I modified this part of the code with the log statement:

// main.js
...
WebSearchNavigator {
  ...
  bindKeys() {
    ...
    if (global) {
      ...
    } else {
      console.log("We are about to bind shortcut \"" + shortcut + "\" with Mousetrap")
      Mousetrap(element).bind(shortcut, wrappedCallback);
      console.log("We have finished binding shortcut \"" + shortcut + "\" with Mousetrap")
    }
    ...
    console.log("Ending the bindKeys call")
  }
  ...
}
...

And my console output is only this:

We are about to bind shortcut "z z" with Mousetrap."

So it looks like Mousetrap is hanging and bindingKeys is never completing. Any tips?

@jackhodkinson
Copy link

One more update: I have a new error message in my console. Not sure why it was not coming up before but now I'm seeing this:

Unhandled Promise Rejection: ReferenceError: Can't find variable: Mousetrap

I think I have not installed the dependencies correctly before converting this to a Safari extension.

@infokiller
Copy link
Owner

@jackhodkinson just a guess, but did you run yarn install && yarn build?
See https://github.com/infokiller/web-search-navigator#building-for-development

@jackhodkinson
Copy link

Thank you @infokiller that worked! 🎉

Steps to make this work:

  1. clone repo
  2. run yarn install && yarn build
  3. run xcrun safari-web-extension-converter --macos-only . from the src directory
  4. xcode will automatically launch with a new project
  5. run the Xcode project (command-r)
  6. launch Safari
  7. Enabled unsigned extensions by going to Develop > Allow Unsigned Extensions in the menu bar
  8. Enable the Web Search Navigator in Safari preferences
  9. Go to google, run a search, now you should see the blue arrow and j and k will move it 🙌

To avoid having to re-enable unsigned extensions every time you open Safari follow these instructions to sign the extension and rebuild it.

So I have got this working for me but not sure how I can help distribute this to help others. Should I make a PR in README.md? I have not packaged and distributed a mac app/Safari extension before but I can look into that too.

@infokiller
Copy link
Owner

Thanks @jackhodkinson for making it work and documenting the process!
I'll update the README with a link to your comment above (warning this best-effort and not really supported).
Regarding packaging, I don't object it, but I don't think it's required yet since this is only suitable for "power users".
If I'll have some free time, I'll look into running MacOS in a VM, testing the extension, creating a developer account, and possibly publish it.

@victor-falcon
Copy link

victor-falcon commented Dec 1, 2022

This helps me to sign the extension so I can use it without allowing unsigned extensions.

https://stackoverflow.com/a/62748969/1651152

@NikoKS
Copy link

NikoKS commented Aug 2, 2023

@infokiller Is there still any plan to package this as an App Store application? Just found out about this extension, and it's exactly what I needed. But the steps above somehow does not work for me. (failed in step 3)

@infokiller
Copy link
Owner

@NikoKS I'm not aware of any plan, I don't use Safari at all so someone will need to volunteer

@jimmyrelife
Copy link

jimmyrelife commented Dec 15, 2023

@infokiller Is there still any plan to package this as an App Store application? Just found out about this extension, and it's exactly what I needed. But the steps above somehow does not work for me. (failed in step 3)

I also encountered troubles in the step 3, and ended up knowing that "safari-web-extension-converter" should be called in a full name. But I don't have a development account, so the extension would be hidden for every time opening Safari. Still need someone has an account to publish.

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

No branches or pull requests