diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index 573e4addf7..5b11f93095 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -427,7 +427,15 @@ impl X11Client { let xcb_connection = Rc::new(xcb_connection); - let ximc = X11rbClient::init(Rc::clone(&xcb_connection), x_root_index, None).ok(); + // bug in ibus causes it to crash, which results in us not receiving xim callbacks, see #29083 + let ximc = if get_package_version("ibus") + .as_deref() + .map_or(false, |version| version.starts_with("1.5.32~rc2-1")) + { + None + } else { + X11rbClient::init(Rc::clone(&xcb_connection), x_root_index, None).ok() + }; let xim_handler = if ximc.is_some() { Some(XimHandler::new()) } else { @@ -2488,3 +2496,31 @@ fn get_dpi_factor((width_px, height_px): (u32, u32), (width_mm, height_mm): (u64 fn valid_scale_factor(scale_factor: f32) -> bool { scale_factor.is_sign_positive() && scale_factor.is_normal() } + +fn get_package_version(name: &str) -> Option { + use util::command::new_std_command; + + if let Ok(output) = new_std_command("dpkg-query") + .args(["-W", "-f=${Version}", &name]) + .output() + { + if output.status.success() { + if let Ok(version) = std::str::from_utf8(&output.stdout) { + return Some(version.trim().to_string()); + } + } + } + + if let Ok(output) = new_std_command("rpm") + .args(["-q", "--qf", "%{VERSION}-%{RELEASE}", &name]) + .output() + { + if output.status.success() { + if let Ok(version) = std::str::from_utf8(&output.stdout) { + return Some(version.trim().to_string()); + } + } + } + + None +}