Add Sidebar / Layout cards to appearance form

Below the appearance rows the Appearance form now exposes the design's
"Sidebar / Layout" section: serif "Layout" sub-headline plus a 2-up
preview-card grid wired to the active space's sidebar_width — Single
column lands on DEFAULT_SIDEBAR_WIDTH_PX, Compact lands on
COLLAPSED_SIDEBAR_WIDTH_PX. Each card draws a miniature sidebar +
canvas preview so the choice reads at a glance.

The shell exposes a new set_active_sidebar_width helper alongside the
existing toggle so the cards mutate state without re-implementing the
toggle logic. The "Hidden on hover" preset from the design is omitted
until that mode actually ships — no placeholder option.

The cards live in chrome::appearance_layout_cards so appearance_form
stays under 500 lines.
This commit is contained in:
2026-05-09 19:04:14 -04:00
parent a84db2a152
commit 20f3740089
4 changed files with 182 additions and 1 deletions
+14
View File
@@ -112,6 +112,20 @@ impl ElyShell {
}
}
pub(crate) fn set_active_sidebar_width(&mut self, width_px: u16, cx: &mut Context<Self>) {
let ShellState::Ready(core) = &mut self.state else {
return;
};
let active_space_id = match core.snapshot() {
Ok(snapshot) => snapshot.active_space_id,
Err(_) => return,
};
if core.set_space_sidebar_width(&active_space_id, width_px).is_ok() {
cx.notify();
}
}
fn render_compact_space_button(
&mut self,
index: usize,