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

automatically open browser window to correct url #10

Open
maxheld83 opened this issue May 31, 2019 · 2 comments
Open

automatically open browser window to correct url #10

maxheld83 opened this issue May 31, 2019 · 2 comments

Comments

@maxheld83
Copy link
Owner

this would be nice to have.
@Ch1pzZz suggested to do this by locating the browser exe, but I don't think that scales (will be different on every OS and computer).
It might be worthwhile to figure out whether there is a system utility to open the system default browser to a certain URL from the shell.

If there is no such system utility, it might be worthwhile installing one.

Or maybe some browsers have a CLI interface that we could call, and we could just use that if the browser is installed.

But overall, this isn't super important.
We can also just point users to open a url in the browser.

@Ch1pzZz
Copy link
Collaborator

Ch1pzZz commented Jul 29, 2019

https://stackoverflow.com/questions/3124556/clean-way-to-launch-the-web-browser-from-shell-script

found this. Think this should open the brower and the URL could be entered in the script too. If it works the way I think it does that should also make #11 obsolete as we could use the line in the scrip and people wouldnt even have to copy the URL?

@maxheld83
Copy link
Owner Author

I think it should be possible to hack together a little wrapper using the commands in this so-answer.
You'd basically be checking in some order whether some tool is available, and if not, test the next one until the script can successfully open the browser, or exit with a warning message or something.
It's not super critical to open the browser, so it need not be an error if it's not possible.

I guess on macos you'd have to use the call in one of the other answers open....

So as not to paste macOS commands into Linux and vice-versa, it might be a good idea to test whether the current OS is Linux or macOS, independently of which tools are available.
open ... AFAIK, doesn't exist/work on Linux, so it'd be weird to even test it there.

But those are just details, I think this answer has all of whats needed.

Basically a lot of bash control flow (if clauses :).

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

2 participants