diff --git a/LinuxGUI/Ventoy2Disk/ventoy_gui.c b/LinuxGUI/Ventoy2Disk/ventoy_gui.c index a0512187..7c1bad8c 100644 --- a/LinuxGUI/Ventoy2Disk/ventoy_gui.c +++ b/LinuxGUI/Ventoy2Disk/ventoy_gui.c @@ -1221,6 +1221,7 @@ int real_main(int argc, char **argv) int ret; int euid; char *exe = NULL; + const char *env = NULL; char path[PATH_MAX]; char curpath[PATH_MAX]; @@ -1270,6 +1271,18 @@ int real_main(int argc, char **argv) return 1; } + if (strstr(path, "gtk")) + { + env = getenv("XDG_SESSION_TYPE"); + vlog("=== XDG_SESSION_TYPE is <%s> ===\n", env ? env : "NULL"); + + if (env && strncasecmp(env, "wayland", 7) == 0) + { + vlog("Force GDK_BACKEND from %s to x11 for better compatibility\n", env); + setenv("GDK_BACKEND", "x11", 1); + } + } + if (euid == 0) { vlog("We have root privileges, just exec %s\n", path);