diff --git a/control/main.go b/control/main.go index 10fe214..e22c47d 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) + err = shared.OpenBrowserWindow("http://localhost:"+port, false, "control") 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 d0fb61a..ba4ab5c 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) + err = shared.OpenBrowserWindow("http://localhost:"+port, true, "display") if err != nil { slog.Error("Failed to open browser window", "error", err) os.Exit(1) diff --git a/shared/open_browser.go b/shared/open_browser.go index 5307b0c..9ec5337 100644 --- a/shared/open_browser.go +++ b/shared/open_browser.go @@ -8,14 +8,14 @@ import ( "path/filepath" ) -func OpenBrowserWindow(url string, fullscreen bool) error { +func OpenBrowserWindow(url string, fullscreen bool, profile string) error { bins := []string{"chromium", "chromium-browser"} home, err := os.UserHomeDir() if err != nil { return fmt.Errorf("unable to determine user home directory: %w", err) } - browserProfileDirPath := filepath.Join(home, ".local", "share", "plg-mudics", "browser") + browserProfileDirPath := filepath.Join(home, ".local", "share", "plg-mudics", fmt.Sprintf("browser-%s", profile)) if err := os.MkdirAll(browserProfileDirPath, os.ModePerm); err != nil { return fmt.Errorf("failed to create local config directory: %w", err) }