Skip to content

Commit 27f36a8

Browse files
authored
Only set GDK_BACKEND to "x11" if GDK_BACKEND is unset and XDG_SESSION_TYPE is not "wayland" (#1811)
* Only set GDK_BACKEND to "x11" if GDK_BACKEND is unset and XDG_SESSION_TYPE is not "wayland" * GDK_BACKEND should only be set if XDG_SESSION_TYPE is unset, "unspecified" or "x11"
1 parent ffb4a13 commit 27f36a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

v2/internal/frontend/desktop/linux/frontend.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ func init() {
5858

5959
func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend {
6060

61-
// Set GDK_BACKEND=x11 to prevent warnings
62-
_ = os.Setenv("GDK_BACKEND", "x11")
61+
// Set GDK_BACKEND=x11 if currently unset and XDG_SESSION_TYPE is unset, unspecified or x11 to prevent warnings
62+
if os.Getenv("GDK_BACKEND") == "" && (os.Getenv("XDG_SESSION_TYPE") == "" || os.Getenv("XDG_SESSION_TYPE") == "unspecified" || os.Getenv("XDG_SESSION_TYPE") == "x11") {
63+
_ = os.Setenv("GDK_BACKEND", "x11")
64+
}
6365

6466
result := &Frontend{
6567
frontendOptions: appoptions,

0 commit comments

Comments
 (0)