Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/assume/assume.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func AssumeCommand(c *cli.Context) error {
return err
}

if cfg.DefaultBrowser == browser.FirefoxKey || cfg.DefaultBrowser == browser.WaterfoxKey || cfg.DefaultBrowser == browser.FirefoxStdoutKey || cfg.DefaultBrowser == browser.FirefoxDevEditionKey || cfg.DefaultBrowser == browser.FirefoxNightlyKey {
if cfg.DefaultBrowser == browser.FirefoxKey || cfg.DefaultBrowser == browser.WaterfoxKey || cfg.DefaultBrowser == browser.FirefoxStdoutKey || cfg.DefaultBrowser == browser.FirefoxDevEditionKey || cfg.DefaultBrowser == browser.FirefoxNightlyKey || cfg.DefaultBrowser == browser.ZenKey {
// transform the URL into the Firefox Tab Container format.
consoleURL = fmt.Sprintf("ext+granted-containers:name=%s&url=%s&color=%s&icon=%s", containerProfile, url.QueryEscape(consoleURL), profile.CustomGrantedProperty("color"), profile.CustomGrantedProperty("icon"))
}
Expand Down Expand Up @@ -376,6 +376,10 @@ func AssumeCommand(c *cli.Context) error {
l = launcher.Safari{}
case browser.ArcKey:
l = launcher.Arc{}
case browser.ZenKey:
l = launcher.Zen{
ExecutablePath: browserPath,
}
case browser.FirefoxDevEditionKey:
l = launcher.FirefoxDevEdition{
ExecutablePath: browserPath,
Expand Down
22 changes: 22 additions & 0 deletions pkg/browser/browsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
StdoutKey string = "STDOUT"
FirefoxStdoutKey string = "FIREFOX_STDOUT"
ArcKey string = "ARC"
ZenKey string = "ZEN"
FirefoxDevEditionKey string = "FIREFOX_DEV"
FirefoxNightlyKey string = "FIREFOX_NIGHTLY"
CustomKey string = "CUSTOM"
Expand Down Expand Up @@ -65,6 +66,10 @@ var SafariPathMac = []string{"/Applications/Safari.app/Contents/MacOS/Safari"}

var ArcPathMac = []string{"/Applications/Arc.app/Contents/MacOS/Arc"}

var ZenPathMac = []string{"/Applications/Zen Browser.app/Contents/MacOS/zen"}
var ZenPathLinux = []string{`/usr/bin/zen-browser`, `/opt/zen-browser/zen`}
var ZenPathWindows = []string{`\Program Files\Zen Browser\zen.exe`}

func ChromePathDefaults() ([]string, error) {
// check linuxpath for binary install
path, err := exec.LookPath("google-chrome-stable")
Expand Down Expand Up @@ -250,3 +255,20 @@ func ArcPathDefaults() ([]string, error) {
return nil, errors.New("os not supported")
}
}

func ZenPathDefaults() ([]string, error) {
path, err := exec.LookPath("zen-browser")
if err == nil {
return []string{path}, nil
}
switch runtime.GOOS {
case "windows":
return ZenPathWindows, nil
case "darwin":
return ZenPathMac, nil
case "linux":
return ZenPathLinux, nil
default:
return nil, errors.New("os not supported")
}
}
9 changes: 7 additions & 2 deletions pkg/browser/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func HandleManualBrowserSelection() (string, error) {
withStdio := survey.WithStdio(os.Stdin, os.Stderr, os.Stderr)
in := survey.Select{
Message: "Select one of the browsers from the list",
Options: []string{"Chrome", "Brave", "Edge", "Vivaldi", "Firefox", "Waterfox", "Chromium", "Safari", "Stdout", "FirefoxStdout", "Firefox Developer Edition", "Firefox Nightly", "Arc", "Custom"},
Options: []string{"Chrome", "Brave", "Edge", "Vivaldi", "Firefox", "Waterfox", "Chromium", "Safari", "Stdout", "FirefoxStdout", "Firefox Developer Edition", "Firefox Nightly", "Arc", "Zen", "Custom"},
}
var selection string
clio.NewLine()
Expand Down Expand Up @@ -139,6 +139,9 @@ func GetBrowserKey(b string) string {
if strings.Contains(strings.ToLower(b), "arc") {
return ArcKey
}
if strings.Contains(strings.ToLower(b), "zen") {
return ZenKey
}
if strings.Contains(strings.ToLower(b), "custom") {
return CustomKey
}
Expand Down Expand Up @@ -169,6 +172,8 @@ func DetectInstallation(browserKey string) (string, bool) {
bPath, _ = SafariPathDefaults()
case ArcKey:
bPath, _ = ArcPathDefaults()
case ZenKey:
bPath, _ = ZenPathDefaults()
case FirefoxDevEditionKey:
bPath, _ = FirefoxDevPathDefaults()
case FirefoxNightlyKey:
Expand Down Expand Up @@ -261,7 +266,7 @@ func ConfigureBrowserSelection(browserName string, path string) error {
browserPath = customBrowserPath
}

if browserKey == FirefoxKey || browserKey == WaterfoxKey || browserKey == FirefoxDevEditionKey || browserKey == FirefoxNightlyKey {
if browserKey == FirefoxKey || browserKey == WaterfoxKey || browserKey == FirefoxDevEditionKey || browserKey == FirefoxNightlyKey || browserKey == ZenKey {
err := RunFirefoxExtensionPrompts(browserPath, browserName)
if err != nil {
return err
Expand Down
6 changes: 5 additions & 1 deletion pkg/granted/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var ConsoleCommand = cli.Command{
if err != nil {
return err
}
if c.Bool("firefox") || cfg.DefaultBrowser == browser.FirefoxKey || cfg.DefaultBrowser == browser.FirefoxStdoutKey {
if c.Bool("firefox") || cfg.DefaultBrowser == browser.FirefoxKey || cfg.DefaultBrowser == browser.FirefoxStdoutKey || cfg.DefaultBrowser == browser.ZenKey {
// transform the URL into the Firefox Tab Container format.
consoleURL = fmt.Sprintf("ext+granted-containers:name=%s&url=%s&color=%s&icon=%s", c.String("container-name"), url.QueryEscape(consoleURL), c.String("color"), c.String("icon"))
}
Expand Down Expand Up @@ -97,6 +97,10 @@ var ConsoleCommand = cli.Command{
l = launcher.Firefox{
ExecutablePath: cfg.CustomBrowserPath,
}
case browser.ZenKey:
l = launcher.Zen{
ExecutablePath: cfg.CustomBrowserPath,
}
case browser.SafariKey:
l = launcher.Safari{}
case browser.CustomKey:
Expand Down
15 changes: 15 additions & 0 deletions pkg/launcher/zen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package launcher

type Zen struct {
ExecutablePath string
}

func (l Zen) LaunchCommand(url string, profile string) ([]string, error) {
return []string{
l.ExecutablePath,
"--new-tab",
url,
}, nil
}

func (l Zen) UseForkProcess() bool { return true }
Loading