From 4ab8f4329515d1c1cfda258011f38d92ee4b0ee8 Mon Sep 17 00:00:00 2001 From: 2mal3 <56305732+2mal3@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:50:12 +0100 Subject: [PATCH] fix(control): doesn't remember added displays --- shared/open_browser.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shared/open_browser.go b/shared/open_browser.go index 59b2c36..5307b0c 100644 --- a/shared/open_browser.go +++ b/shared/open_browser.go @@ -5,16 +5,22 @@ import ( "fmt" "os" "os/exec" + "path/filepath" ) func OpenBrowserWindow(url string, fullscreen bool) error { bins := []string{"chromium", "chromium-browser"} - tempDirPath, err := os.MkdirTemp("", "plg-mudics-browser-") + home, err := os.UserHomeDir() if err != nil { - return err + return fmt.Errorf("unable to determine user home directory: %w", err) } - args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required", fmt.Sprintf("--user-data-dir=%s", tempDirPath)} + browserProfileDirPath := filepath.Join(home, ".local", "share", "plg-mudics", "browser") + if err := os.MkdirAll(browserProfileDirPath, os.ModePerm); err != nil { + return fmt.Errorf("failed to create local config directory: %w", err) + } + + args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required", fmt.Sprintf("--user-data-dir=%s", browserProfileDirPath)} if fullscreen { args = append(args, "--start-fullscreen") }