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