1mod dispatcher;
2mod display_connection;
3#[cfg_attr(not(any(feature = "wayland", feature = "x11")), allow(dead_code))]
5mod gpu_recovery;
6mod headless;
7mod keyboard;
8mod platform;
9#[cfg(any(feature = "wayland", feature = "x11"))]
10mod power;
11mod system_notifications;
12#[cfg(any(feature = "wayland", feature = "x11"))]
13mod text_system;
14#[cfg(feature = "wayland")]
15mod wayland;
16#[cfg(feature = "x11")]
17mod x11;
18
19#[cfg(any(feature = "wayland", feature = "x11"))]
20mod xdg_desktop_portal;
21
22pub use dispatcher::*;
23pub(crate) use display_connection::{Backend, DisplayConnection, select_backend};
24pub(crate) use gpu_recovery::*;
25pub(crate) use headless::*;
26pub(crate) use keyboard::*;
27pub(crate) use platform::*;
28#[cfg(any(feature = "wayland", feature = "x11"))]
29pub(crate) use text_system::*;
30#[cfg(feature = "wayland")]
31pub(crate) use wayland::*;
32#[cfg(feature = "x11")]
33pub(crate) use x11::*;
34
35use std::rc::Rc;
36
37use gpui::WindowingModes;
38
39pub fn current_platform(headless: bool) -> Rc<dyn gpui::Platform> {
45 if headless || std::env::var_os("ZED_HEADLESS").is_some() {
46 linux_platform(WindowingModes::HEADLESS)
47 } else {
48 linux_platform(WindowingModes::all())
49 }
50}
51
52pub fn linux_platform(allowed_modes: WindowingModes) -> Rc<dyn gpui::Platform> {
57 Rc::new(LinuxPlatform::new(allowed_modes))
58}