[TODO] openDefaultBrowser now works on OSX #13892
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
macos
in Nim codeTODO 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 browseropen -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 workopen -a 'Safari' ~/data/chestnut-horse-autumn_1000.jpg
workshttps://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
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