Skip to repository content48 lines · 1.4 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T04:35:09.843Z 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
active_state_bug.rs
1/// Click the button — the `.active()` background gets stuck on every other click.
2use gpui::*;
3use gpui_platform::application;
4
5struct Example;
6
7impl Render for Example {
8 fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
9 // Colors from Zed's default dark theme
10 let bg = hsla(215. / 360., 0.12, 0.15, 1.);
11 let text = hsla(221. / 360., 0.11, 0.86, 1.);
12 let hover = hsla(225. / 360., 0.118, 0.267, 1.);
13 let active = hsla(220. / 360., 0.118, 0.20, 1.);
14
15 div().bg(bg).size_full().p_1().child(
16 div()
17 .id("button")
18 .px_2()
19 .py_0p5()
20 .rounded_md()
21 .text_sm()
22 .text_color(text)
23 .hover(|s| s.bg(hover))
24 .active(|s| s.bg(active))
25 .on_click(|_, _, _| {})
26 .child("Click me"),
27 )
28 }
29}
30
31fn main() {
32 application().run(|cx: &mut App| {
33 cx.open_window(
34 WindowOptions {
35 window_bounds: Some(WindowBounds::Windowed(Bounds::centered(
36 None,
37 size(px(200.), px(60.)),
38 cx,
39 ))),
40 ..Default::default()
41 },
42 |_, cx| cx.new(|_| Example),
43 )
44 .unwrap();
45 cx.activate(true);
46 });
47}
48