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

[TODO] openDefaultBrowser now works on OSX #13892

Merged
merged 1 commit into from
Apr 6, 2020

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Apr 6, 2020

TODO for future PR's

openDefaultBrowser is still too naive though (and not just on OSX)

examples on OSX:

  • open nimdoc.out.css opens in your editor instead of browser
  • open -a 'Google Chrome' nimdoc.out.css works (but see below...)
  • open ~/data/chestnut-horse-autumn_1000.jpg will not open in the browser but in your configured image editor.
  • open -a 'Google Chrome' ~/data/chestnut-horse-autumn_1000.jpg doesn't even work
  • open -a 'Safari' ~/data/chestnut-horse-autumn_1000.jpg works
  • this seems the most reliable way to get the user's browser:

https://github.com/kerma/defaultbrowser/blob/master/src/main.m (single file, could be compile'd in in objc mode)
see also https://stackoverflow.com/questions/17528688/set-default-web-browser-via-command-line
which we could use via open -a $app $file

so at least it would fix some issues like opening files in your browser instead of editor, but not sure about the jpg example

  • there should be an option to not ignore error (ignoring errors is pretty much guaranteed to cause hard to find bugs; specific applications can always try/catch)

EDIT: ok this seems to be the only thing that works reliably to open a jpg on browswer:
open -a 'Google Chrome' -n file:///Users/timothee/data/chestnut-horse-autumn_1000.jpg
any removed option (removing file://, removing -n or removing -a 'Google Chrome') will fail

but 'Google Chrome' should be replaced by auto detection

@timotheecour timotheecour mentioned this pull request Apr 6, 2020
1 task
@Araq Araq merged commit e6d8708 into nim-lang:devel Apr 6, 2020
@timotheecour timotheecour deleted the pr_fix_openDefaultBrowser_macos branch April 6, 2020 06:30
@timotheecour timotheecour changed the title openDefaultBrowser now works on OSX [TODO] openDefaultBrowser now works on OSX Apr 6, 2020
narimiran pushed a commit that referenced this pull request Apr 14, 2020
narimiran pushed a commit that referenced this pull request Apr 14, 2020
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.

misc issues
2 participants