diff options
| author | ilyx <87244515+ilyx-me@users.noreply.github.com> | 2025-09-08 12:13:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-08 19:13:04 +0000 |
| commit | bdee1a657699a77bc4cdb050f7355f37f64c45a6 (patch) | |
| tree | aa6c322b92fc2cd15dfd08bff36c39df554a0ae5 /src/main.rs | |
| parent | 22f629c24b9f81a2fcaaf3a79d75128484c6ed78 (diff) | |
| download | niri-bdee1a657699a77bc4cdb050f7355f37f64c45a6.tar.gz niri-bdee1a657699a77bc4cdb050f7355f37f64c45a6.tar.bz2 niri-bdee1a657699a77bc4cdb050f7355f37f64c45a6.zip | |
Don't clear DISPLAY/WAYLAND_DISPLAY/WAYLAND_SOCKET on WSL with --session (#2354)
* use winit backend on WSL
* Update src/main.rs
---------
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/main.rs b/src/main.rs index caceebfc..118fe27a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -70,20 +70,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { let cli = Cli::parse(); if cli.session { - // If we're starting as a session, assume that the intention is to start on a TTY. Remove - // DISPLAY, WAYLAND_DISPLAY or WAYLAND_SOCKET from our environment if they are set, since - // they will cause the winit backend to be selected instead. - if env::var_os("DISPLAY").is_some() { - warn!("running as a session but DISPLAY is set, removing it"); - env::remove_var("DISPLAY"); - } - if env::var_os("WAYLAND_DISPLAY").is_some() { - warn!("running as a session but WAYLAND_DISPLAY is set, removing it"); - env::remove_var("WAYLAND_DISPLAY"); - } - if env::var_os("WAYLAND_SOCKET").is_some() { - warn!("running as a session but WAYLAND_SOCKET is set, removing it"); - env::remove_var("WAYLAND_SOCKET"); + // If we're starting as a session, assume that the intention is to start on a TTY unless + // this is a WSL environment. Remove DISPLAY, WAYLAND_DISPLAY or WAYLAND_SOCKET from our + // environment if they are set, since they will cause the winit backend to be selected + // instead. + if env::var_os("WSL_DISTRO_NAME").is_none() { + if env::var_os("DISPLAY").is_some() { + warn!("running as a session but DISPLAY is set, removing it"); + env::remove_var("DISPLAY"); + } + if env::var_os("WAYLAND_DISPLAY").is_some() { + warn!("running as a session but WAYLAND_DISPLAY is set, removing it"); + env::remove_var("WAYLAND_DISPLAY"); + } + if env::var_os("WAYLAND_SOCKET").is_some() { + warn!("running as a session but WAYLAND_SOCKET is set, removing it"); + env::remove_var("WAYLAND_SOCKET"); + } } // Set the current desktop for xdg-desktop-portal. |
