BlueGit

ict rusty-teams

feat(ui): layout guard against overlapping and clipped elements

- layout_guard test: tagged shell regions stay inside window and parent, siblings never intersect; 6 screens at 640x480 and 1920x1080, status menu included
- source scan: negative absolute offsets only via widgets::corner_badge, shrink-only allowlist
- presence dot, activity kind marker, call chat badge moved to corner_badge
- scripts/layout-sweep.sh: 8 screens at both sizes, desktop toasts kept outside the captured window
- headless-shot.sh: --window, --settle, reliable modifier keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-12 · 7 weeks ago

Hash
0958d7a20784f0198248221551220327147ca898
Parent
bd49c075
18 files changed +601 −49
README.md +2 −0
@@ -101,6 +101,8 @@ cargo run -p app -- --demo
101 101 | Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
102 102 | Tests | `cargo test` |
103 103 | Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
104 | Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
105 | Layout guard: no overlapping or clipped elements, no negative offsets outside `widgets::corner_badge` | `cargo test -p app layout_guard` |
104 106
105 107 ## How it works
106 108
@@ -101,6 +101,8 @@ cargo run -p app -- --demo
101| Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
101| Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
102| Tests | `cargo test` |
102| Tests | `cargo test` |
103| Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
103| Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
104| Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
105| Layout guard: no overlapping or clipped elements, no negative offsets outside `widgets::corner_badge` | `cargo test -p app layout_guard` |
104
106
105## How it works
107## How it works
106
108
crates/app/src/demo.rs +9 −1
@@ -4,7 +4,7 @@ use std::sync::{Arc, OnceLock};
4 4 use std::time::Instant;
5 5
6 6 use chrono::{DateTime, Duration, Local, TimeZone, Utc};
7 use gpui_kit::Image;
7 use gpui_kit::{App, Entity, Image};
8 8 use store::{
9 9 ChannelLayoutRecord, ChannelNotificationLevel, ChannelNotifications, ChannelRecord,
10 10 ChannelTabRecord, ChatRecord, MemberRecord, MessageRecord, Store, TeamLayoutRecord, TeamRecord,
@@ -635,6 +635,14 @@ pub fn read_message_ids(records: &[MessageRecord]) -> std::collections::HashSet<
635 635 .collect()
636 636 }
637 637
638 pub fn start_session(state: &Entity<AppState>, cx: &mut App) {
639 state.update(cx, |state, cx| {
640 seed_directory(state);
641 state.demo_live_meetings();
642 state.select(first_selection(), cx);
643 });
644 }
645
638 646 pub fn first_selection() -> Selection {
639 647 Selection::Chat(RELEASE_CHAT.to_owned())
640 648 }
@@ -4,7 +4,7 @@ use std::sync::{Arc, OnceLock};
4use std::time::Instant;
4use std::time::Instant;
5
5
6use chrono::{DateTime, Duration, Local, TimeZone, Utc};
6use chrono::{DateTime, Duration, Local, TimeZone, Utc};
7use gpui_kit::Image;
7use gpui_kit::{App, Entity, Image};
8use store::{
8use store::{
9 ChannelLayoutRecord, ChannelNotificationLevel, ChannelNotifications, ChannelRecord,
9 ChannelLayoutRecord, ChannelNotificationLevel, ChannelNotifications, ChannelRecord,
10 ChannelTabRecord, ChatRecord, MemberRecord, MessageRecord, Store, TeamLayoutRecord, TeamRecord,
10 ChannelTabRecord, ChatRecord, MemberRecord, MessageRecord, Store, TeamLayoutRecord, TeamRecord,
@@ -635,6 +635,14 @@ pub fn read_message_ids(records: &[MessageRecord]) -> std::collections::HashSet<
635 .collect()
635 .collect()
636}
636}
637
637
638pub fn start_session(state: &Entity<AppState>, cx: &mut App) {
639 state.update(cx, |state, cx| {
640 seed_directory(state);
641 state.demo_live_meetings();
642 state.select(first_selection(), cx);
643 });
644}
645
638pub fn first_selection() -> Selection {
646pub fn first_selection() -> Selection {
639 Selection::Chat(RELEASE_CHAT.to_owned())
647 Selection::Chat(RELEASE_CHAT.to_owned())
640}
648}
crates/app/src/layout_guard.rs added +430 −0
@@ -0,0 +1,430 @@
1 use std::collections::HashSet;
2 use std::fs;
3 use std::path::{Path, PathBuf};
4
5 use regex::Regex;
6
7 const WIDGETS_FILE: &str = "views/widgets.rs";
8 const SCAN_ALLOWLIST: &[(&str, &str)] = &[
9 ("views/toolbar_placement.rs", ".top(px(-SLOT_HEIGHT))"),
10 ("views/conversation.rs", ".bottom(px(-1.))"),
11 ];
12
13 fn source_files(directory: &Path, files: &mut Vec<PathBuf>) {
14 for entry in fs::read_dir(directory).expect("read source directory") {
15 let path = entry.expect("directory entry").path();
16 if path.is_dir() {
17 source_files(&path, files);
18 } else if path.extension().is_some_and(|extension| extension == "rs") {
19 files.push(path);
20 }
21 }
22 }
23
24 fn negative_offsets(
25 pattern: &Regex,
26 source: &str,
27 relative: &str,
28 ) -> Vec<(usize, Option<usize>, String)> {
29 pattern
30 .find_iter(source)
31 .map(|found| {
32 let line_number = source[..found.start()].matches('\n').count() + 1;
33 let from_match = &source[found.start()..];
34 let allowed = SCAN_ALLOWLIST.iter().position(|(allowed_file, snippet)| {
35 *allowed_file == relative && from_match.starts_with(snippet)
36 });
37 let line_end = from_match.find('\n').unwrap_or(from_match.len());
38 (
39 line_number,
40 allowed,
41 from_match[..line_end].trim().to_owned(),
42 )
43 })
44 .collect()
45 }
46
47 fn offset_pattern() -> Regex {
48 Regex::new(r"\.(top|right|bottom|left|inset)\(\s*(px\(\s*)?-").expect("pattern")
49 }
50
51 #[test]
52 fn matcher_catches_wrapped_offsets() {
53 let source = "let a = 1;\nlet b = div()\n .top(\n px(-4.))\n .left(px(2.));\n";
54 let found = negative_offsets(&offset_pattern(), source, "views/other.rs");
55 assert_eq!(found, [(3, None, ".top(".to_owned())]);
56 }
57
58 #[test]
59 fn matcher_matches_allowlist_from_match_start() {
60 let source = "x\n .bottom(px(-1.))\n";
61 let found = negative_offsets(&offset_pattern(), source, "views/conversation.rs");
62 assert_eq!(found, [(2, Some(1), ".bottom(px(-1.))".to_owned())]);
63 }
64
65 #[test]
66 fn negative_offsets_go_through_corner_badge() {
67 let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
68 let pattern = offset_pattern();
69 let mut files = Vec::new();
70 source_files(&root, &mut files);
71 let mut matched_allowlist = HashSet::new();
72 let mut violations = Vec::new();
73 for file in files {
74 let relative = file
75 .strip_prefix(&root)
76 .expect("inside src")
77 .to_string_lossy()
78 .replace('\\', "/");
79 if relative == WIDGETS_FILE || relative == "layout_guard.rs" {
80 continue;
81 }
82 let source = fs::read_to_string(&file).expect("read source file");
83 for (line_number, position, text) in negative_offsets(&pattern, &source, &relative) {
84 match position {
85 Some(position) => {
86 matched_allowlist.insert(position);
87 }
88 None => violations.push(format!(
89 "{relative}:{line_number}: negative absolute offset, use widgets::corner_badge: {text}"
90 )),
91 }
92 }
93 }
94 let stale: Vec<String> = SCAN_ALLOWLIST
95 .iter()
96 .enumerate()
97 .filter(|(position, _)| !matched_allowlist.contains(position))
98 .map(|(_, (file, snippet))| format!("stale allowlist entry, remove it: {file} {snippet}"))
99 .collect();
100 assert!(
101 violations.is_empty() && stale.is_empty(),
102 "{}",
103 violations
104 .into_iter()
105 .chain(stale)
106 .collect::<Vec<_>>()
107 .join("\n")
108 );
109 }
110
111 mod frames {
112 use std::collections::HashSet;
113 use std::sync::Arc;
114 use std::time::Duration;
115
116 use gpui_kit::test::TestWindowExt as _;
117 use gpui_kit::{
118 AppContext as _, Bounds, Pixels, TestAppContext, VisualTestContext, WindowOptions, point,
119 px, size,
120 };
121 use store::Store;
122
123 use crate::app_state::{AppState, Mode};
124 use crate::demo;
125 use crate::user_activity::UserInput;
126 use crate::views::shell::{AppShell, Startup, bind_keys, install_globals};
127 use crate::views::shortcuts::{OpenActivity, OpenCallsTab, OpenChannelsTab, OpenSaved};
128
129 const GUARDED: &[&str] = &[
130 "shell",
131 "shell/title-bar",
132 "shell/title-bar/search",
133 "shell/title-bar/own-status",
134 "shell/title-bar/own-status/avatar",
135 "shell/islands",
136 "shell/islands/rail",
137 "shell/islands/sidebar",
138 "shell/islands/main",
139 "shell/status-bar",
140 ];
141 const MENU: &str = "popup-menu";
142 const OWN_STATUS: &str = "shell/title-bar/own-status";
143 const SIZES: [(f32, f32); 2] = [(640., 480.), (1920., 1080.)];
144 const TOLERANCE: f32 = 0.5;
145 const KNOWN_VIOLATIONS: &[&str] = &[];
146
147 type Tag = (&'static str, Bounds<Pixels>);
148
149 enum Screen {
150 Tab(&'static str, Option<fn(&mut VisualTestContext)>),
151 StatusMenu,
152 }
153
154 fn parent_of(path: &str) -> Option<&str> {
155 path.rsplit_once('/').map(|(parent, _)| parent)
156 }
157
158 fn contains(outer: Bounds<Pixels>, inner: Bounds<Pixels>) -> bool {
159 let tolerance = px(TOLERANCE);
160 inner.left() >= outer.left() - tolerance
161 && inner.top() >= outer.top() - tolerance
162 && inner.right() <= outer.right() + tolerance
163 && inner.bottom() <= outer.bottom() + tolerance
164 }
165
166 fn overlaps(first: Bounds<Pixels>, second: Bounds<Pixels>) -> bool {
167 let tolerance = px(TOLERANCE);
168 first.left() < second.right() - tolerance
169 && second.left() < first.right() - tolerance
170 && first.top() < second.bottom() - tolerance
171 && second.top() < first.bottom() - tolerance
172 }
173
174 fn describe(bounds: Bounds<Pixels>) -> String {
175 format!(
176 "[{:.1},{:.1} {:.1}x{:.1}]",
177 f32::from(bounds.origin.x),
178 f32::from(bounds.origin.y),
179 f32::from(bounds.size.width),
180 f32::from(bounds.size.height)
181 )
182 }
183
184 fn violations(
185 tags: &[Tag],
186 window: Bounds<Pixels>,
187 expected: &[&str],
188 ) -> Vec<(String, String)> {
189 let mut found = Vec::new();
190 let bounds_of = |path: &str| {
191 tags.iter()
192 .find(|(tag, _)| *tag == path)
193 .map(|(_, bounds)| *bounds)
194 };
195 for path in expected {
196 if bounds_of(path).is_none() {
197 found.push((
198 format!("{path}:missing"),
199 format!("{path} was not rendered"),
200 ));
201 }
202 }
203 for (path, bounds) in tags {
204 if !contains(window, *bounds) {
205 found.push((
206 format!("{path}:outside-window"),
207 format!(
208 "{path} {} leaves the window {}",
209 describe(*bounds),
210 describe(window)
211 ),
212 ));
213 }
214 if let Some(parent) =
215 parent_of(path).and_then(|parent| bounds_of(parent).map(|bounds| (parent, bounds)))
216 {
217 if !contains(parent.1, *bounds) {
218 found.push((
219 format!("{path}:outside-parent"),
220 format!(
221 "{path} {} leaves {} {}",
222 describe(*bounds),
223 parent.0,
224 describe(parent.1)
225 ),
226 ));
227 }
228 }
229 for (other, other_bounds) in tags {
230 let siblings = path < other
231 && parent_of(path).is_some()
232 && parent_of(path) == parent_of(other);
233 if siblings && overlaps(*bounds, *other_bounds) {
234 found.push((
235 format!("{path}:overlaps:{other}"),
236 format!(
237 "{path} {} overlaps {other} {}",
238 describe(*bounds),
239 describe(*other_bounds)
240 ),
241 ));
242 }
243 }
244 }
245 found
246 }
247
248 const SETTLE_FRAMES: usize = 2;
249 const SETTLE_LIMIT: usize = 60;
250 const SETTLE_STEP: Duration = Duration::from_millis(50);
251
252 fn collect(visual: &mut VisualTestContext, awaited: Option<&'static str>) -> Vec<Tag> {
253 let mut frames = 0;
254 while frames < SETTLE_FRAMES
255 || awaited.is_some_and(|path| visual.debug_bounds(path).is_none())
256 {
257 assert!(frames < SETTLE_LIMIT, "{awaited:?} never rendered");
258 visual.executor().advance_clock(SETTLE_STEP);
259 std::thread::sleep(SETTLE_STEP);
260 visual.run_until_parked();
261 visual.update(|window, cx| window.render_frame(cx));
262 frames += 1;
263 }
264 GUARDED
265 .iter()
266 .chain([&MENU])
267 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
268 .collect()
269 }
270
271 fn mount(cx: &mut TestAppContext) -> gpui_kit::AnyWindowHandle {
272 cx.update(gpui_kit::init);
273 cx.update(|cx| {
274 crate::theme::apply(cx);
275 bind_keys(cx);
276 let store = Store::open_in_memory().expect("in-memory store");
277 demo::seed(&store);
278 let mode = Mode {
279 demo: true,
280 read_only: false,
281 demo_sync: None,
282 };
283 let state = cx.new(|_| AppState::new(Arc::new(store), mode));
284 install_globals(&state, UserInput::new(), cx);
285 demo::start_session(&state, cx);
286 let startup = Startup {
287 switcher_query: None,
288 composer_text: None,
289 reply_to_last: false,
290 };
291 gpui_kit::open_window(WindowOptions::default(), cx, move |window, cx| {
292 cx.new(|cx| AppShell::new(state, None, startup, window, cx))
293 })
294 .expect("open test window")
295 .0
296 })
297 }
298
299 fn rectangle(left: f32, top: f32, width: f32, height: f32) -> Bounds<Pixels> {
300 Bounds {
301 origin: point(px(left), px(top)),
302 size: size(px(width), px(height)),
303 }
304 }
305
306 #[test]
307 fn rules_flag_overlap_and_overflow() {
308 let window = rectangle(0., 0., 100., 100.);
309 let tags: Vec<Tag> = vec![
310 ("shell", rectangle(0., 0., 100., 100.)),
311 ("shell/islands", rectangle(0., 0., 100., 50.)),
312 ("shell/islands/rail", rectangle(0., 0., 60., 50.)),
313 ("shell/islands/sidebar", rectangle(50., 0., 60., 50.)),
314 ];
315 let keys: Vec<String> = violations(&tags, window, &["shell/status-bar"])
316 .into_iter()
317 .map(|(key, _)| key)
318 .collect();
319 assert_eq!(
320 keys,
321 [
322 "shell/status-bar:missing",
323 "shell/islands/rail:overlaps:shell/islands/sidebar",
324 "shell/islands/sidebar:outside-window",
325 "shell/islands/sidebar:outside-parent",
326 ]
327 );
328 }
329
330 #[gpui_kit::test]
331 fn no_element_overlaps_or_leaves_its_container(cx: &mut TestAppContext) {
332 let handle = mount(cx);
333 let mut visual = VisualTestContext::from_window(handle, cx);
334 let mut seen_known = HashSet::new();
335 let mut unexpected = Vec::new();
336 for (width, height) in SIZES {
337 visual.simulate_resize(size(px(width), px(height)));
338 let window = Bounds {
339 origin: point(px(0.), px(0.)),
340 size: size(px(width), px(height)),
341 };
342 let screens = [
343 Screen::Tab("chats", None),
344 Screen::Tab(
345 "activity",
346 Some(|visual| visual.dispatch_action(OpenActivity)),
347 ),
348 Screen::Tab(
349 "channels",
350 Some(|visual| visual.dispatch_action(OpenChannelsTab)),
351 ),
352 Screen::Tab("saved", Some(|visual| visual.dispatch_action(OpenSaved))),
353 Screen::Tab("calls", Some(|visual| visual.dispatch_action(OpenCallsTab))),
354 Screen::StatusMenu,
355 ];
356 for screen in screens {
357 let (screen_name, status_menu) = match screen {
358 Screen::Tab(name, open) => {
359 if let Some(open) = open {
360 open(&mut visual);
361 }
362 (name, false)
363 }
364 Screen::StatusMenu => {
365 let tags = collect(&mut visual, None);
366 let button = tags
367 .iter()
368 .find(|(path, _)| *path == OWN_STATUS)
369 .map(|(_, bounds)| *bounds)
370 .expect("own status button rendered");
371 visual.simulate_click(button.center(), Default::default());
372 ("status-menu", true)
373 }
374 };
375 let tags = collect(&mut visual, status_menu.then_some(MENU));
376 let mut expected = GUARDED.to_vec();
377 if status_menu {
378 expected.push(MENU);
379 }
380 let mut found = violations(&tags, window, &expected);
381 if status_menu {
382 let menu = tags
383 .iter()
384 .find(|(path, _)| *path == MENU)
385 .map(|(_, bounds)| *bounds);
386 let button = tags
387 .iter()
388 .find(|(path, _)| *path == OWN_STATUS)
389 .map(|(_, bounds)| *bounds);
390 if let (Some(menu), Some(button)) = (menu, button) {
391 if overlaps(menu, button) {
392 found.push((
393 format!("{MENU}:covers:{OWN_STATUS}"),
394 format!(
395 "{MENU} {} covers {OWN_STATUS} {}",
396 describe(menu),
397 describe(button)
398 ),
399 ));
400 }
401 }
402 visual.simulate_keystrokes("escape");
403 visual.run_until_parked();
404 }
405 for (key, message) in found {
406 let full_key = format!("{screen_name}@{width}x{height}:{key}");
407 if KNOWN_VIOLATIONS.contains(&full_key.as_str()) {
408 seen_known.insert(full_key);
409 } else {
410 unexpected.push(format!("{full_key}: {message}"));
411 }
412 }
413 }
414 }
415 let stale: Vec<String> = KNOWN_VIOLATIONS
416 .iter()
417 .filter(|key| !seen_known.contains(**key))
418 .map(|key| format!("stale known violation, remove it: {key}"))
419 .collect();
420 assert!(
421 unexpected.is_empty() && stale.is_empty(),
422 "{}",
423 unexpected
424 .into_iter()
425 .chain(stale)
426 .collect::<Vec<_>>()
427 .join("\n")
428 );
429 }
430 }
@@ -0,0 +1,430 @@
1use std::collections::HashSet;
2use std::fs;
3use std::path::{Path, PathBuf};
4
5use regex::Regex;
6
7const WIDGETS_FILE: &str = "views/widgets.rs";
8const SCAN_ALLOWLIST: &[(&str, &str)] = &[
9 ("views/toolbar_placement.rs", ".top(px(-SLOT_HEIGHT))"),
10 ("views/conversation.rs", ".bottom(px(-1.))"),
11];
12
13fn source_files(directory: &Path, files: &mut Vec<PathBuf>) {
14 for entry in fs::read_dir(directory).expect("read source directory") {
15 let path = entry.expect("directory entry").path();
16 if path.is_dir() {
17 source_files(&path, files);
18 } else if path.extension().is_some_and(|extension| extension == "rs") {
19 files.push(path);
20 }
21 }
22}
23
24fn negative_offsets(
25 pattern: &Regex,
26 source: &str,
27 relative: &str,
28) -> Vec<(usize, Option<usize>, String)> {
29 pattern
30 .find_iter(source)
31 .map(|found| {
32 let line_number = source[..found.start()].matches('\n').count() + 1;
33 let from_match = &source[found.start()..];
34 let allowed = SCAN_ALLOWLIST.iter().position(|(allowed_file, snippet)| {
35 *allowed_file == relative && from_match.starts_with(snippet)
36 });
37 let line_end = from_match.find('\n').unwrap_or(from_match.len());
38 (
39 line_number,
40 allowed,
41 from_match[..line_end].trim().to_owned(),
42 )
43 })
44 .collect()
45}
46
47fn offset_pattern() -> Regex {
48 Regex::new(r"\.(top|right|bottom|left|inset)\(\s*(px\(\s*)?-").expect("pattern")
49}
50
51#[test]
52fn matcher_catches_wrapped_offsets() {
53 let source = "let a = 1;\nlet b = div()\n .top(\n px(-4.))\n .left(px(2.));\n";
54 let found = negative_offsets(&offset_pattern(), source, "views/other.rs");
55 assert_eq!(found, [(3, None, ".top(".to_owned())]);
56}
57
58#[test]
59fn matcher_matches_allowlist_from_match_start() {
60 let source = "x\n .bottom(px(-1.))\n";
61 let found = negative_offsets(&offset_pattern(), source, "views/conversation.rs");
62 assert_eq!(found, [(2, Some(1), ".bottom(px(-1.))".to_owned())]);
63}
64
65#[test]
66fn negative_offsets_go_through_corner_badge() {
67 let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
68 let pattern = offset_pattern();
69 let mut files = Vec::new();
70 source_files(&root, &mut files);
71 let mut matched_allowlist = HashSet::new();
72 let mut violations = Vec::new();
73 for file in files {
74 let relative = file
75 .strip_prefix(&root)
76 .expect("inside src")
77 .to_string_lossy()
78 .replace('\\', "/");
79 if relative == WIDGETS_FILE || relative == "layout_guard.rs" {
80 continue;
81 }
82 let source = fs::read_to_string(&file).expect("read source file");
83 for (line_number, position, text) in negative_offsets(&pattern, &source, &relative) {
84 match position {
85 Some(position) => {
86 matched_allowlist.insert(position);
87 }
88 None => violations.push(format!(
89 "{relative}:{line_number}: negative absolute offset, use widgets::corner_badge: {text}"
90 )),
91 }
92 }
93 }
94 let stale: Vec<String> = SCAN_ALLOWLIST
95 .iter()
96 .enumerate()
97 .filter(|(position, _)| !matched_allowlist.contains(position))
98 .map(|(_, (file, snippet))| format!("stale allowlist entry, remove it: {file} {snippet}"))
99 .collect();
100 assert!(
101 violations.is_empty() && stale.is_empty(),
102 "{}",
103 violations
104 .into_iter()
105 .chain(stale)
106 .collect::<Vec<_>>()
107 .join("\n")
108 );
109}
110
111mod frames {
112 use std::collections::HashSet;
113 use std::sync::Arc;
114 use std::time::Duration;
115
116 use gpui_kit::test::TestWindowExt as _;
117 use gpui_kit::{
118 AppContext as _, Bounds, Pixels, TestAppContext, VisualTestContext, WindowOptions, point,
119 px, size,
120 };
121 use store::Store;
122
123 use crate::app_state::{AppState, Mode};
124 use crate::demo;
125 use crate::user_activity::UserInput;
126 use crate::views::shell::{AppShell, Startup, bind_keys, install_globals};
127 use crate::views::shortcuts::{OpenActivity, OpenCallsTab, OpenChannelsTab, OpenSaved};
128
129 const GUARDED: &[&str] = &[
130 "shell",
131 "shell/title-bar",
132 "shell/title-bar/search",
133 "shell/title-bar/own-status",
134 "shell/title-bar/own-status/avatar",
135 "shell/islands",
136 "shell/islands/rail",
137 "shell/islands/sidebar",
138 "shell/islands/main",
139 "shell/status-bar",
140 ];
141 const MENU: &str = "popup-menu";
142 const OWN_STATUS: &str = "shell/title-bar/own-status";
143 const SIZES: [(f32, f32); 2] = [(640., 480.), (1920., 1080.)];
144 const TOLERANCE: f32 = 0.5;
145 const KNOWN_VIOLATIONS: &[&str] = &[];
146
147 type Tag = (&'static str, Bounds<Pixels>);
148
149 enum Screen {
150 Tab(&'static str, Option<fn(&mut VisualTestContext)>),
151 StatusMenu,
152 }
153
154 fn parent_of(path: &str) -> Option<&str> {
155 path.rsplit_once('/').map(|(parent, _)| parent)
156 }
157
158 fn contains(outer: Bounds<Pixels>, inner: Bounds<Pixels>) -> bool {
159 let tolerance = px(TOLERANCE);
160 inner.left() >= outer.left() - tolerance
161 && inner.top() >= outer.top() - tolerance
162 && inner.right() <= outer.right() + tolerance
163 && inner.bottom() <= outer.bottom() + tolerance
164 }
165
166 fn overlaps(first: Bounds<Pixels>, second: Bounds<Pixels>) -> bool {
167 let tolerance = px(TOLERANCE);
168 first.left() < second.right() - tolerance
169 && second.left() < first.right() - tolerance
170 && first.top() < second.bottom() - tolerance
171 && second.top() < first.bottom() - tolerance
172 }
173
174 fn describe(bounds: Bounds<Pixels>) -> String {
175 format!(
176 "[{:.1},{:.1} {:.1}x{:.1}]",
177 f32::from(bounds.origin.x),
178 f32::from(bounds.origin.y),
179 f32::from(bounds.size.width),
180 f32::from(bounds.size.height)
181 )
182 }
183
184 fn violations(
185 tags: &[Tag],
186 window: Bounds<Pixels>,
187 expected: &[&str],
188 ) -> Vec<(String, String)> {
189 let mut found = Vec::new();
190 let bounds_of = |path: &str| {
191 tags.iter()
192 .find(|(tag, _)| *tag == path)
193 .map(|(_, bounds)| *bounds)
194 };
195 for path in expected {
196 if bounds_of(path).is_none() {
197 found.push((
198 format!("{path}:missing"),
199 format!("{path} was not rendered"),
200 ));
201 }
202 }
203 for (path, bounds) in tags {
204 if !contains(window, *bounds) {
205 found.push((
206 format!("{path}:outside-window"),
207 format!(
208 "{path} {} leaves the window {}",
209 describe(*bounds),
210 describe(window)
211 ),
212 ));
213 }
214 if let Some(parent) =
215 parent_of(path).and_then(|parent| bounds_of(parent).map(|bounds| (parent, bounds)))
216 {
217 if !contains(parent.1, *bounds) {
218 found.push((
219 format!("{path}:outside-parent"),
220 format!(
221 "{path} {} leaves {} {}",
222 describe(*bounds),
223 parent.0,
224 describe(parent.1)
225 ),
226 ));
227 }
228 }
229 for (other, other_bounds) in tags {
230 let siblings = path < other
231 && parent_of(path).is_some()
232 && parent_of(path) == parent_of(other);
233 if siblings && overlaps(*bounds, *other_bounds) {
234 found.push((
235 format!("{path}:overlaps:{other}"),
236 format!(
237 "{path} {} overlaps {other} {}",
238 describe(*bounds),
239 describe(*other_bounds)
240 ),
241 ));
242 }
243 }
244 }
245 found
246 }
247
248 const SETTLE_FRAMES: usize = 2;
249 const SETTLE_LIMIT: usize = 60;
250 const SETTLE_STEP: Duration = Duration::from_millis(50);
251
252 fn collect(visual: &mut VisualTestContext, awaited: Option<&'static str>) -> Vec<Tag> {
253 let mut frames = 0;
254 while frames < SETTLE_FRAMES
255 || awaited.is_some_and(|path| visual.debug_bounds(path).is_none())
256 {
257 assert!(frames < SETTLE_LIMIT, "{awaited:?} never rendered");
258 visual.executor().advance_clock(SETTLE_STEP);
259 std::thread::sleep(SETTLE_STEP);
260 visual.run_until_parked();
261 visual.update(|window, cx| window.render_frame(cx));
262 frames += 1;
263 }
264 GUARDED
265 .iter()
266 .chain([&MENU])
267 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
268 .collect()
269 }
270
271 fn mount(cx: &mut TestAppContext) -> gpui_kit::AnyWindowHandle {
272 cx.update(gpui_kit::init);
273 cx.update(|cx| {
274 crate::theme::apply(cx);
275 bind_keys(cx);
276 let store = Store::open_in_memory().expect("in-memory store");
277 demo::seed(&store);
278 let mode = Mode {
279 demo: true,
280 read_only: false,
281 demo_sync: None,
282 };
283 let state = cx.new(|_| AppState::new(Arc::new(store), mode));
284 install_globals(&state, UserInput::new(), cx);
285 demo::start_session(&state, cx);
286 let startup = Startup {
287 switcher_query: None,
288 composer_text: None,
289 reply_to_last: false,
290 };
291 gpui_kit::open_window(WindowOptions::default(), cx, move |window, cx| {
292 cx.new(|cx| AppShell::new(state, None, startup, window, cx))
293 })
294 .expect("open test window")
295 .0
296 })
297 }
298
299 fn rectangle(left: f32, top: f32, width: f32, height: f32) -> Bounds<Pixels> {
300 Bounds {
301 origin: point(px(left), px(top)),
302 size: size(px(width), px(height)),
303 }
304 }
305
306 #[test]
307 fn rules_flag_overlap_and_overflow() {
308 let window = rectangle(0., 0., 100., 100.);
309 let tags: Vec<Tag> = vec![
310 ("shell", rectangle(0., 0., 100., 100.)),
311 ("shell/islands", rectangle(0., 0., 100., 50.)),
312 ("shell/islands/rail", rectangle(0., 0., 60., 50.)),
313 ("shell/islands/sidebar", rectangle(50., 0., 60., 50.)),
314 ];
315 let keys: Vec<String> = violations(&tags, window, &["shell/status-bar"])
316 .into_iter()
317 .map(|(key, _)| key)
318 .collect();
319 assert_eq!(
320 keys,
321 [
322 "shell/status-bar:missing",
323 "shell/islands/rail:overlaps:shell/islands/sidebar",
324 "shell/islands/sidebar:outside-window",
325 "shell/islands/sidebar:outside-parent",
326 ]
327 );
328 }
329
330 #[gpui_kit::test]
331 fn no_element_overlaps_or_leaves_its_container(cx: &mut TestAppContext) {
332 let handle = mount(cx);
333 let mut visual = VisualTestContext::from_window(handle, cx);
334 let mut seen_known = HashSet::new();
335 let mut unexpected = Vec::new();
336 for (width, height) in SIZES {
337 visual.simulate_resize(size(px(width), px(height)));
338 let window = Bounds {
339 origin: point(px(0.), px(0.)),
340 size: size(px(width), px(height)),
341 };
342 let screens = [
343 Screen::Tab("chats", None),
344 Screen::Tab(
345 "activity",
346 Some(|visual| visual.dispatch_action(OpenActivity)),
347 ),
348 Screen::Tab(
349 "channels",
350 Some(|visual| visual.dispatch_action(OpenChannelsTab)),
351 ),
352 Screen::Tab("saved", Some(|visual| visual.dispatch_action(OpenSaved))),
353 Screen::Tab("calls", Some(|visual| visual.dispatch_action(OpenCallsTab))),
354 Screen::StatusMenu,
355 ];
356 for screen in screens {
357 let (screen_name, status_menu) = match screen {
358 Screen::Tab(name, open) => {
359 if let Some(open) = open {
360 open(&mut visual);
361 }
362 (name, false)
363 }
364 Screen::StatusMenu => {
365 let tags = collect(&mut visual, None);
366 let button = tags
367 .iter()
368 .find(|(path, _)| *path == OWN_STATUS)
369 .map(|(_, bounds)| *bounds)
370 .expect("own status button rendered");
371 visual.simulate_click(button.center(), Default::default());
372 ("status-menu", true)
373 }
374 };
375 let tags = collect(&mut visual, status_menu.then_some(MENU));
376 let mut expected = GUARDED.to_vec();
377 if status_menu {
378 expected.push(MENU);
379 }
380 let mut found = violations(&tags, window, &expected);
381 if status_menu {
382 let menu = tags
383 .iter()
384 .find(|(path, _)| *path == MENU)
385 .map(|(_, bounds)| *bounds);
386 let button = tags
387 .iter()
388 .find(|(path, _)| *path == OWN_STATUS)
389 .map(|(_, bounds)| *bounds);
390 if let (Some(menu), Some(button)) = (menu, button) {
391 if overlaps(menu, button) {
392 found.push((
393 format!("{MENU}:covers:{OWN_STATUS}"),
394 format!(
395 "{MENU} {} covers {OWN_STATUS} {}",
396 describe(menu),
397 describe(button)
398 ),
399 ));
400 }
401 }
402 visual.simulate_keystrokes("escape");
403 visual.run_until_parked();
404 }
405 for (key, message) in found {
406 let full_key = format!("{screen_name}@{width}x{height}:{key}");
407 if KNOWN_VIOLATIONS.contains(&full_key.as_str()) {
408 seen_known.insert(full_key);
409 } else {
410 unexpected.push(format!("{full_key}: {message}"));
411 }
412 }
413 }
414 }
415 let stale: Vec<String> = KNOWN_VIOLATIONS
416 .iter()
417 .filter(|key| !seen_known.contains(**key))
418 .map(|key| format!("stale known violation, remove it: {key}"))
419 .collect();
420 assert!(
421 unexpected.is_empty() && stale.is_empty(),
422 "{}",
423 unexpected
424 .into_iter()
425 .chain(stale)
426 .collect::<Vec<_>>()
427 .join("\n")
428 );
429 }
430}
crates/app/src/main.rs +4 −7
@@ -35,6 +35,8 @@ mod fuzzy;
35 35 mod gifs;
36 36 mod image_view_gallery;
37 37 mod image_view_math;
38 #[cfg(test)]
39 mod layout_guard;
38 40 mod local_previews;
39 41 mod message_actions;
40 42 mod notice;
@@ -252,16 +254,11 @@ fn main() {
252 254 state.start_on_channels = arguments.channels_tab;
253 255 state
254 256 });
255 cx.set_global(app_state::AppHandle(state.clone()));
256 cx.set_global(views::shell::UserInputHandle(user_input));
257 views::shell::install_globals(&state, user_input, cx);
257 258 agent_api::init(state.read(cx).store.clone(), arguments.demo, cx);
258 259 agents::install(state.clone(), cx);
259 260 if arguments.demo {
260 state.update(cx, |state, cx| {
261 demo::seed_directory(state);
262 state.demo_live_meetings();
263 state.select(demo::first_selection(), cx);
264 });
261 demo::start_session(&state, cx);
265 262 }
266 263 if let Some(mut receiver) = receiver {
267 264 let state = state.clone();
@@ -35,6 +35,8 @@ mod fuzzy;
35mod gifs;
35mod gifs;
36mod image_view_gallery;
36mod image_view_gallery;
37mod image_view_math;
37mod image_view_math;
38#[cfg(test)]
39mod layout_guard;
38mod local_previews;
40mod local_previews;
39mod message_actions;
41mod message_actions;
40mod notice;
42mod notice;
@@ -252,16 +254,11 @@ fn main() {
252 state.start_on_channels = arguments.channels_tab;
254 state.start_on_channels = arguments.channels_tab;
253 state
255 state
254 });
256 });
255 cx.set_global(app_state::AppHandle(state.clone()));
257 views::shell::install_globals(&state, user_input, cx);
256 cx.set_global(views::shell::UserInputHandle(user_input));
257 agent_api::init(state.read(cx).store.clone(), arguments.demo, cx);
258 agent_api::init(state.read(cx).store.clone(), arguments.demo, cx);
258 agents::install(state.clone(), cx);
259 agents::install(state.clone(), cx);
259 if arguments.demo {
260 if arguments.demo {
260 state.update(cx, |state, cx| {
261 demo::start_session(&state, cx);
261 demo::seed_directory(state);
262 state.demo_live_meetings();
263 state.select(demo::first_selection(), cx);
264 });
265 }
262 }
266 if let Some(mut receiver) = receiver {
263 if let Some(mut receiver) = receiver {
267 let state = state.clone();
264 let state = state.clone();
crates/app/src/views/activity_panel.rs +2 −5
@@ -8,7 +8,7 @@ use gpui_kit::*;
8 8 use store::Sidebar;
9 9
10 10 use super::avatar::person_avatar;
11 use super::widgets::{dot, icon};
11 use super::widgets::{Corner, corner_badge, dot, icon};
12 12 use crate::activity::{ActivityCenter, Entry, Filter, Kind};
13 13 use crate::app_state::{AppState, chat_title};
14 14 use crate::data::is_one_on_one;
@@ -309,10 +309,7 @@ fn status_slot(
309 309 }
310 310
311 311 fn kind_marker(entry: &Entry, row_group: SharedString) -> Div {
312 let marker = div()
313 .absolute()
314 .right(px(-4.))
315 .bottom(px(-4.))
312 let marker = corner_badge(Corner::BottomRight, 4.)
316 313 .size(px(KIND_MARKER_SIZE))
317 314 .flex()
318 315 .items_center()
@@ -8,7 +8,7 @@ use gpui_kit::*;
8use store::Sidebar;
8use store::Sidebar;
9
9
10use super::avatar::person_avatar;
10use super::avatar::person_avatar;
11use super::widgets::{dot, icon};
11use super::widgets::{Corner, corner_badge, dot, icon};
12use crate::activity::{ActivityCenter, Entry, Filter, Kind};
12use crate::activity::{ActivityCenter, Entry, Filter, Kind};
13use crate::app_state::{AppState, chat_title};
13use crate::app_state::{AppState, chat_title};
14use crate::data::is_one_on_one;
14use crate::data::is_one_on_one;
@@ -309,10 +309,7 @@ fn status_slot(
309}
309}
310
310
311fn kind_marker(entry: &Entry, row_group: SharedString) -> Div {
311fn kind_marker(entry: &Entry, row_group: SharedString) -> Div {
312 let marker = div()
312 let marker = corner_badge(Corner::BottomRight, 4.)
313 .absolute()
314 .right(px(-4.))
315 .bottom(px(-4.))
316 .size(px(KIND_MARKER_SIZE))
313 .size(px(KIND_MARKER_SIZE))
317 .flex()
314 .flex()
318 .items_center()
315 .items_center()
crates/app/src/views/avatar.rs +3 −9
@@ -11,7 +11,7 @@ use crate::format;
11 11 use crate::sidebar_model::{AvatarSpec, Face};
12 12 use crate::theme;
13 13 use crate::views::profile_card::opens_profile;
14 use crate::views::widgets::icon;
14 use crate::views::widgets::{Corner, corner_badge, icon};
15 15
16 16 const PAIR_RATIO: f32 = 24. / 36.;
17 17 const PRESENCE_MIN: f32 = 10.;
@@ -143,10 +143,7 @@ pub fn presence_dot(kind: PresenceKind, ring: Hsla, avatar_size: f32) -> Option<
143 143 _ => center,
144 144 };
145 145 Some(
146 div()
147 .absolute()
148 .right(px(-2.))
149 .bottom(px(-2.))
146 corner_badge(Corner::BottomRight, 2.)
150 147 .size(px(outer))
151 148 .rounded_full()
152 149 .bg(ring)
@@ -165,10 +162,7 @@ fn presence_spinner(ring: Hsla, avatar_size: f32) -> Div {
165 162 Animation::new(PRESENCE_SPIN_PERIOD).repeat(),
166 163 |icon, delta| icon.transform(Transformation::rotate(percentage(delta))),
167 164 );
168 div()
169 .absolute()
170 .right(px(-2.))
171 .bottom(px(-2.))
165 corner_badge(Corner::BottomRight, 2.)
172 166 .size(px(outer))
173 167 .rounded_full()
174 168 .bg(ring)
@@ -11,7 +11,7 @@ use crate::format;
11use crate::sidebar_model::{AvatarSpec, Face};
11use crate::sidebar_model::{AvatarSpec, Face};
12use crate::theme;
12use crate::theme;
13use crate::views::profile_card::opens_profile;
13use crate::views::profile_card::opens_profile;
14use crate::views::widgets::icon;
14use crate::views::widgets::{Corner, corner_badge, icon};
15
15
16const PAIR_RATIO: f32 = 24. / 36.;
16const PAIR_RATIO: f32 = 24. / 36.;
17const PRESENCE_MIN: f32 = 10.;
17const PRESENCE_MIN: f32 = 10.;
@@ -143,10 +143,7 @@ pub fn presence_dot(kind: PresenceKind, ring: Hsla, avatar_size: f32) -> Option<
143 _ => center,
143 _ => center,
144 };
144 };
145 Some(
145 Some(
146 div()
146 corner_badge(Corner::BottomRight, 2.)
147 .absolute()
148 .right(px(-2.))
149 .bottom(px(-2.))
150 .size(px(outer))
147 .size(px(outer))
151 .rounded_full()
148 .rounded_full()
152 .bg(ring)
149 .bg(ring)
@@ -165,10 +162,7 @@ fn presence_spinner(ring: Hsla, avatar_size: f32) -> Div {
165 Animation::new(PRESENCE_SPIN_PERIOD).repeat(),
162 Animation::new(PRESENCE_SPIN_PERIOD).repeat(),
166 |icon, delta| icon.transform(Transformation::rotate(percentage(delta))),
163 |icon, delta| icon.transform(Transformation::rotate(percentage(delta))),
167 );
164 );
168 div()
165 corner_badge(Corner::BottomRight, 2.)
169 .absolute()
170 .right(px(-2.))
171 .bottom(px(-2.))
172 .size(px(outer))
166 .size(px(outer))
173 .rounded_full()
167 .rounded_full()
174 .bg(ring)
168 .bg(ring)
crates/app/src/views/call_view.rs +3 −8
@@ -27,7 +27,7 @@ use super::call_organizer::{
27 27 use super::call_stage::render_stage;
28 28 use super::conversation::ConversationView;
29 29 use super::shell::ISLAND_GAP;
30 use super::widgets::{count_badge, icon};
30 use super::widgets::{Corner, corner_badge, count_badge, icon};
31 31 use crate::app_state::AppState;
32 32 use crate::call::REACTION_SHOWN;
33 33 use crate::call::TileSize;
@@ -617,13 +617,7 @@ fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div>
617 617 .build(window, cx)
618 618 })
619 619 .when(unread > 0, |button| {
620 button.child(
621 div()
622 .absolute()
623 .top(px(-4.))
624 .right(px(-4.))
625 .child(count_badge(unread, false)),
626 )
620 button.child(corner_badge(Corner::TopRight, 4.).child(count_badge(unread, false)))
627 621 })
628 622 .on_click(move |_, _, cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)))
629 623 }
@@ -1161,6 +1155,7 @@ pub fn render_call_view(
1161 1155 .children(consent_overlay(app, model));
1162 1156 Some(
1163 1157 h_flex()
1158 .debug_selector(|| "shell/islands/main".into())
1164 1159 .flex_1()
1165 1160 .min_w_0()
1166 1161 .h_full()
@@ -27,7 +27,7 @@ use super::call_organizer::{
27use super::call_stage::render_stage;
27use super::call_stage::render_stage;
28use super::conversation::ConversationView;
28use super::conversation::ConversationView;
29use super::shell::ISLAND_GAP;
29use super::shell::ISLAND_GAP;
30use super::widgets::{count_badge, icon};
30use super::widgets::{Corner, corner_badge, count_badge, icon};
31use crate::app_state::AppState;
31use crate::app_state::AppState;
32use crate::call::REACTION_SHOWN;
32use crate::call::REACTION_SHOWN;
33use crate::call::TileSize;
33use crate::call::TileSize;
@@ -617,13 +617,7 @@ fn chat_button(app: &Entity<AppState>, open: bool, unread: u32) -> Stateful<Div>
617 .build(window, cx)
617 .build(window, cx)
618 })
618 })
619 .when(unread > 0, |button| {
619 .when(unread > 0, |button| {
620 button.child(
620 button.child(corner_badge(Corner::TopRight, 4.).child(count_badge(unread, false)))
621 div()
622 .absolute()
623 .top(px(-4.))
624 .right(px(-4.))
625 .child(count_badge(unread, false)),
626 )
627 })
621 })
628 .on_click(move |_, _, cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)))
622 .on_click(move |_, _, cx| app.update(cx, |state, cx| state.toggle_call_chat(cx)))
629}
623}
@@ -1161,6 +1155,7 @@ pub fn render_call_view(
1161 .children(consent_overlay(app, model));
1155 .children(consent_overlay(app, model));
1162 Some(
1156 Some(
1163 h_flex()
1157 h_flex()
1158 .debug_selector(|| "shell/islands/main".into())
1164 .flex_1()
1159 .flex_1()
1165 .min_w_0()
1160 .min_w_0()
1166 .h_full()
1161 .h_full()
crates/app/src/views/conversation.rs +3 −0
@@ -3193,6 +3193,9 @@ impl Render for ConversationView {
3193 3193 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
3194 3194 let background = theme::surface();
3195 3195 let mut root = v_flex()
3196 .when(!self.pinned, |root| {
3197 root.debug_selector(|| "shell/islands/main".into())
3198 })
3196 3199 .flex_1()
3197 3200 .w_full()
3198 3201 .min_w_0()
@@ -3193,6 +3193,9 @@ impl Render for ConversationView {
3193 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
3193 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
3194 let background = theme::surface();
3194 let background = theme::surface();
3195 let mut root = v_flex()
3195 let mut root = v_flex()
3196 .when(!self.pinned, |root| {
3197 root.debug_selector(|| "shell/islands/main".into())
3198 })
3196 .flex_1()
3199 .flex_1()
3197 .w_full()
3200 .w_full()
3198 .min_w_0()
3201 .min_w_0()
crates/app/src/views/rail.rs +1 −0
@@ -302,6 +302,7 @@ impl Render for RailView {
302 302 self.agents_running(cx),
303 303 );
304 304 v_flex()
305 .debug_selector(|| "shell/islands/rail".into())
305 306 .w(px(RAIL_WIDTH))
306 307 .h_full()
307 308 .flex_none()
@@ -302,6 +302,7 @@ impl Render for RailView {
302 self.agents_running(cx),
302 self.agents_running(cx),
303 );
303 );
304 v_flex()
304 v_flex()
305 .debug_selector(|| "shell/islands/rail".into())
305 .w(px(RAIL_WIDTH))
306 .w(px(RAIL_WIDTH))
306 .h_full()
307 .h_full()
307 .flex_none()
308 .flex_none()
crates/app/src/views/shell.rs +7 −0
@@ -70,6 +70,11 @@ pub struct UserInputHandle(pub Arc<UserInput>);
70 70
71 71 impl Global for UserInputHandle {}
72 72
73 pub fn install_globals(state: &Entity<AppState>, user_input: Arc<UserInput>, cx: &mut App) {
74 cx.set_global(crate::app_state::AppHandle(state.clone()));
75 cx.set_global(UserInputHandle(user_input));
76 }
77
73 78 pub struct AppShell {
74 79 state: Entity<AppState>,
75 80 rail: Entity<RailView>,
@@ -612,6 +617,7 @@ impl AppShell {
612 617 impl AppShell {
613 618 fn islands(&self, call_view: Option<AnyElement>) -> impl IntoElement {
614 619 h_flex()
620 .debug_selector(|| "shell/islands".into())
615 621 .flex_1()
616 622 .min_h_0()
617 623 .w_full()
@@ -782,6 +788,7 @@ impl Render for AppShell {
782 788 .child(user_activity::input_probe(self.user_input.clone()))
783 789 .child(
784 790 v_flex()
791 .debug_selector(|| "shell".into())
785 792 .size_full()
786 793 .child(title_bar)
787 794 .child(self.islands(call_view))
@@ -70,6 +70,11 @@ pub struct UserInputHandle(pub Arc<UserInput>);
70
70
71impl Global for UserInputHandle {}
71impl Global for UserInputHandle {}
72
72
73pub fn install_globals(state: &Entity<AppState>, user_input: Arc<UserInput>, cx: &mut App) {
74 cx.set_global(crate::app_state::AppHandle(state.clone()));
75 cx.set_global(UserInputHandle(user_input));
76}
77
73pub struct AppShell {
78pub struct AppShell {
74 state: Entity<AppState>,
79 state: Entity<AppState>,
75 rail: Entity<RailView>,
80 rail: Entity<RailView>,
@@ -612,6 +617,7 @@ impl AppShell {
612impl AppShell {
617impl AppShell {
613 fn islands(&self, call_view: Option<AnyElement>) -> impl IntoElement {
618 fn islands(&self, call_view: Option<AnyElement>) -> impl IntoElement {
614 h_flex()
619 h_flex()
620 .debug_selector(|| "shell/islands".into())
615 .flex_1()
621 .flex_1()
616 .min_h_0()
622 .min_h_0()
617 .w_full()
623 .w_full()
@@ -782,6 +788,7 @@ impl Render for AppShell {
782 .child(user_activity::input_probe(self.user_input.clone()))
788 .child(user_activity::input_probe(self.user_input.clone()))
783 .child(
789 .child(
784 v_flex()
790 v_flex()
791 .debug_selector(|| "shell".into())
785 .size_full()
792 .size_full()
786 .child(title_bar)
793 .child(title_bar)
787 .child(self.islands(call_view))
794 .child(self.islands(call_view))
crates/app/src/views/sidebar.rs +1 −0
@@ -1749,6 +1749,7 @@ impl Render for SidebarView {
1749 1749 SidebarTab::Activity | SidebarTab::Saved => None,
1750 1750 };
1751 1751 v_flex()
1752 .debug_selector(|| "shell/islands/sidebar".into())
1752 1753 .w(px(SIDEBAR_WIDTH))
1753 1754 .h_full()
1754 1755 .flex_none()
@@ -1749,6 +1749,7 @@ impl Render for SidebarView {
1749 SidebarTab::Activity | SidebarTab::Saved => None,
1749 SidebarTab::Activity | SidebarTab::Saved => None,
1750 };
1750 };
1751 v_flex()
1751 v_flex()
1752 .debug_selector(|| "shell/islands/sidebar".into())
1752 .w(px(SIDEBAR_WIDTH))
1753 .w(px(SIDEBAR_WIDTH))
1753 .h_full()
1754 .h_full()
1754 .flex_none()
1755 .flex_none()
crates/app/src/views/status_bar.rs +1 −0
@@ -71,6 +71,7 @@ pub fn render_status_bar(
71 71 };
72 72 let live = live_text(state.live);
73 73 let mut bar = h_flex()
74 .debug_selector(|| "shell/status-bar".into())
74 75 .w_full()
75 76 .h(px(24.))
76 77 .flex_none()
@@ -71,6 +71,7 @@ pub fn render_status_bar(
71 };
71 };
72 let live = live_text(state.live);
72 let live = live_text(state.live);
73 let mut bar = h_flex()
73 let mut bar = h_flex()
74 .debug_selector(|| "shell/status-bar".into())
74 .w_full()
75 .w_full()
75 .h(px(24.))
76 .h(px(24.))
76 .flex_none()
77 .flex_none()
crates/app/src/views/status_menu.rs +23 −13
@@ -87,19 +87,29 @@ pub fn own_status_button(app: &Entity<AppState>, state: &AppState) -> Option<Any
87 87 );
88 88 let toggle = app.clone();
89 89 Some(
90 Button::new("title-own-status")
91 .ghost()
92 .p_0()
93 .size(px(OWN_STATUS_BUTTON_SIZE))
94 .rounded_full()
95 .child(div().p(px(PRESENCE_OVERHANG)).child(ringed))
96 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
97 status_menu(popup, window, cx, &context)
98 })
99 .on_open_change(move |open, _, cx| {
100 let open = *open;
101 toggle.update(cx, |state, cx| state.set_status_menu_open(open, cx));
102 })
90 div()
91 .debug_selector(|| "shell/title-bar/own-status".into())
92 .flex_none()
93 .child(
94 Button::new("title-own-status")
95 .ghost()
96 .p_0()
97 .size(px(OWN_STATUS_BUTTON_SIZE))
98 .rounded_full()
99 .child(
100 div()
101 .debug_selector(|| "shell/title-bar/own-status/avatar".into())
102 .p(px(PRESENCE_OVERHANG))
103 .child(ringed),
104 )
105 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
106 status_menu(popup, window, cx, &context)
107 })
108 .on_open_change(move |open, _, cx| {
109 let open = *open;
110 toggle.update(cx, |state, cx| state.set_status_menu_open(open, cx));
111 }),
112 )
103 113 .into_any_element(),
104 114 )
105 115 }
@@ -87,19 +87,29 @@ pub fn own_status_button(app: &Entity<AppState>, state: &AppState) -> Option<Any
87 );
87 );
88 let toggle = app.clone();
88 let toggle = app.clone();
89 Some(
89 Some(
90 Button::new("title-own-status")
90 div()
91 .ghost()
91 .debug_selector(|| "shell/title-bar/own-status".into())
92 .p_0()
92 .flex_none()
93 .size(px(OWN_STATUS_BUTTON_SIZE))
93 .child(
94 .rounded_full()
94 Button::new("title-own-status")
95 .child(div().p(px(PRESENCE_OVERHANG)).child(ringed))
95 .ghost()
96 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
96 .p_0()
97 status_menu(popup, window, cx, &context)
97 .size(px(OWN_STATUS_BUTTON_SIZE))
98 })
98 .rounded_full()
99 .on_open_change(move |open, _, cx| {
99 .child(
100 let open = *open;
100 div()
101 toggle.update(cx, |state, cx| state.set_status_menu_open(open, cx));
101 .debug_selector(|| "shell/title-bar/own-status/avatar".into())
102 })
102 .p(px(PRESENCE_OVERHANG))
103 .child(ringed),
104 )
105 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
106 status_menu(popup, window, cx, &context)
107 })
108 .on_open_change(move |open, _, cx| {
109 let open = *open;
110 toggle.update(cx, |state, cx| state.set_status_menu_open(open, cx));
111 }),
112 )
103 .into_any_element(),
113 .into_any_element(),
104 )
114 )
105}
115}
crates/app/src/views/title_bar.rs +8 −2
@@ -26,6 +26,7 @@ pub fn render_title_bar(
26 26 ) -> impl IntoElement {
27 27 let search = h_flex()
28 28 .id("title-search")
29 .debug_selector(|| "shell/title-bar/search".into())
29 30 .occlude()
30 31 .w(px(SEARCH_WIDTH))
31 32 .h(px(28.))
@@ -49,7 +50,7 @@ pub fn render_title_bar(
49 50 .child(SHORTCUT_HINT),
50 51 )
51 52 .on_click(on_search);
52 TitleBar::new()
53 let bar = TitleBar::new()
53 54 .h(px(TITLE_BAR_HEIGHT))
54 55 .bg(theme::background())
55 56 .child(
@@ -69,5 +70,10 @@ pub fn render_title_bar(
69 70 .child(div().flex_1().flex().justify_center().child(search))
70 71 .children(own)
71 72 .child(div().w(px(4.))),
72 )
73 );
74 div()
75 .debug_selector(|| "shell/title-bar".into())
76 .flex_none()
77 .w_full()
78 .child(bar)
73 79 }
@@ -26,6 +26,7 @@ pub fn render_title_bar(
26) -> impl IntoElement {
26) -> impl IntoElement {
27 let search = h_flex()
27 let search = h_flex()
28 .id("title-search")
28 .id("title-search")
29 .debug_selector(|| "shell/title-bar/search".into())
29 .occlude()
30 .occlude()
30 .w(px(SEARCH_WIDTH))
31 .w(px(SEARCH_WIDTH))
31 .h(px(28.))
32 .h(px(28.))
@@ -49,7 +50,7 @@ pub fn render_title_bar(
49 .child(SHORTCUT_HINT),
50 .child(SHORTCUT_HINT),
50 )
51 )
51 .on_click(on_search);
52 .on_click(on_search);
52 TitleBar::new()
53 let bar = TitleBar::new()
53 .h(px(TITLE_BAR_HEIGHT))
54 .h(px(TITLE_BAR_HEIGHT))
54 .bg(theme::background())
55 .bg(theme::background())
55 .child(
56 .child(
@@ -69,5 +70,10 @@ pub fn render_title_bar(
69 .child(div().flex_1().flex().justify_center().child(search))
70 .child(div().flex_1().flex().justify_center().child(search))
70 .children(own)
71 .children(own)
71 .child(div().w(px(4.))),
72 .child(div().w(px(4.))),
72 )
73 );
74 div()
75 .debug_selector(|| "shell/title-bar".into())
76 .flex_none()
77 .w_full()
78 .child(bar)
73}
79}
crates/app/src/views/widgets.rs +14 −0
@@ -17,6 +17,20 @@ pub fn symbol(name: &str, size: f32, color: Hsla) -> Icon {
17 17 .text_color(color)
18 18 }
19 19
20 #[derive(Clone, Copy)]
21 pub enum Corner {
22 TopRight,
23 BottomRight,
24 }
25
26 pub fn corner_badge(corner: Corner, overhang: f32) -> Div {
27 let badge = div().absolute().right(px(-overhang));
28 match corner {
29 Corner::TopRight => badge.top(px(-overhang)),
30 Corner::BottomRight => badge.bottom(px(-overhang)),
31 }
32 }
33
20 34 pub fn count_badge(count: u32, muted: bool) -> Div {
21 35 let (background, foreground) = if muted {
22 36 (theme::badge_muted(), theme::text_strong())
@@ -17,6 +17,20 @@ pub fn symbol(name: &str, size: f32, color: Hsla) -> Icon {
17 .text_color(color)
17 .text_color(color)
18}
18}
19
19
20#[derive(Clone, Copy)]
21pub enum Corner {
22 TopRight,
23 BottomRight,
24}
25
26pub fn corner_badge(corner: Corner, overhang: f32) -> Div {
27 let badge = div().absolute().right(px(-overhang));
28 match corner {
29 Corner::TopRight => badge.top(px(-overhang)),
30 Corner::BottomRight => badge.bottom(px(-overhang)),
31 }
32}
33
20pub fn count_badge(count: u32, muted: bool) -> Div {
34pub fn count_badge(count: u32, muted: bool) -> Div {
21 let (background, foreground) = if muted {
35 let (background, foreground) = if muted {
22 (theme::badge_muted(), theme::text_strong())
36 (theme::badge_muted(), theme::text_strong())
scripts/headless-shot.sh +41 −4
@@ -1,5 +1,5 @@
1 1 #!/usr/bin/env bash
2 # Usage: scripts/headless-shot.sh OUT.png [--size 1280x800] [--wait 10] [--bin target/debug/teams] [--] [xdotool command]...
2 # Usage: scripts/headless-shot.sh OUT.png [--size 1280x800] [--window WxH] [--wait 10] [--settle 1] [--bin target/debug/teams] [--] [xdotool command]...
3 3 # Runs the Linux build with --demo on a private Xvfb display and saves a screenshot.
4 4 # Example: scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello" "paste ```\\ncode\\n```"
5 5 # `type` cannot send a backtick (X11 treats it as a dead key and input stops); use `paste`, which expands \n.
@@ -9,10 +9,14 @@ out=${1:?output png}
9 9 shift
10 10 size=1280x800
11 11 wait_seconds=10
12 window_size=
13 settle_seconds=1
12 14 binary=target/debug/teams
13 15 while [[ $# -gt 0 ]]; do
14 16 case $1 in
15 17 --size) size=$2; shift 2 ;;
18 --window) window_size=$2; shift 2 ;;
19 --settle) settle_seconds=$2; shift 2 ;;
16 20 --wait) wait_seconds=$2; shift 2 ;;
17 21 --bin) binary=$2; shift 2 ;;
18 22 --) shift; break ;;
@@ -38,17 +42,46 @@ export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json
38 42 app_pid=$!
39 43 sleep "$wait_seconds"
40 44
45 if [[ -n $window_size ]]; then
46 window_width=${window_size%x*}
47 window_height=${window_size#*x}
48 window_id=$(xdotool search --sync --onlyvisible --pid "$app_pid" --name '^Rusty Teams$' | head -n 1)
49 resized=false
50 for _ in 1 2 3 4 5 6 7 8; do
51 xdotool windowmove "$window_id" 0 0
52 xdotool windowsize "$window_id" "$window_width" "$window_height"
53 sleep 1
54 eval "$(xdotool getwindowgeometry --shell "$window_id")"
55 if [[ $WIDTH == "$window_width" && $HEIGHT == "$window_height" ]]; then
56 resized=true
57 break
58 fi
59 done
60 if [[ $resized != true ]]; then
61 echo "window never reached ${window_size}, last geometry ${WIDTH}x${HEIGHT}" >&2
62 exit 1
63 fi
64 fi
65
41 66 for command in "$@"; do
42 67 subcommand=${command%% *}
43 68 rest=${command#"$subcommand"}
44 69 rest=${rest# }
45 if [[ $subcommand == click ]]; then
70 if [[ $subcommand == click || $subcommand == key ]]; then
46 71 # Xvfb has no window manager: keyboard focus only follows an explicit windowfocus.
47 72 eval "$(xdotool getmouselocation --shell)"
48 73 xdotool windowfocus --sync "$WINDOW"
49 74 fi
50 75 if [[ $subcommand == type ]]; then
51 76 xdotool type --delay 20 -- "$rest"
77 elif [[ $subcommand == key && $rest == *+* ]]; then
78 # GPUI drops the key when the modifier and the key arrive in the same instant.
79 modifier=${rest%%+*}
80 xdotool keydown "$modifier"
81 sleep 0.15
82 xdotool key "${rest#*+}"
83 sleep 0.15
84 xdotool keyup "$modifier"
52 85 elif [[ $subcommand == paste ]]; then
53 86 printf '%b' "$rest" | xclip -selection clipboard
54 87 xdotool key ctrl+v
@@ -58,6 +91,10 @@ for command in "$@"; do
58 91 fi
59 92 sleep 0.4
60 93 done
61 sleep 1
62 import -window root "$out"
94 sleep "$settle_seconds"
95 if [[ -n $window_size ]]; then
96 import -window root -crop "${window_size}+0+0" +repage "$out"
97 else
98 import -window root "$out"
99 fi
63 100 echo "$out"
@@ -1,5 +1,5 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2# Usage: scripts/headless-shot.sh OUT.png [--size 1280x800] [--wait 10] [--bin target/debug/teams] [--] [xdotool command]...
2# Usage: scripts/headless-shot.sh OUT.png [--size 1280x800] [--window WxH] [--wait 10] [--settle 1] [--bin target/debug/teams] [--] [xdotool command]...
3# Runs the Linux build with --demo on a private Xvfb display and saves a screenshot.
3# Runs the Linux build with --demo on a private Xvfb display and saves a screenshot.
4# Example: scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello" "paste ```\\ncode\\n```"
4# Example: scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello" "paste ```\\ncode\\n```"
5# `type` cannot send a backtick (X11 treats it as a dead key and input stops); use `paste`, which expands \n.
5# `type` cannot send a backtick (X11 treats it as a dead key and input stops); use `paste`, which expands \n.
@@ -9,10 +9,14 @@ out=${1:?output png}
9shift
9shift
10size=1280x800
10size=1280x800
11wait_seconds=10
11wait_seconds=10
12window_size=
13settle_seconds=1
12binary=target/debug/teams
14binary=target/debug/teams
13while [[ $# -gt 0 ]]; do
15while [[ $# -gt 0 ]]; do
14 case $1 in
16 case $1 in
15 --size) size=$2; shift 2 ;;
17 --size) size=$2; shift 2 ;;
18 --window) window_size=$2; shift 2 ;;
19 --settle) settle_seconds=$2; shift 2 ;;
16 --wait) wait_seconds=$2; shift 2 ;;
20 --wait) wait_seconds=$2; shift 2 ;;
17 --bin) binary=$2; shift 2 ;;
21 --bin) binary=$2; shift 2 ;;
18 --) shift; break ;;
22 --) shift; break ;;
@@ -38,17 +42,46 @@ export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json
38app_pid=$!
42app_pid=$!
39sleep "$wait_seconds"
43sleep "$wait_seconds"
40
44
45if [[ -n $window_size ]]; then
46 window_width=${window_size%x*}
47 window_height=${window_size#*x}
48 window_id=$(xdotool search --sync --onlyvisible --pid "$app_pid" --name '^Rusty Teams$' | head -n 1)
49 resized=false
50 for _ in 1 2 3 4 5 6 7 8; do
51 xdotool windowmove "$window_id" 0 0
52 xdotool windowsize "$window_id" "$window_width" "$window_height"
53 sleep 1
54 eval "$(xdotool getwindowgeometry --shell "$window_id")"
55 if [[ $WIDTH == "$window_width" && $HEIGHT == "$window_height" ]]; then
56 resized=true
57 break
58 fi
59 done
60 if [[ $resized != true ]]; then
61 echo "window never reached ${window_size}, last geometry ${WIDTH}x${HEIGHT}" >&2
62 exit 1
63 fi
64fi
65
41for command in "$@"; do
66for command in "$@"; do
42 subcommand=${command%% *}
67 subcommand=${command%% *}
43 rest=${command#"$subcommand"}
68 rest=${command#"$subcommand"}
44 rest=${rest# }
69 rest=${rest# }
45 if [[ $subcommand == click ]]; then
70 if [[ $subcommand == click || $subcommand == key ]]; then
46 # Xvfb has no window manager: keyboard focus only follows an explicit windowfocus.
71 # Xvfb has no window manager: keyboard focus only follows an explicit windowfocus.
47 eval "$(xdotool getmouselocation --shell)"
72 eval "$(xdotool getmouselocation --shell)"
48 xdotool windowfocus --sync "$WINDOW"
73 xdotool windowfocus --sync "$WINDOW"
49 fi
74 fi
50 if [[ $subcommand == type ]]; then
75 if [[ $subcommand == type ]]; then
51 xdotool type --delay 20 -- "$rest"
76 xdotool type --delay 20 -- "$rest"
77 elif [[ $subcommand == key && $rest == *+* ]]; then
78 # GPUI drops the key when the modifier and the key arrive in the same instant.
79 modifier=${rest%%+*}
80 xdotool keydown "$modifier"
81 sleep 0.15
82 xdotool key "${rest#*+}"
83 sleep 0.15
84 xdotool keyup "$modifier"
52 elif [[ $subcommand == paste ]]; then
85 elif [[ $subcommand == paste ]]; then
53 printf '%b' "$rest" | xclip -selection clipboard
86 printf '%b' "$rest" | xclip -selection clipboard
54 xdotool key ctrl+v
87 xdotool key ctrl+v
@@ -58,6 +91,10 @@ for command in "$@"; do
58 fi
91 fi
59 sleep 0.4
92 sleep 0.4
60done
93done
61sleep 1
94sleep "$settle_seconds"
62import -window root "$out"
95if [[ -n $window_size ]]; then
96 import -window root -crop "${window_size}+0+0" +repage "$out"
97else
98 import -window root "$out"
99fi
63echo "$out"
100echo "$out"
scripts/layout-sweep.sh added +48 −0
@@ -0,0 +1,48 @@
1 #!/usr/bin/env bash
2 # Usage: scripts/layout-sweep.sh [OUT_DIR]
3 # Screenshots every main screen at the minimum and a large window size. Run `cargo build -p app` first.
4 # Output: OUT_DIR/<size>-<screen>.png (default target/layout-sweep)
5 set -euo pipefail
6
7 out_dir=${1:-target/layout-sweep}
8 script_dir=$(cd "$(dirname "$0")" && pwd)
9 sizes=(640x480 1920x1080)
10 status_avatar_offset_from_right=${STATUS_AVATAR_OFFSET:-34}
11 status_avatar_y=20
12 mkdir -p "$out_dir"
13
14 for window_size in "${sizes[@]}"; do
15 width=${window_size%x*}
16 height=${window_size#*x}
17 screen_size="$((width + 480))x$((height > 900 ? height : 900))"
18 focus=("mousemove $((width / 2)) 3" "click 1" "sleep 1.5")
19 captured=()
20 capture() {
21 local screen=$1
22 local target="$out_dir/$window_size-$screen.png"
23 shift
24 for attempt in 1 2 3; do
25 "$script_dir/headless-shot.sh" "$target" --size "$screen_size" --window "$window_size" --wait 15 --settle 3 -- "${focus[@]}" "$@" >/dev/null
26 local checksum
27 checksum=$(convert "$target" -crop "${width}x100+0+0" +repage png:- | md5sum)
28 [[ " ${captured[*]:-} " != *" $checksum "* ]] && break
29 echo "$target repeats an earlier screen, input dropped (attempt $attempt)" >&2
30 done
31 captured+=("$checksum")
32 }
33 capture chats
34 capture activity "key ctrl+1" "key ctrl+1"
35 capture channels "key ctrl+3" "key ctrl+3"
36 capture saved "key ctrl+4" "key ctrl+4"
37 capture calls "key ctrl+5" "key ctrl+5"
38 capture status-menu "mousemove $((width - status_avatar_offset_from_right)) $status_avatar_y" "click 1"
39 capture switcher "key ctrl+k"
40 capture shortcuts "key ctrl+period"
41 done
42
43 ls "$out_dir"/*.png
44 duplicates=$(for target in "$out_dir"/*.png; do
45 width=$(identify -format %w "$target")
46 echo "$(convert "$target" -crop "${width}x100+0+0" +repage png:- | md5sum | cut -c1-32) $target"
47 done | sort | uniq -D -w32)
48 [[ -z $duplicates ]] || { echo "identical screenshots, an input was dropped, rerun:" >&2; echo "$duplicates" >&2; exit 1; }
@@ -0,0 +1,48 @@
1#!/usr/bin/env bash
2# Usage: scripts/layout-sweep.sh [OUT_DIR]
3# Screenshots every main screen at the minimum and a large window size. Run `cargo build -p app` first.
4# Output: OUT_DIR/<size>-<screen>.png (default target/layout-sweep)
5set -euo pipefail
6
7out_dir=${1:-target/layout-sweep}
8script_dir=$(cd "$(dirname "$0")" && pwd)
9sizes=(640x480 1920x1080)
10status_avatar_offset_from_right=${STATUS_AVATAR_OFFSET:-34}
11status_avatar_y=20
12mkdir -p "$out_dir"
13
14for window_size in "${sizes[@]}"; do
15 width=${window_size%x*}
16 height=${window_size#*x}
17 screen_size="$((width + 480))x$((height > 900 ? height : 900))"
18 focus=("mousemove $((width / 2)) 3" "click 1" "sleep 1.5")
19 captured=()
20 capture() {
21 local screen=$1
22 local target="$out_dir/$window_size-$screen.png"
23 shift
24 for attempt in 1 2 3; do
25 "$script_dir/headless-shot.sh" "$target" --size "$screen_size" --window "$window_size" --wait 15 --settle 3 -- "${focus[@]}" "$@" >/dev/null
26 local checksum
27 checksum=$(convert "$target" -crop "${width}x100+0+0" +repage png:- | md5sum)
28 [[ " ${captured[*]:-} " != *" $checksum "* ]] && break
29 echo "$target repeats an earlier screen, input dropped (attempt $attempt)" >&2
30 done
31 captured+=("$checksum")
32 }
33 capture chats
34 capture activity "key ctrl+1" "key ctrl+1"
35 capture channels "key ctrl+3" "key ctrl+3"
36 capture saved "key ctrl+4" "key ctrl+4"
37 capture calls "key ctrl+5" "key ctrl+5"
38 capture status-menu "mousemove $((width - status_avatar_offset_from_right)) $status_avatar_y" "click 1"
39 capture switcher "key ctrl+k"
40 capture shortcuts "key ctrl+period"
41done
42
43ls "$out_dir"/*.png
44duplicates=$(for target in "$out_dir"/*.png; do
45 width=$(identify -format %w "$target")
46 echo "$(convert "$target" -crop "${width}x100+0+0" +repage png:- | md5sum | cut -c1-32) $target"
47done | sort | uniq -D -w32)
48[[ -z $duplicates ]] || { echo "identical screenshots, an input was dropped, rerun:" >&2; echo "$duplicates" >&2; exit 1; }
vendor/gpui-component/src/menu/popup_menu.rs +1 −0
@@ -1466,6 +1466,7 @@ impl Render for PopupMenu {
1466 1466
1467 1467 v_flex()
1468 1468 .id("popup-menu")
1469 .debug_selector(|| "popup-menu".into())
1469 1470 .test_support()
1470 1471 .role(Role::Menu)
1471 1472 .key_context(CONTEXT)
@@ -1466,6 +1466,7 @@ impl Render for PopupMenu {
1466
1466
1467 v_flex()
1467 v_flex()
1468 .id("popup-menu")
1468 .id("popup-menu")
1469 .debug_selector(|| "popup-menu".into())
1469 .test_support()
1470 .test_support()
1470 .role(Role::Menu)
1471 .role(Role::Menu)
1471 .key_context(CONTEXT)
1472 .key_context(CONTEXT)