forge
Explore
Log in

Don't you dare go Hollow

Don't clear DISPLAY/WAYLAND_DISPLAY/WAYLAND_SOCKET on WSL with --session (#2354)

Browse files at this commit

bdee1a657699a77bc4cdb050f7355f37f64c45a6Unverifiedilyx and Ivan MolodetskikhParent: 22f629c
* use winit backend on WSL

* Update src/main.rs

---------
src/main.rsmodified+17 -14
@@ -70,20 +70,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
70 let cli = Cli::parse();70 let cli = Cli::parse();
71 71
72 if cli.session {72 if cli.session {
73- // If we're starting as a session, assume that the intention is to start on a TTY. Remove73+ // If we're starting as a session, assume that the intention is to start on a TTY unless
74- // DISPLAY, WAYLAND_DISPLAY or WAYLAND_SOCKET from our environment if they are set, since74+ // this is a WSL environment. Remove DISPLAY, WAYLAND_DISPLAY or WAYLAND_SOCKET from our
75- // they will cause the winit backend to be selected instead.75+ // environment if they are set, since they will cause the winit backend to be selected
76- if env::var_os("DISPLAY").is_some() {76+ // instead.
77- warn!("running as a session but DISPLAY is set, removing it");77+ if env::var_os("WSL_DISTRO_NAME").is_none() {
78- env::remove_var("DISPLAY");78+ if env::var_os("DISPLAY").is_some() {
79- }79+ warn!("running as a session but DISPLAY is set, removing it");
80- if env::var_os("WAYLAND_DISPLAY").is_some() {80+ env::remove_var("DISPLAY");
81- warn!("running as a session but WAYLAND_DISPLAY is set, removing it");81+ }
82- env::remove_var("WAYLAND_DISPLAY");82+ if env::var_os("WAYLAND_DISPLAY").is_some() {
83- }83+ warn!("running as a session but WAYLAND_DISPLAY is set, removing it");
84- if env::var_os("WAYLAND_SOCKET").is_some() {84+ env::remove_var("WAYLAND_DISPLAY");
85- warn!("running as a session but WAYLAND_SOCKET is set, removing it");85+ }
86- env::remove_var("WAYLAND_SOCKET");86+ if env::var_os("WAYLAND_SOCKET").is_some() {
87+ warn!("running as a session but WAYLAND_SOCKET is set, removing it");
88+ env::remove_var("WAYLAND_SOCKET");
89+ }
87 }90 }
88 91
89 // Set the current desktop for xdg-desktop-portal.92 // Set the current desktop for xdg-desktop-portal.