mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
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:
committed by
Ivan Molodetskikh
parent
0bd6df507b
commit
c523c80598
+6
-2
@@ -69,8 +69,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
if cli.session {
|
||||
// If we're starting as a session, assume that the intention is to start on a TTY. Remove
|
||||
// DISPLAY or WAYLAND_DISPLAY from our environment if they are set, since they will cause
|
||||
// the winit backend to be selected instead.
|
||||
// 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");
|
||||
@@ -79,6 +79,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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.
|
||||
env::set_var("XDG_CURRENT_DESKTOP", "niri");
|
||||
|
||||
+3
-2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user