fix(control): doesn't remember added displays

This commit is contained in:
2026-01-17 12:50:12 +01:00
parent fc59b576b5
commit 4ab8f43295
+9 -3
View File
@@ -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")
}