S016: chrome and menus redesign: pill tabs on springs, address pill, toolbar badges, page card, floating flyouts

Tabs slide to their slots with a sliding selection pill and drag under the
pointer; the address field is a pill with a site chip, host emphasis and a
star that fills; flyouts and menus share one floating surface that springs
open and fades closed. Web page corners are masked over the GL blit.
tests/smoke/chrome.txt shoots the chrome and every flyout dark and light.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-11 20:11:33 -06:00
commit 6ee1409c9a
15 changed files with 1758 additions and 722 deletions

View file

@ -65,7 +65,7 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
| `nice cargo build --release -j 2` | compile check, produces `target/release/nacre` | now |
| `nice cargo test --release -j 2` | unit tests (38, ~16 s test-profile build then <1 s run; shares the S001 build) (util, settings, history, bookmarks, permissions, vault, dns, bridge loopback, download, adblock, keys, scripts, updates, inject, hub, theme, ui::widgets input, ui::paint) | first successful build; not alongside a build |
| `src/selftest.rs` | in-app self test: `NACRE_SCRIPT=<file>` runs script commands (listed at its top) | now |
| `tools/smoke.sh <script> [outdir]` | smoke run on a hidden Xvfb display with a throwaway home and software GL; outdir (default `target/smoke/<name>-<time>`) gets `nacre.log`, `selftest.log`, `<shot>.png`, `<status>.json`, `home/`; exits non-zero on crash, panic or no `status done`. Scripts in `tests/smoke/` (`launch.txt` offline, `https.txt` needs internet, `restore.txt` with `SMOKE_HOME=<launch outdir>/home`); header documents env vars and commands. Read the PNGs | now (S003) |
| `tools/smoke.sh <script> [outdir]` | smoke run on a hidden Xvfb display with a throwaway home and software GL; outdir (default `target/smoke/<name>-<time>`) gets `nacre.log`, `selftest.log`, `<shot>.png`, `<status>.json`, `home/`; exits non-zero on crash, panic or no `status done`. Scripts in `tests/smoke/` (`launch.txt` offline, `https.txt` needs internet, `restore.txt` with `SMOKE_HOME=<launch outdir>/home`, `chrome.txt` chrome and every flyout dark and light, offline); header documents env vars and commands. Read the PNGs | now (S003) |
| `nacre://gallery` + `SMOKE_SIZE=1400x2800 tools/smoke.sh tests/smoke/gallery.txt` | every design token and widget, dark and light (+ new tab and settings shots); read the PNGs | now (S015) |
| `python tools/icons.py` | rebuilds the icon font subset and `src/ui/icons.rs` from `tools/icons.txt` (needs fontTools and Arch's ttf-material-symbols-variable) | now (S015) |
| appimagetool, wine + Inno Setup, VM "Windows 10" | packaging and Windows checks | see the user's global CLAUDE.md "Building" |

View file

@ -13,15 +13,15 @@ Redesign the browser chrome per UI-BRIEF "Chrome seen in the video": one rounded
- `src/ui/chrome.rs`, `src/ui/menus.rs`
## Steps
- [ ] Toolbar and tab strip: pill tabs (active/hover/drag states, pinned, audio icon), + button, window card
- [ ] Address field: pill, suggestions dropdown restyled, star, site-info button, security state
- [ ] Right-side buttons and icon set (one consistent icon source; record it)
- [ ] Bookmarks bar with empty-state hint
- [ ] Page as a floating rounded card with margin; check the page blit honours the rounded corners or masks them
- [ ] Flyouts (main, downloads, shield, VPN, media, site info, profiles, apps, QR) and context menus in the new style with spring open/close
- [ ] Smoke shots of chrome and every flyout in light and dark; check by eye against the reference frames; fix
- [ ] Basics smoke scripts from S006 still pass
- [ ] PROGRESS entry, INDEX line, commit `S016: …` and push
- [x] Toolbar and tab strip: pill tabs (active/hover/drag states, pinned, audio icon), + button, window card
- [x] Address field: pill, suggestions dropdown restyled, star, site-info button, security state
- [x] Right-side buttons and icon set (one consistent icon source; record it)
- [x] Bookmarks bar with empty-state hint
- [x] Page as a floating rounded card with margin; check the page blit honours the rounded corners or masks them
- [x] Flyouts (main, downloads, shield, VPN, media, site info, profiles, apps, QR) and context menus in the new style with spring open/close
- [x] Smoke shots of chrome and every flyout in light and dark; check by eye against the reference frames; fix
- [x] Basics smoke scripts from S006 still pass
- [x] PROGRESS entry, INDEX line, commit `S016: …` and push
## End criteria
- Basics smoke scripts green.

View file

@ -26,7 +26,7 @@ Tracker: https://claude.ai/artifact/9AD7fPfwJ4ASFzVTJGKU4h
## 04 UI redesign
- [x] [S015 — Material You foundation](04%20UI%20redesign/S015-material-foundation.md) · Opus high
- [ ] [S016 — Chrome and menus redesign](04%20UI%20redesign/S016-ui-chrome.md) · Opus medium
- [x] [S016 — Chrome and menus redesign](04%20UI%20redesign/S016-ui-chrome.md) · Opus medium
- [ ] [S017 — New tab page: elements](04%20UI%20redesign/S017-ntp-elements.md) · Opus medium
- [ ] [S018 — New tab page: backgrounds and Customize](04%20UI%20redesign/S018-ntp-backgrounds.md) · Opus medium
- [ ] [S019 — Settings pages redesign](04%20UI%20redesign/S019-ui-settings.md) · Opus medium

View file

@ -220,6 +220,26 @@ while something plays), `shadow(painter, rect, radius, dark)` (one soft shadow f
a font family); shadows are tessellator-blurred rectangles only (not arbitrary shapes); `Ui::id`/`Id::new` are
deprecated in 0.37 but still used across the code.
**Chrome** (S016, `src/ui/chrome.rs`). Everything behind the chrome and around the page is `chrome::chrome_fill`
(`surface_container`); the page is a card with margin `GAP_S` (sides and bottom) and radius `L`. Web pages are
blitted as rectangles, so `ui::card_corners` paints a ring in the chrome colour over the corners (works over the GL
blit). Heights: tab strip 44 (tab pills 34, gap 4, width 76..240, pinned 44, +24 with an audio button), toolbar 52
(address pill 40), bookmarks bar 36 (chips 28), title bar 36, app bar 44; buttons inside tabs and the address field
are 24. Tabs slide to their slots with `DEFAULT` springs, the selection pill (secondary_container) slides between
them, a dragged tab stays under the pointer (`theme::spring_jump`) and the others make room (`drag_layout`); a
window resize jumps instead of sliding. Toolbar order: back, forward, reload, home, incognito | address | passwords,
history, bookmarks, downloads, qr, apps, devtools, pip, screenshot, adblock, media, vpn, profile, menu (each shown
per the toolbar setting). Status on buttons: badges (blocked count, running downloads), a progress ring round
downloads, a coloured dot on the VPN, a slash through the shield when off. All icons are Material Symbols (D-009).
**Floating surfaces** (`src/ui/menus.rs`). `menus::floating(ctx, id, pos, pivot, open, |ui| ..)` draws a
`menus::surface` (surface_container_high, radius `L`, popup shadow) that grows from its pivot corner (scale 0.9 to
1, `DEFAULT`) and fades in (`EFFECT`); with `open` false it shrinks and fades without input, then returns None.
Flyouts keep the last one drawn so it animates out; switching flyouts closes one while the other opens. Rows:
`menu_item(ui, icon, label, trailing, selected)` (34 high, icon column, label cut with an ellipsis, shortcut or
detail on the right), `divider`, `empty`, `one_line` (text cut to a width). egui popups (`Popup::menu`, submenus)
use the same `surface` frame. Areas need `default_size` set or egui caps them at 600×400.
## Feature checklist
See `docs/FEATURES.md`; every row names the file that implements it and its review state.

