xwayland: Expose DISPLAY variable to clients

This commit is contained in:
Victoria Brekenfeld 2023-01-24 18:08:52 +01:00
parent 51f53aa899
commit e5f4911bb6
3 changed files with 23 additions and 2 deletions

View file

@ -77,6 +77,9 @@ pub fn setup_socket(handle: LoopHandle<Data>, 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) {
env.insert(String::from("DISPLAY"), format!(":{}", display));
}
let message = serde_json::to_string(&Message::SetEnv { variables: env })
.with_context(|| "Failed to encode environment variables into json")?;
let bytes = message.into_bytes();