diff --git a/CLAUDE.md b/CLAUDE.md index 4aca2e3..576ef07 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -82,7 +82,7 @@ Never modify: `PROMPT.md` (the user's brief), the reference app checkout (`/home | `cargo clippy --workspace --all-targets -- -D warnings`, `cargo fmt --check` | lint, format | phase 1 | | `busctl --user call org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings ReadOne ss org.freedesktop.appearance accent-color` | inspect portal values | now | | `fc-list` | check bundled/system fonts | now | -| Screenshot harness (software renderer → PNG, light/dark, hover/press, empty/full, min size) | visual checks | phase 2 (plan adds its exact command here) | +| `cargo run -p tunal -- --screenshot [--dark] [--size WxH]` (software renderer, offscreen, default 960x640; env `TUNAL_SEED=#rrggbb`, `TUNAL_REDUCED_MOTION=1`) | single-PNG visual check; full state matrix in phase 12 | S003 | Don't assume a tool exists: check first. When your plan creates a tool, add its row here. diff --git a/Cargo.lock b/Cargo.lock index fd65b39..b087f5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4553,8 +4553,10 @@ checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" name = "tunal" version = "0.1.0" dependencies = [ + "png", "slint", "slint-build", + "tunal-theme", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 17faf2c..4006779 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,4 @@ slint = "1.19" slint-build = "1.19" zbus = { version = "5.19", default-features = false, features = ["async-io", "blocking-api"] } material-colors = "0.5" +png = "0.18" diff --git a/Plans/02 App skeleton/S003-window-tokens.md b/Plans/02 App skeleton/S003-window-tokens.md index 1a39248..f535ad4 100644 --- a/Plans/02 App skeleton/S003-window-tokens.md +++ b/Plans/02 App skeleton/S003-window-tokens.md @@ -10,13 +10,13 @@ The app window themed from the portal with live re-theme, the `Theme` and `Motio CLAUDE.md §2 Theme/Icons/Motion rules, §3, §4; `app-taste` skill; crates/tunal-theme public API. ## Steps -- [ ] `build.rs` with `slint-build`, std-widgets style `material`; import the bundled Material Symbols font in Slint. -- [ ] `Theme` global: colour roles, shape (corner radii xs…xl, full), type scale, spacing grid (4 px), state-layer opacities. `Motion` global: M3 durations and easings, `reduced` flag; a helper so durations become 0 when reduced. -- [ ] Theme bridge: apply the palette at start; watcher → `invoke_from_event_loop` → update `Theme`; env overrides `TUNAL_SEED=#rrggbb`, `TUNAL_SCHEME=light|dark`, `TUNAL_REDUCED_MOTION=1` for agents. -- [ ] `Icon` component: glyph by codepoint, size, weight, fill (check which variable axes Slint 1.19 can set; fall back to the default instance). -- [ ] Window: title, `assets/tunal.png` icon, minimum size (choose and record in DECISIONS.md), placeholder layout (sidebar + content). -- [ ] `tunal --screenshot [--dark] [--size WxH]`: render offscreen with the software renderer to PNG and exit. Add its row to CLAUDE.md §5 (single PNG; the full state matrix comes in phase 12). -- [ ] PROGRESS entry, INDEX line, commit `S003: …` +- [x] `build.rs` with `slint-build`, std-widgets style `material`; import the bundled Material Symbols font in Slint. +- [x] `Theme` global: colour roles, shape (corner radii xs…xl, full), type scale, spacing grid (4 px), state-layer opacities. `Motion` global: M3 durations and easings, `reduced` flag; a helper so durations become 0 when reduced. +- [x] Theme bridge: apply the palette at start; watcher → `invoke_from_event_loop` → update `Theme`; env overrides `TUNAL_SEED=#rrggbb`, `TUNAL_SCHEME=light|dark`, `TUNAL_REDUCED_MOTION=1` for agents. +- [x] `Icon` component: glyph by codepoint, size, weight, fill (check which variable axes Slint 1.19 can set; fall back to the default instance). +- [x] Window: title, `assets/tunal.png` icon, minimum size (choose and record in DECISIONS.md), placeholder layout (sidebar + content). +- [x] `tunal --screenshot [--dark] [--size WxH]`: render offscreen with the software renderer to PNG and exit. Add its row to CLAUDE.md §5 (single PNG; the full state matrix comes in phase 12). +- [x] PROGRESS entry, INDEX line, commit `S003: …` ## End criteria - `cargo build --workspace`, `cargo clippy --workspace --all-targets -- -D warnings` and `cargo fmt --check` pass. diff --git a/Plans/INDEX.md b/Plans/INDEX.md index a9285a8..91b35bf 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -11,7 +11,7 @@ Tracker: https://claude.ai/artifact/4X8YCk3cQjUGyuyCqGuU7v ## 02 App skeleton - [x] [S002 — Portal theme and Material schemes](02%20App%20skeleton/S002-theme-portal.md) · Opus high -- [ ] [S003 — Window, Theme and Motion globals, screenshot command](02%20App%20skeleton/S003-window-tokens.md) · Opus high +- [x] [S003 — Window, Theme and Motion globals, screenshot command](02%20App%20skeleton/S003-window-tokens.md) · Opus high - [ ] [S004 — Base animated controls](02%20App%20skeleton/S004-base-controls.md) · Opus high - [ ] [S005 — Menus, dialogs and toasts](02%20App%20skeleton/S005-menus-dialogs.md) · Opus high diff --git a/crates/tunal/Cargo.toml b/crates/tunal/Cargo.toml index e2b0af6..d795fba 100644 --- a/crates/tunal/Cargo.toml +++ b/crates/tunal/Cargo.toml @@ -7,6 +7,8 @@ publish.workspace = true [dependencies] slint.workspace = true +tunal-theme = { path = "../tunal-theme" } +png.workspace = true [build-dependencies] slint-build.workspace = true diff --git a/crates/tunal/build.rs b/crates/tunal/build.rs index fbaf7a2..b44f417 100644 --- a/crates/tunal/build.rs +++ b/crates/tunal/build.rs @@ -1,3 +1,5 @@ fn main() { - slint_build::compile("ui/main.slint").expect("failed to compile the Slint UI"); + let config = slint_build::CompilerConfiguration::new().with_style("material".into()); + slint_build::compile_with_config("ui/app.slint", config) + .expect("failed to compile the Slint UI"); } diff --git a/crates/tunal/src/main.rs b/crates/tunal/src/main.rs index 0c0230a..fcb3df4 100644 --- a/crates/tunal/src/main.rs +++ b/crates/tunal/src/main.rs @@ -1,7 +1,58 @@ +mod screenshot; +mod theme_bridge; + +use std::process::ExitCode; + use slint::ComponentHandle; slint::include_modules!(); -fn main() -> Result<(), slint::PlatformError> { - MainWindow::new()?.run() +const USAGE: &str = "usage: tunal [--screenshot [--dark] [--size WxH]]"; + +fn main() -> ExitCode { + let args: Vec = std::env::args().skip(1).collect(); + let result = if args.is_empty() { + run().map_err(|e| e.to_string()) + } else { + parse_screenshot(&args).and_then(screenshot::run) + }; + match result { + Ok(()) => ExitCode::SUCCESS, + Err(message) => { + eprintln!("tunal: {message}"); + ExitCode::FAILURE + } + } +} + +fn run() -> Result<(), slint::PlatformError> { + let ui = MainWindow::new()?; + theme_bridge::start(&ui, theme_bridge::Overrides::from_env()); + ui.run() +} + +fn parse_screenshot(args: &[String]) -> Result { + let mut options = screenshot::Options { + path: String::new(), + dark: false, + size: (960, 640), + }; + let mut args = args.iter(); + while let Some(arg) = args.next() { + match arg.as_str() { + "--screenshot" => options.path = args.next().ok_or(USAGE)?.clone(), + "--dark" => options.dark = true, + "--size" => { + let size = args.next().ok_or(USAGE)?; + let (w, h) = size.split_once('x').ok_or(USAGE)?; + let parse = |n: &str| n.parse::().ok().filter(|&n| n > 0).ok_or(USAGE); + options.size = (parse(w)?, parse(h)?); + } + _ => return Err(USAGE.into()), + } + } + if options.path.is_empty() { + return Err(USAGE.into()); + } + Ok(options) } diff --git a/crates/tunal/src/screenshot.rs b/crates/tunal/src/screenshot.rs new file mode 100644 index 0000000..653f8a5 --- /dev/null +++ b/crates/tunal/src/screenshot.rs @@ -0,0 +1,73 @@ +//! `tunal --screenshot`: renders the window offscreen with the software renderer to a PNG. + +use std::{fs::File, io::BufWriter, path::Path, rc::Rc}; + +use slint::{ + ComponentHandle, PhysicalSize, + platform::{ + Platform, PlatformError, WindowAdapter, + software_renderer::{MinimalSoftwareWindow, PremultipliedRgbaColor, RepaintBufferType}, + }, +}; +use tunal_theme::ColorScheme; + +use crate::{ + MainWindow, + theme_bridge::{self, Overrides}, +}; + +struct Offscreen(Rc); + +impl Platform for Offscreen { + fn create_window_adapter(&self) -> Result, PlatformError> { + Ok(self.0.clone()) + } +} + +pub struct Options { + pub path: String, + pub dark: bool, + pub size: (u32, u32), +} + +pub fn run(options: Options) -> Result<(), String> { + let window = MinimalSoftwareWindow::new(RepaintBufferType::NewBuffer); + slint::platform::set_platform(Box::new(Offscreen(window.clone()))) + .map_err(|e| e.to_string())?; + let ui = MainWindow::new().map_err(|e| e.to_string())?; + let scheme = if options.dark { + ColorScheme::Dark + } else { + ColorScheme::Light + }; + let overrides = Overrides { + scheme: Some(scheme), + ..Overrides::from_env() + }; + theme_bridge::apply(&ui, &tunal_theme::read(), overrides); + + let (width, height) = options.size; + window.set_size(PhysicalSize::new(width, height)); + ui.show().map_err(|e| e.to_string())?; + let mut pixels = vec![PremultipliedRgbaColor::default(); (width * height) as usize]; + window.request_redraw(); + window.draw_if_needed(|renderer| { + renderer.render(&mut pixels, width as usize); + }); + ui.hide().map_err(|e| e.to_string())?; + + // The window background is opaque, so premultiplied equals straight alpha here. + let bytes: Vec = pixels + .iter() + .flat_map(|p| [p.red, p.green, p.blue, p.alpha]) + .collect(); + write_png(Path::new(&options.path), width, height, &bytes) + .map_err(|e| format!("couldn't write {}: {e}", options.path)) +} + +fn write_png(path: &Path, width: u32, height: u32, rgba: &[u8]) -> Result<(), png::EncodingError> { + let mut encoder = png::Encoder::new(BufWriter::new(File::create(path)?), width, height); + encoder.set_color(png::ColorType::Rgba); + encoder.set_depth(png::BitDepth::Eight); + encoder.write_header()?.write_image_data(rgba) +} diff --git a/crates/tunal/src/theme_bridge.rs b/crates/tunal/src/theme_bridge.rs new file mode 100644 index 0000000..e06e21b --- /dev/null +++ b/crates/tunal/src/theme_bridge.rs @@ -0,0 +1,113 @@ +//! Feeds the desktop appearance (and agent overrides) into the Slint `Theme` and `MotionPrefs`. + +use slint::{Color, ComponentHandle}; +use tunal_theme::{Appearance, ColorScheme, Palette, Palettes}; + +use crate::{MainWindow, MotionPrefs, Theme}; + +/// Overrides for agents and screenshots: `TUNAL_SEED=#rrggbb`, `TUNAL_SCHEME=light|dark`, +/// `TUNAL_REDUCED_MOTION=1`. Unset or invalid values leave the portal value in place. +#[derive(Debug, Clone, Copy, Default)] +pub struct Overrides { + pub seed: Option, + pub scheme: Option, + pub reduced_motion: bool, +} + +impl Overrides { + pub fn from_env() -> Self { + let var = |name| std::env::var(name).ok().filter(|v: &String| !v.is_empty()); + let seed = var("TUNAL_SEED").and_then(|v| { + let hex = v.strip_prefix('#').filter(|h| h.len() == 6); + let seed = hex.and_then(|h| u32::from_str_radix(h, 16).ok()); + if seed.is_none() { + eprintln!("tunal: ignoring TUNAL_SEED={v:?}, expected #rrggbb"); + } + seed + }); + let scheme = var("TUNAL_SCHEME").and_then(|v| match v.as_str() { + "light" => Some(ColorScheme::Light), + "dark" => Some(ColorScheme::Dark), + _ => { + eprintln!("tunal: ignoring TUNAL_SCHEME={v:?}, expected light or dark"); + None + } + }); + let reduced_motion = var("TUNAL_REDUCED_MOTION").is_some_and(|v| v == "1"); + Self { + seed, + scheme, + reduced_motion, + } + } +} + +/// Reads the portal, applies it, and keeps the UI in step with later changes. +pub fn start(ui: &MainWindow, overrides: Overrides) { + apply(ui, &tunal_theme::read(), overrides); + let weak = ui.as_weak(); + tunal_theme::watch(move |appearance| { + // Fails only once the event loop has quit; nothing left to theme then. + let _ = weak.upgrade_in_event_loop(move |ui| apply(&ui, &appearance, overrides)); + }); +} + +pub fn apply(ui: &MainWindow, appearance: &Appearance, overrides: Overrides) { + let seed = overrides.seed.unwrap_or_else(|| appearance.seed()); + let scheme = overrides.scheme.unwrap_or(appearance.scheme); + let palettes = Palettes::from_seed(seed); + let palette = match scheme { + ColorScheme::Light => palettes.light, + ColorScheme::Dark => palettes.dark, + }; + let theme = ui.global::(); + theme.set_dark(scheme == ColorScheme::Dark); + set_colors(&theme, &palette); + let reduced = overrides.reduced_motion || appearance.animations == Some(false); + ui.global::().set_reduced(reduced); +} + +macro_rules! colors { + ($($role:ident: $setter:ident),* $(,)?) => { + fn set_colors(theme: &Theme, palette: &Palette) { + $(theme.$setter(Color::from_argb_encoded(palette.$role));)* + } + }; +} + +colors!( + primary: set_primary, + on_primary: set_on_primary, + primary_container: set_primary_container, + on_primary_container: set_on_primary_container, + inverse_primary: set_inverse_primary, + secondary: set_secondary, + on_secondary: set_on_secondary, + secondary_container: set_secondary_container, + on_secondary_container: set_on_secondary_container, + tertiary: set_tertiary, + on_tertiary: set_on_tertiary, + tertiary_container: set_tertiary_container, + on_tertiary_container: set_on_tertiary_container, + error: set_error, + on_error: set_on_error, + error_container: set_error_container, + on_error_container: set_on_error_container, + surface: set_surface, + surface_dim: set_surface_dim, + surface_bright: set_surface_bright, + surface_container_lowest: set_surface_container_lowest, + surface_container_low: set_surface_container_low, + surface_container: set_surface_container, + surface_container_high: set_surface_container_high, + surface_container_highest: set_surface_container_highest, + on_surface: set_on_surface, + surface_variant: set_surface_variant, + on_surface_variant: set_on_surface_variant, + inverse_surface: set_inverse_surface, + inverse_on_surface: set_inverse_on_surface, + outline: set_outline, + outline_variant: set_outline_variant, + shadow: set_shadow, + scrim: set_scrim, +); diff --git a/crates/tunal/ui/app.slint b/crates/tunal/ui/app.slint new file mode 100644 index 0000000..9f560e1 --- /dev/null +++ b/crates/tunal/ui/app.slint @@ -0,0 +1,83 @@ +import "../../../assets/fonts/MaterialSymbolsRounded[FILL,GRAD,opsz,wght].ttf"; +import { Theme } from "theme.slint"; +import { Motion, MotionPrefs } from "motion.slint"; +import { Icon, Icons } from "components/icon.slint"; + +export { Theme, MotionPrefs } + +// Placeholder shell (sidebar + content) until the views land. +export component MainWindow inherits Window { + title: "Tunal"; + icon: @image-url("../../../assets/tunal.png"); + min-width: 720px; + min-height: 480px; + preferred-width: 960px; + preferred-height: 640px; + background: Theme.surface; + animate background { duration: Motion.time(Motion.medium2); easing: Motion.standard; } + + HorizontalLayout { + sidebar := Rectangle { + width: 240px; + background: Theme.surface-container-low; + animate background { duration: Motion.time(Motion.medium2); easing: Motion.standard; } + + VerticalLayout { + padding: Theme.space-3; + spacing: Theme.space-1; + alignment: start; + + HorizontalLayout { + padding-left: Theme.space-4; + padding-right: Theme.space-4; + height: 40px; + spacing: Theme.space-3; + + VerticalLayout { + alignment: center; + Icon { glyph: Icons.home; } + } + + Text { + text: "Home"; + color: Theme.on-surface; + font-size: Theme.label-large.size; + font-weight: Theme.label-large.weight; + vertical-alignment: center; + } + } + } + } + + Rectangle { + VerticalLayout { + alignment: center; + spacing: Theme.space-2; + + HorizontalLayout { + alignment: center; + Icon { + glyph: Icons.folder; + size: 48px; + } + } + + Text { + text: "No folder open"; + color: Theme.on-surface; + font-size: Theme.title-medium.size; + font-weight: Theme.title-medium.weight; + horizontal-alignment: center; + } + + Text { + text: "Folders you open appear here"; + color: Theme.on-surface-variant; + font-size: Theme.body-medium.size; + font-weight: Theme.body-medium.weight; + horizontal-alignment: center; + } + } + } + } +} diff --git a/crates/tunal/ui/components/icon.slint b/crates/tunal/ui/components/icon.slint new file mode 100644 index 0000000..e02adc7 --- /dev/null +++ b/crates/tunal/ui/components/icon.slint @@ -0,0 +1,26 @@ +import { Theme } from "../theme.slint"; + +// A Material Symbols Rounded glyph. Slint 1.19 exposes no variation axes and font-weight +// does not reach the font's wght axis, so every glyph is the default instance +// (wght 400, FILL 0, GRAD 0, opsz 24). +export component Icon inherits Text { + // The glyph as a one-character string, e.g. "\u{e2c7}" (see Icons). + in property glyph; + in property size: 24px; + + text: glyph; + font-family: Theme.icon-font; + font-size: size; + color: Theme.on-surface-variant; + width: size; + height: size; + horizontal-alignment: center; + vertical-alignment: center; + accessible-role: none; +} + +// Codepoints of the glyphs in use. +export global Icons { + out property folder: "\u{e2c7}"; + out property home: "\u{e88a}"; +} diff --git a/crates/tunal/ui/main.slint b/crates/tunal/ui/main.slint deleted file mode 100644 index b2e7811..0000000 --- a/crates/tunal/ui/main.slint +++ /dev/null @@ -1,6 +0,0 @@ -export component MainWindow inherits Window { - title: "Tunal"; - icon: @image-url("../../../assets/tunal.png"); - preferred-width: 960px; - preferred-height: 640px; -} diff --git a/crates/tunal/ui/motion.slint b/crates/tunal/ui/motion.slint new file mode 100644 index 0000000..b974906 --- /dev/null +++ b/crates/tunal/ui/motion.slint @@ -0,0 +1,37 @@ +// Motion tokens: Material 3 durations and easings. Wrap every duration in `Motion.time()` +// so reduced motion makes it instant. + +// The flag Rust sets (portal enable-animations, or TUNAL_REDUCED_MOTION=1). Kept apart from +// Motion because easing properties can't be exported to Rust. +export global MotionPrefs { + in property reduced; +} + +export global Motion { + out property reduced: MotionPrefs.reduced; + + out property short1: 50ms; + out property short2: 100ms; + out property short3: 150ms; + out property short4: 200ms; + out property medium1: 250ms; + out property medium2: 300ms; + out property medium3: 350ms; + out property medium4: 400ms; + out property long1: 450ms; + out property long2: 500ms; + out property long3: 550ms; + out property long4: 600ms; + + // Emphasized is a two-segment path in M3; this is its usual single-bezier stand-in. + out property emphasized: cubic-bezier(0.2, 0, 0, 1); + out property emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1); + out property emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15); + out property standard: cubic-bezier(0.2, 0, 0, 1); + out property standard-decelerate: cubic-bezier(0, 0, 0, 1); + out property standard-accelerate: cubic-bezier(0.3, 0, 1, 1); + + public pure function time(d: duration) -> duration { + reduced ? 0ms : d + } +} diff --git a/crates/tunal/ui/theme.slint b/crates/tunal/ui/theme.slint new file mode 100644 index 0000000..81c25f8 --- /dev/null +++ b/crates/tunal/ui/theme.slint @@ -0,0 +1,87 @@ +// Design tokens. Colours are set from Rust (theme_bridge.rs); everything else is fixed. + +export struct TypeStyle { + size: length, + weight: int, + line-height: length, +} + +export global Theme { + in-out property dark; + + // Material 3 colour roles (tonal spot scheme from the portal accent). + in-out property primary; + in-out property on-primary; + in-out property primary-container; + in-out property on-primary-container; + in-out property inverse-primary; + in-out property secondary; + in-out property on-secondary; + in-out property secondary-container; + in-out property on-secondary-container; + in-out property tertiary; + in-out property on-tertiary; + in-out property tertiary-container; + in-out property on-tertiary-container; + in-out property error; + in-out property on-error; + in-out property error-container; + in-out property on-error-container; + in-out property surface; + in-out property surface-dim; + in-out property surface-bright; + in-out property surface-container-lowest; + in-out property surface-container-low; + in-out property surface-container; + in-out property surface-container-high; + in-out property surface-container-highest; + in-out property on-surface; + in-out property surface-variant; + in-out property on-surface-variant; + in-out property inverse-surface; + in-out property inverse-on-surface; + in-out property outline; + in-out property outline-variant; + in-out property shadow; + in-out property scrim; + + // Shape: corner radii. Concentric nesting: inner = outer - padding. + out property corner-none: 0px; + out property corner-xs: 4px; + out property corner-sm: 8px; + out property corner-md: 12px; + out property corner-lg: 16px; + out property corner-xl: 28px; + // Fully rounded ends for a shape of the given height. + public pure function corner-full(height: length) -> length { + height / 2 + } + + // Spacing on a 4 px grid. + out property space-1: 4px; + out property space-2: 8px; + out property space-3: 12px; + out property space-4: 16px; + out property space-6: 24px; + out property space-8: 32px; + + // Hairline borders. + out property hairline: 1px; + + // Type: the system UI face plus the icon font; four sizes. + out property icon-font: "Material Symbols Rounded"; + out property title-large: { size: 22px, weight: 400, line-height: 28px }; + out property title-medium: { size: 16px, weight: 500, line-height: 24px }; + out property body-medium: { size: 14px, weight: 400, line-height: 20px }; + out property body-small: { size: 12px, weight: 400, line-height: 16px }; + out property label-large: { size: 14px, weight: 500, line-height: 20px }; + out property label-medium: { size: 12px, weight: 500, line-height: 16px }; + + // State-layer opacities: tint = role.with-alpha(state-*). + out property state-hover: 0.08; + out property state-focus: 0.10; + out property state-press: 0.10; + out property state-drag: 0.16; + out property disabled-content: 0.38; + out property disabled-container: 0.12; +} diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 383cad0..175e3b6 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -24,3 +24,4 @@ D-019 — 2026-11-18 — TLS and SSH crypto on rustls + ring (no aws-lc-rs, no O D-020 — 2026-11-18 — Accepted SSH host keys go to `$XDG_CONFIG_HOME/tunal/known_hosts`, read together with `~/.ssh/known_hosts`; Tunal never writes under ~/.ssh — plan-generate — S027–S029. D-021 — 2026-11-18 — Playlist sort: a sort option "Playlist sort" offered only in folders under XDG_MUSIC_DIR that contain a playlist file (.m3u, .m3u8, .pls, .xspf); listed files first in playlist order, unlisted entries after in natural name order; several playlists → one option each; desc reverses; re-sorts when the playlist changes; stored as the folder's sort in `.directory` like other sorts — user request (details chosen by orchestrator, user may revise) — S008, S015. D-022 — 2026-11-18 — Fallback theme seed `#3F6FB5` (muted blue) when the portal gives no accent; palettes are `material-colors` 0.5 `ThemeBuilder` defaults (tonal spot, spec 2021) exported as ARGB `Palette` structs; library warnings go to stderr as one `tunal-theme: …` line (no logging crate yet) — S002 — S002, S003. +D-023 — 2026-11-18 — Window minimum size 720×480 px (preferred 960×640): fits a 240 px sidebar plus a usable content column; Slint 1.19 can't drive the icon font's variation axes (font-weight doesn't reach `wght`), so `Icon` has size only and draws the default instance (wght 400, FILL 0); easing tokens live in an internal `Motion` global and Rust sets the reduced flag through `MotionPrefs` (easing properties can't be exported) — S003 — S003 and every UI plan. diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index f699b86..43461be 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -14,5 +14,11 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done, - Not done: nothing. Missing-setting warnings are `eprintln!` lines prefixed `tunal-theme:` (no logging crate). - Later: — +## S003 — Window, Theme and Motion globals, screenshot command +- Done: `ui/theme.slint` `Theme` (34 M3 roles as `primary`, `on-primary`, … `scrim`; `dark`; `corner-none/xs/sm/md/lg/xl` 0/4/8/12/16/28 + `corner-full(h)`; `space-1/2/3/4/6/8`; `hairline`; `icon-font`; `TypeStyle` `title-large/title-medium/body-medium/body-small/label-large/label-medium`; `state-hover/focus/press/drag`, `disabled-content/container`). `ui/motion.slint` `Motion` (`short1…long4`, `emphasized(-decelerate/-accelerate)`, `standard(-decelerate/-accelerate)`, `time(d)` → 0 ms when reduced) fed by exported `MotionPrefs.reduced`. `Icon { glyph, size }` + `Icons.folder/home`. `src/theme_bridge.rs` (read at start, `watch` → `upgrade_in_event_loop`), env `TUNAL_SEED=#rrggbb`, `TUNAL_SCHEME=light|dark`, `TUNAL_REDUCED_MOTION=1`. `src/screenshot.rs`: `tunal --screenshot [--dark] [--size WxH]`. Window min 720×480 (D-023); ui entry renamed `ui/app.slint`; `png` 0.18 dep. +- Verified: build, clippy -D warnings, fmt --check; looked at light, dark, `TUNAL_SEED=#2e7d32 --dark --size 720x480`, and no-bus (fallback blue) PNGs; real window ran 4 s on a private bus and with invalid env values (one stderr line each), no panic. +- Not done: live re-theme not observed end to end (no D-Bus Python bindings for a fake portal); the path is `watch` (verified in S002) → `apply` (verified by screenshots). Icon weight/fill: not settable in Slint 1.19 (D-023). +- Later: icon weight/fill if Slint gains font variations; screenshot hover/press states need a controlled clock (phase 12). + ## Later -