View file

@ -68,6 +68,22 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
- Later: chrome toolbar glyphs still drawn at text size via egui Buttons (S016); `egui::Ui::id`/`Id::new`
deprecation warnings across src/ui.
## S016 — Chrome and menus redesign (2026-11-11)
- Done: chrome.rs rewritten: pill tabs on springs (selection pill slides, drag under the pointer, others make room),
round +, 52 pt toolbar of icon buttons with badges/progress ring/VPN dot, address pill (site chip, "Not secure",
host emphasis, zoom/install chips, star that fills), suggestions as a floating menu, bookmarks bar chips + empty
hint, page as a rounded card (corners masked over the GL blit). menus.rs: `floating` (spring open/close), `menu_item`;
every flyout and the page menu restyled (wavy download/seek bars, cookie artwork with dot visualizer, morphing play).
Measurements: DESIGN.md "Chrome". Main menu: Save page/PDF/QR/Install/Shortcut moved into "Save and share".
- Shots: `tools/smoke.sh tests/smoke/chrome.txt` (target/smoke/s016f-chrome): chrome-dark/light, main(-opening)-dark,
main-light, downloads, shield, vpn, siteinfo, qr, tabmenu (dark+light), media(-playing), profiles, apps, back,
bookmark, suggest-dark, narrow-light. selftest: `flyout tabmenu|back|bookmark`, `type <text>`.
- Verified: chrome, launch, restore, painters, gallery smoke exit 0; 40 unit tests (+drag_layout, address_job).
- Not done/seen: S006 basics scripts don't exist yet (ran the four above instead); page right-click menu, hover,
press and a live tab drag not in screenshots (no pointer in selftest for chrome); no real-GPU check.
- egui limits hit: Area capped at 600×400 unless `default_size`; Xvfb never focuses the window, so text focus drops
(selftest `type` sends Focused(true)); stale TextEdit selection shows after focus leaves (cleared by hand).
## Later
- Reader mode, split view, translate, real gamepad rumble (D-002: not planned for now).
- Packaging and first release (D-001: plan when the user asks).

