Skip to repository content36 lines · 1.1 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T02:36:42.238Z 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
window_appearance.rs
1use cocoa::{
2 appkit::{NSAppearanceNameVibrantDark, NSAppearanceNameVibrantLight},
3 base::id,
4 foundation::NSString,
5};
6use gpui::WindowAppearance;
7use objc::{msg_send, sel, sel_impl};
8use std::ffi::CStr;
9
10pub(crate) unsafe fn window_appearance_from_native(appearance: id) -> WindowAppearance {
11 let name: id = msg_send![appearance, name];
12 unsafe {
13 if name == NSAppearanceNameVibrantLight {
14 WindowAppearance::VibrantLight
15 } else if name == NSAppearanceNameVibrantDark {
16 WindowAppearance::VibrantDark
17 } else if name == NSAppearanceNameAqua {
18 WindowAppearance::Light
19 } else if name == NSAppearanceNameDarkAqua {
20 WindowAppearance::Dark
21 } else {
22 println!(
23 "unknown appearance: {:?}",
24 CStr::from_ptr(name.UTF8String())
25 );
26 WindowAppearance::Light
27 }
28 }
29}
30
31#[link(name = "AppKit", kind = "framework")]
32unsafe extern "C" {
33 pub static NSAppearanceNameAqua: id;
34 pub static NSAppearanceNameDarkAqua: id;
35}
36