fix(control): sometimes could not start browser

This commit is contained in:
2026-01-15 15:16:02 +01:00
parent 662bcb3b8d
commit e2a9558d3f
5 changed files with 9 additions and 12 deletions
+6 -10
View File
@@ -7,21 +7,17 @@ import (
"os/exec"
)
func OpenBrowserWindow(url string, fullscreen bool, temp bool) error {
func OpenBrowserWindow(url string, fullscreen bool) error {
bins := []string{"chromium", "chromium-browser"}
args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required"}
tempDirPath, err := os.MkdirTemp("", "plg-mudics-browser-")
if err != nil {
return err
}
args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required", fmt.Sprintf("--user-data-dir=%s", tempDirPath)}
if fullscreen {
args = append(args, "--start-fullscreen")
}
if temp {
tempDirPath, err := os.MkdirTemp("", "plg-mudics-browser-")
if err != nil {
return err
}
arg := fmt.Sprintf("--user-data-dir=%s", tempDirPath)
args = append(args, arg)
}
errs := []string{}
for _, bin := range bins {