A tiny package for manipulating the default browser cross platform.
package main
import (
"fmt"
"github.com/LQR471814/marionette"
)
func main() {
browser, err := marionette.DefaultBrowser()
if err != nil {
panic(err)
}
switch browser {
case marionette.CHROME, marionette.EDGE:
marionette.OpenBrowser(`--app=https://google.com`, `--guest`)
default:
fmt.Println("The default browser configured on this computer isn't supported!")
}
}
const (
UNDEFINED BrowserType = iota
CHROME
EDGE
FIREFOX
)
func DefaultBrowser() (BrowserType, error)
func GetBrowserPath() (string, error)
func OpenBrowser(args ...string) error
type BrowserType int
type UnknownBrowserType struct{}
func (*UnknownBrowserType) Error() string