View file

@ -9,7 +9,9 @@
//! resize <w> <h> resize the window (logical pixels)
//! status <name> save tabs, downloads, VPN, ad blocker and so on as <name>.json
//! set <json pointer> <json> change a setting, e.g. `set /privacy/https_only true`
//! flyout <name> main, downloads, shield, vpn, media, siteinfo, profiles, apps, qr, none
//! flyout <name> main, downloads, shield, vpn, media, siteinfo, profiles, apps, qr, tabmenu, back,
//! bookmark (edit the current page's bookmark), none
//! type <text> put text in the address bar with its suggestions open
//! do <action> a shortcut action by its settings key, e.g. `do new_tab`
//! cmd <name> [arg] back, forward, reload, bookmark, install_app, pip, exitpip, free_memory,
//! update_lists, check_updates, close_tab, select <n>, zoom <step>,
@ -173,6 +175,8 @@ impl App {
},
"flyout" => {
let url = self.windows.get(&window).and_then(|w| w.tab()).map(|t| t.url.clone()).unwrap_or_default();
let tab = self.windows.get(&window).and_then(|w| w.tab()).map(|t| t.id).unwrap_or(0);
let at = egui::pos2(80.0, 40.0);
let flyout = match rest {
"main" => Some(Flyout::Main),
"downloads" => Some(Flyout::Downloads),
@ -183,6 +187,9 @@ impl App {
"profiles" => Some(Flyout::Profiles),
"apps" => Some(Flyout::Apps),
"qr" => Some(Flyout::Qr(url)),
"tabmenu" => Some(Flyout::TabMenu(tab, at)),
"back" => Some(Flyout::BackHistory(at)),
"bookmark" => Some(Flyout::EditBookmark(url)),
_ => None,
};
if let Some(win) = self.windows.get_mut(&window) {
@ -259,6 +266,17 @@ impl App {
win.send_mouse_button(winit::event::ElementState::Released, winit::event::MouseButton::Left);
}
},
"type" => {
// Type into the address bar as if the user did: focus, text, suggestions.
if let Some(win) = self.windows.get_mut(&window) {
// Xvfb has no window manager, so the window never gets focus and egui would drop text focus.
let _ = win.egui.on_window_event(&win.window, &winit::event::WindowEvent::Focused(true));
win.ui.focus_omnibox = true;
win.ui.omnibox_edit = Some(rest.to_owned());
win.ui.omnibox_query.clear();
}
self.redraw(window);
},
"log" => self.selftest_log(rest),
"quit" => self.quit(),
_ => self.selftest_log(&format!("unknown line: {line}")),

View file

@ -465,6 +465,13 @@ pub fn spring(ctx: &Context, id: Id, target: f32, spring: Spring) -> f32 {
value
}
/// Puts a spring at `value`, at rest: for things that follow the pointer (a dragged tab) and spring from there once
/// let go, or that must not animate (a window resize).
pub fn spring_jump(ctx: &Context, id: Id, value: f32) {
let frame = ctx.cumulative_frame_nr();
ctx.data_mut(|d| d.insert_temp(id, SpringState { value, velocity: 0.0, frame }));
}
/// A 0..1 value for an on/off state with the `EFFECT` spring: hover and selection tints, fades.
pub fn effect(ctx: &Context, id: Id, on: bool) -> f32 {
spring(ctx, id, if on { 1.0 } else { 0.0 }, EFFECT).clamp(0.0, 1.0)

File diff suppressed because it is too large Load diff

View file

@ -140,6 +140,14 @@ pub const RAINY: &str = "\u{f176}";
pub const WEATHER_SNOWY: &str = "\u{e2cd}";
pub const THUNDERSTORM: &str = "\u{ebdb}";
pub const FOGGY: &str = "\u{e818}";
pub const SAVE: &str = "\u{e161}";
pub const FIND_IN_PAGE: &str = "\u{e880}";
pub const POWER_SETTINGS_NEW: &str = "\u{f8c7}";
pub const NEW_WINDOW: &str = "\u{f710}";
pub const WEB: &str = "\u{e051}";
pub const CONTENT_CUT: &str = "\u{e14e}";
pub const CONTENT_PASTE: &str = "\u{e14f}";
pub const SELECT_ALL: &str = "\u{e162}";
/// Every icon with its name, for the gallery.
pub const ALL: &[(&str, &str)] = &[
@ -282,4 +290,12 @@ pub const ALL: &[(&str, &str)] = &[
("weather_snowy", WEATHER_SNOWY),
("thunderstorm", THUNDERSTORM),
("foggy", FOGGY),
("save", SAVE),
("find_in_page", FIND_IN_PAGE),
("power_settings_new", POWER_SETTINGS_NEW),
("new_window", NEW_WINDOW),
("web", WEB),
("content_cut", CONTENT_CUT),
("content_paste", CONTENT_PASTE),
("select_all", SELECT_ALL),
];

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
//! The browser interface, drawn with egui. Plain on purpose for now: everything works, the
//! designed look comes later. Drawing code reads the shared stores, may edit simple things
//! (settings, bookmarks, history) directly, and asks the app for everything else with `Command`s.
//! The browser interface, drawn with egui from the theme tokens (docs/DESIGN.md "UI system"). Drawing code reads
//! the shared stores, may edit simple things (settings, bookmarks, history) directly, and asks the app for
//! everything else with `Command`s.
pub mod chrome;
pub mod dialogs;
@ -188,7 +188,10 @@ pub fn draw(root: &mut egui::Ui, f: &mut Frame) {
dialogs::find_bar(root, f);
}
let floating = f.shared.settings.borrow().ui.floating_card && !page_fullscreen && !app_window;
let frame = egui::Frame::NONE.inner_margin(if floating { egui::Margin::symmetric(8, 6) } else { egui::Margin::ZERO });
// The page floats as a rounded card with a margin, on the chrome's colour.
let gap = crate::theme::GAP_S as i8;
let margin = if floating { egui::Margin { left: gap, right: gap, top: 0, bottom: gap } } else { egui::Margin::ZERO };
let frame = egui::Frame::NONE.fill(chrome::chrome_fill(&f.palette())).inner_margin(margin);
egui::CentralPanel::no_frame().frame(frame).show(root, |ui| page_area(ui, f, floating));
dialogs::page_dialogs(&ctx, f);
menus::flyouts(&ctx, f);
@ -197,6 +200,22 @@ pub fn draw(root: &mut egui::Ui, f: &mut Frame) {
/// The page itself: a web page's framebuffer, or one of Nacre's pages.
fn page_area(ui: &mut egui::Ui, f: &mut Frame, floating: bool) {
let rect = ui.max_rect();
page_contents(ui, f);
if floating {
card_corners(ui, rect, f.palette());
}
}
/// Rounds the page card's corners. The web page is a framebuffer blitted as a rectangle, so the corners are masked
/// afterwards with a ring in the chrome colour whose inner edge is the card's rounded outline.
fn card_corners(ui: &egui::Ui, rect: egui::Rect, p: Palette) {
let radius = crate::theme::radius(ui.ctx(), crate::theme::L);
let painter = ui.painter().with_clip_rect(rect);
painter.rect_stroke(rect.expand(radius), egui::CornerRadius::same((radius * 2.0).round().min(255.0) as u8), egui::Stroke::new(radius, chrome::chrome_fill(&p)), egui::StrokeKind::Inside);
}
fn page_contents(ui: &mut egui::Ui, f: &mut Frame) {
let rect = ui.max_rect();
let Some(tab) = f.tabs.get(*f.active) else {
*f.page_rect = None;
@ -204,7 +223,7 @@ fn page_area(ui: &mut egui::Ui, f: &mut Frame, floating: bool) {
};
if let Some(page) = tab.page.clone() {
*f.page_rect = None;
egui::Frame::NONE.fill(f.palette().surface_low).corner_radius(if floating { crate::theme::corner(&f.shared.settings.borrow()) } else { 0 }).show(ui, |ui| {
egui::Frame::NONE.fill(f.palette().surface_low).show(ui, |ui| {
ui.set_min_size(rect.size());
pages::draw(ui, f, &page);
});

View file

@ -7,14 +7,14 @@ use super::icons;
use crate::theme::{self, Palette, Weight};
/// How a control looks while the pointer and keyboard work on it, each 0..1 and animated.
struct Interaction {
hover: f32,
press: f32,
focus: bool,
enabled: bool,
pub struct Interaction {
pub hover: f32,
pub press: f32,
pub focus: bool,
pub enabled: bool,
}
fn interaction(ui: &Ui, response: &Response) -> Interaction {
pub fn interaction(ui: &Ui, response: &Response) -> Interaction {
let ctx = ui.ctx();
let enabled = response.enabled();
let hover = theme::effect(ctx, response.id.with("hover"), enabled && response.hovered());
@ -24,17 +24,17 @@ fn interaction(ui: &Ui, response: &Response) -> Interaction {
impl Interaction {
/// The state layer: the content colour over the container.
fn layer(&self, container: Color32, content: Color32) -> Color32 {
pub fn layer(&self, container: Color32, content: Color32) -> Color32 {
theme::layer(container, content, self.amount())
}
/// State layer opacity.
fn amount(&self) -> f32 {
pub fn amount(&self) -> f32 {
theme::HOVER * self.hover + theme::PRESS * self.press.clamp(0.0, 1.0)
}
}
fn focus_ring(ui: &Ui, rect: Rect, radius: f32, p: &Palette) {
pub fn focus_ring(ui: &Ui, rect: Rect, radius: f32, p: &Palette) {
ui.painter().rect_stroke(rect.expand(2.0), theme::corner_radius(radius + 2.0), Stroke::new(2.0, p.secondary), StrokeKind::Outside);
}

100
tests/smoke/chrome.txt Normal file
View file

@ -0,0 +1,100 @@
# Browser chrome (S016) in dark and light: tab strip, toolbar, address field, bookmarks bar, page card and every
# flyout. Offline. Run with tools/smoke.sh; read the PNGs.
wait 3
set /theme/mode "dark"
page nacre://newtab
newtab @PAGES@/hello.html
waitload 30
newtab @PAGES@/color.html
waitload 30
cmd pin
cmd select 3
set /ui/bookmarks_bar "always"
wait 1
shot chrome-dark
flyout main
wait 0.04
shot main-opening-dark
wait 1
shot main-dark
flyout downloads
wait 1
shot downloads-dark
flyout shield
wait 1
shot shield-dark
flyout vpn
wait 1
shot vpn-dark
flyout media
wait 1
shot media-dark
flyout siteinfo
wait 1
shot siteinfo-dark
flyout profiles
wait 1
shot profiles-dark
flyout apps
wait 1
shot apps-dark
flyout qr
wait 1
shot qr-dark
flyout tabmenu
wait 1
shot tabmenu-dark
flyout back
wait 1
shot back-dark
flyout none
cmd bookmark
wait 1
flyout bookmark
wait 1
shot bookmark-dark
flyout none
type hel
wait 1
shot suggest-dark
flyout none
newtab @PAGES@/video.html
waitload 30
wait 2
cmd mute
wait 1
flyout media
wait 1
shot media-playing-dark
flyout none
cmd select 3
set /theme/mode "light"
wait 1
shot chrome-light
flyout main
wait 1
shot main-light
flyout downloads
wait 1
shot downloads-light
flyout shield
wait 1
shot shield-light
flyout vpn
wait 1
shot vpn-light
flyout siteinfo
wait 1
shot siteinfo-light
flyout qr
wait 1
shot qr-light
flyout tabmenu
wait 1
shot tabmenu-light
flyout none
resize 760 600
wait 1
shot narrow-light
status done
quit

View file

@ -146,3 +146,11 @@ rainy
weather_snowy
thunderstorm
foggy
save
find_in_page
power_settings_new
new_window
web
content_cut
content_paste
select_all