Skip to repository content61 lines · 1.6 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T03:29:07.993Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
linux.rs
1mod dispatcher;
2mod headless;
3mod keyboard;
4mod platform;
5mod system_notifications;
6#[cfg(any(feature = "wayland", feature = "x11"))]
7mod text_system;
8#[cfg(feature = "wayland")]
9mod wayland;
10#[cfg(feature = "x11")]
11mod x11;
12
13#[cfg(any(feature = "wayland", feature = "x11"))]
14mod xdg_desktop_portal;
15
16pub use dispatcher::*;
17pub(crate) use headless::*;
18pub(crate) use keyboard::*;
19pub(crate) use platform::*;
20#[cfg(any(feature = "wayland", feature = "x11"))]
21pub(crate) use text_system::*;
22#[cfg(feature = "wayland")]
23pub(crate) use wayland::*;
24#[cfg(feature = "x11")]
25pub(crate) use x11::*;
26
27use std::rc::Rc;
28
29/// Returns the default platform implementation for the current OS.
30pub fn current_platform(headless: bool) -> Rc<dyn gpui::Platform> {
31 #[cfg(feature = "x11")]
32 use anyhow::Context as _;
33
34 if headless {
35 return Rc::new(LinuxPlatform {
36 inner: HeadlessClient::new(),
37 });
38 }
39
40 match gpui::guess_compositor() {
41 #[cfg(feature = "wayland")]
42 "Wayland" => Rc::new(LinuxPlatform {
43 inner: WaylandClient::new(),
44 }),
45
46 #[cfg(feature = "x11")]
47 "X11" => Rc::new(LinuxPlatform {
48 inner: X11Client::new()
49 .context("Failed to initialize X11 client.")
50 .unwrap(),
51 }),
52
53 "Headless" => Rc::new(LinuxPlatform {
54 inner: HeadlessClient::new(),
55 }),
56 _ => unreachable!(
57 r#"At least one of the "wayland" or "x11" features must be enabled on gpui_linux or gpui_platform."#
58 ),
59 }
60}
61