1mod dispatcher;
3mod display_connection;
4mod headless;
5mod keyboard;
6mod platform;
7mod system_notifications;
8#[cfg(any(feature = "wayland", feature = "x11"))]
9mod text_system;
10#[cfg(feature = "wayland")]
11pub(crate) mod wayland;
12#[cfg(feature = "x11")]
13mod x11;
14
15#[cfg(any(feature = "wayland", feature = "x11"))]
16mod xdg_desktop_portal;
17
18pub use dispatcher::*;
19pub(crate) use display_connection::{Backend, DisplayConnection, select_backend};
20pub(crate) use headless::*;
21pub(crate) use keyboard::*;
22pub(crate) use platform::*;
23#[cfg(any(feature = "wayland", feature = "x11"))]
24pub(crate) use text_system::*;
25#[cfg(feature = "wayland")]
26pub(crate) use wayland::*;
27#[cfg(feature = "x11")]
28pub(crate) use x11::*;
29
30use std::rc::Rc;
31
32use gpui::WindowingModes;
33
34pub fn current_platform(headless: bool) -> Rc<dyn gpui::Platform> {
40 if headless || std::env::var_os("ZED_HEADLESS").is_some() {
41 linux_platform(WindowingModes::HEADLESS)
42 } else {
43 linux_platform(WindowingModes::all())
44 }
45}
46
47pub fn linux_platform(allowed_modes: WindowingModes) -> Rc<dyn gpui::Platform> {
52 Rc::new(LinuxPlatform::new(allowed_modes))
53}