elementary / default-settings

Default settings for elementary OS
GNU General Public License v3.0
39 stars 28 forks source link

Support $BROWSER env variable? #109

Closed peteruithoven closed 5 years ago

peteruithoven commented 5 years ago

Could we start supporting the $BROWSER env variable? That would make calling the default browser from the command line easier. This would allow us to for example initiate a search with the user's default browser with the user's default search engine with something like:

$BROWSER --search "something I'd like to know"

https://wiki.archlinux.org/index.php/environment_variables#Default_programs

It's currently tricky to retrieve the default browser: https://stackoverflow.com/questions/3124556/clean-way-to-launch-the-web-browser-from-shell-script https://blog.codef00.com/2011/02/18/the-default-browser-on-linux-debacle/

cassidyjames commented 5 years ago

For most cases, simply using xdg-open is sufficient, or in an app, Gtk.show_uri (). I don't think supporting a non-standard environment variable in order to support a non-standard method of performing a search is something we'd want to do. It's clever, but also seems error-prone.

peteruithoven commented 5 years ago

@alcinnz also had a good point:

Here's the standard APIs you can use to find and run the default browser (as well as the default app for any URI scheme or MIMEtype): https://valadoc.org/gio-2.0/GLib.AppInfo.html

I'll close the issue.