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