diff --git a/Cargo.lock b/Cargo.lock index 8b166cc0..2d01f0c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3274,7 +3274,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/pop-os/smithay?rev=05f5db5beb#05f5db5beb4932ff48692c9ec4f466363e19e957" +source = "git+https://github.com/pop-os/smithay?rev=b231c3dd2a#b231c3dd2a2602539e8042e5f8db212a0adcee24" dependencies = [ "appendlist", "bitflags", diff --git a/Cargo.toml b/Cargo.toml index b39cd476..b993ea65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,4 +70,4 @@ debug = true lto = "fat" [patch."https://github.com/Smithay/smithay.git"] -smithay = { git = "https://github.com/pop-os/smithay", rev = "05f5db5beb" } +smithay = { git = "https://github.com/pop-os/smithay", rev = "b231c3dd2a" } diff --git a/src/input/mod.rs b/src/input/mod.rs index 4a246d95..a16321c9 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -914,7 +914,8 @@ impl State { .common .xwayland_state .values() - .find_map(|s| s.display.map(|v| format!(":{}", v))) + .next() + .map(|s| format!(":{}", s.display)) .unwrap_or(String::new()), ) .env_remove("COSMIC_SESSION_SOCK") diff --git a/src/session.rs b/src/session.rs index 91a32a44..af38a687 100644 --- a/src/session.rs +++ b/src/session.rs @@ -77,7 +77,13 @@ pub fn setup_socket(handle: LoopHandle, state: &State) -> Result<()> { .into_string() .map_err(|_| anyhow!("wayland socket is no valid utf-8 string?"))?, ); - if let Some(display) = state.common.xwayland_state.values().find_map(|s| s.display) { + if let Some(display) = state + .common + .xwayland_state + .values() + .next() + .map(|s| s.display) + { env.insert(String::from("DISPLAY"), format!(":{}", display)); } let message = serde_json::to_string(&Message::SetEnv { variables: env }) diff --git a/src/systemd.rs b/src/systemd.rs index b304ab9c..74328630 100644 --- a/src/systemd.rs +++ b/src/systemd.rs @@ -15,7 +15,8 @@ pub fn ready(state: &State) { .common .xwayland_state .values() - .find_map(|s| s.display.map(|v| format!(":{}", v))) + .next() + .map(|s| format!(":{}", s.display)) .unwrap_or(String::new()), ) .status() diff --git a/src/xwayland.rs b/src/xwayland.rs index 247df1ad..bbef4059 100644 --- a/src/xwayland.rs +++ b/src/xwayland.rs @@ -20,7 +20,7 @@ use smithay::{ pub struct XWaylandState { pub xwm: Option, - pub display: Option, + pub display: u32, #[allow(unused)] xwayland: XWayland, } @@ -74,14 +74,12 @@ impl State { let mut xwayland_state = data.state.common.xwayland_state.get_mut(&drm_node).unwrap(); xwayland_state.xwm = Some(wm); - xwayland_state.display = Some(display); } XWaylandEvent::Exited => { if let Some(mut xwayland_state) = data.state.common.xwayland_state.remove(&drm_node) { xwayland_state.xwm = None; - xwayland_state.display = None; } } }) { @@ -102,13 +100,13 @@ impl State { } }, ) { - Ok(_) => { + Ok(display) => { self.common.xwayland_state.insert( drm_node, XWaylandState { xwayland, xwm: None, - display: None, + display, }, ); }