diff --git a/control/control b/control/control new file mode 100755 index 0000000..b8b6ce1 Binary files /dev/null and b/control/control differ diff --git a/control/main.go b/control/main.go index 0475fa5..10fe214 100644 --- a/control/main.go +++ b/control/main.go @@ -64,7 +64,7 @@ func main() { os.Exit(1) } }() - err = shared.OpenBrowserWindow("http://localhost:"+port, false, false) + err = shared.OpenBrowserWindow("http://localhost:"+port, false) if err != nil { slog.Error("Failed to open browser window", "error", err) os.Exit(1) diff --git a/display/main.go b/display/main.go index 43013ef..d0fb61a 100644 --- a/display/main.go +++ b/display/main.go @@ -26,7 +26,7 @@ func main() { // the order is important, the open browser command exitsts as soon as the winodw is closed // and since its the last action in the main go func all other goroutines (e.g. the webserver) are killed go web.StartWebServer(shared.Version, port) - err = shared.OpenBrowserWindow("http://localhost:"+port, true, true) + err = shared.OpenBrowserWindow("http://localhost:"+port, true) if err != nil { slog.Error("Failed to open browser window", "error", err) os.Exit(1) diff --git a/go.work.sum b/go.work.sum index 281e54a..78b8cfb 100644 --- a/go.work.sum +++ b/go.work.sum @@ -7,6 +7,7 @@ golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b/go.mod h1:4ZwOYna0/zsOKwuR5X/m0QFOJpSZvAxFfkQT+Erd9D4= +golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54/go.mod h1:hKdjCMrbv9skySur+Nek8Hd0uJ0GuxJIoIX2payrIdQ= golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= diff --git a/shared/open_browser.go b/shared/open_browser.go index c9e6fc0..59b2c36 100644 --- a/shared/open_browser.go +++ b/shared/open_browser.go @@ -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 {