Support WAYLAND_SOCKET in winit backend

I know of a single compositor that supports `WAYLAND_SOCKET` but not
`WAYLAND_DISPLAY`: https://gitlab.freedesktop.org/mstoeckl/windowtolayer

This should also make niri more robust against accidentally setting
`WAYLAND_SOCKET` when starting as a session, before programs could fail
if they preffered `WAYLAND_SOCKET` over `WAYLAND_DISPLAY`
This commit is contained in:
bbb651
2025-01-12 22:33:20 +02:00
committed by Ivan Molodetskikh
parent 0bd6df507b
commit c523c80598
2 changed files with 9 additions and 4 deletions
+3 -2
View File
@@ -547,8 +547,9 @@ impl State {
let config = Rc::new(RefCell::new(config));
let has_display =
env::var_os("WAYLAND_DISPLAY").is_some() || env::var_os("DISPLAY").is_some();
let has_display = env::var_os("WAYLAND_DISPLAY").is_some()
|| env::var_os("WAYLAND_SOCKET").is_some()
|| env::var_os("DISPLAY").is_some();
let mut backend = if headless {
let headless = Headless::new();