Skip to content

Commit

Permalink
feat: Support lauching embedded Chromium instance from within Flatpak…
Browse files Browse the repository at this point in the history
… on Wayland

Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
  • Loading branch information
pojntfx committed Oct 23, 2024
1 parent 97414e4 commit da8af40
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions hydrapp/pkg/ui/browser_launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,26 @@ func LaunchBrowser(
}
userDataDir := filepath.Join(userConfigDir, appID)

execArgs := []string{
"--name=" + appName,
"--class=" + appName,
"--user-data-dir=" + userDataDir,
"--no-first-run",
"--no-default-browser-check",
"--app=" + url,
}

// If we are on Linux, in a Flatpak sandbox, are running a browser that itself is in the sandbox and
// are on Wayland, enable the Ozone platform abstraction layer for Chromium to support launching Chromium in Wayland
if runtime.GOOS == "linux" && runningInFlatpak && browserIsInSandbox && os.Getenv("XDG_SESSION_TYPE") == "wayland" {
execArgs = append(execArgs, "--ozone-platform-hint=auto")
}

// Create the browser instance
execLine := append(
browserBinary,
append(
[]string{
"--name=" + appName,
"--class=" + appName,
"--user-data-dir=" + userDataDir,
"--no-first-run",
"--no-default-browser-check",
"--app=" + url,
},
execArgs,
os.Args[1:]...,
)...,
)
Expand Down

0 comments on commit da8af40

Please sign in to comment.