S016: R1-11 system accent follows the Caelestia scheme
On niri with the Caelestia shell the desktop colours live in ~/.local/state/caelestia/scheme.json, while GNOME's accent-color (and the portal) stay at a stale 'red'. system_accent reads the scheme's primary first. smoke.sh isolates XDG_STATE_HOME so runs never see the user's state. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
83dea552c1
commit
72773bc54a
4 changed files with 32 additions and 2 deletions
|
|
@ -165,9 +165,13 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
|
|||
pages; `draw` restyles when the active tab's site colour changes (also on Back to the web page). Test added.
|
||||
- Verified: 53 unit tests; `SMOKE_SIZE=1280x1100 tools/smoke.sh tests/smoke/colours.txt` (new, page
|
||||
`pages/theme-colour.html`) all shots as expected; visible run covers site → Settings → Back (taps miss at 772 px).
|
||||
- System accent on niri + Caelestia: read `~/.local/state/caelestia/scheme.json` primary before kdeglobals and
|
||||
GNOME's stale `'red'`; test added; smoke.sh now isolates `XDG_STATE_HOME`. Visible shot with a copy of the
|
||||
user's scheme shows the desktop's pink-purple. Not done: live follow of wallpaper changes (restart needed).
|
||||
- Not seen: the user's exact path, if it was another one; ask them to retry.
|
||||
|
||||
## Later
|
||||
- System accent: watch caelestia scheme.json / the portal `accent-color` and restyle live (R1-11).
|
||||
- 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).
|
||||
- Shortcut icons: a favicon cache by host (today only open tabs' favicons show); a `scroll` selftest command.
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ State tags: `[open]`, `[fixed <commit>]`, `[wontfix: reason]`. Severity: high /
|
|||
- R1-09 [fixed 87299d3] Address bar becomes a wavy progress bar while a page loads: the address pill turns into a Material 3 Expressive wavy (wiggly) progress line that maps the page's load progress; hovering it (or focusing it, or typing) morphs it back to the normal text field; when not loading it's the normal field. Every change between the two states is animated (spring morph, Motion setting respected). Build it as described here; the old browser's loading wave (a line under the pill) is NOT the target. Severity: medium. (user, during S020) → chrome follow-up after S020, before S021.
|
||||
- R1-10 [open] Tab loading indicator: while a tab loads, its favicon spot shows a cookie-shaped (scalloped, M3 Expressive) progress ring, like the original Python Nacre's that the user liked: the stroke draws forward around the cookie outline, then retracts backwards, and keeps repeating while the whole shape spins smoothly; it morphs back into the favicon when loading ends. Motion setting respected (Motion off = static indicator). Here the original IS the reference: `draw_spinner` in `~/Documents/Apps/Nacre/nacre/widgets.py`, used by `tabs.py` (read only). Severity: medium. (user, after S020) → chrome follow-up with R1-09, before S021.
|
||||
- R1-11 [fixed f99500f] Colours can't be changed after the welcome setup: once the user finished nacre://welcome, changing the browser colours (Settings → Appearance colour source / palette / custom) had no visible effect. Reproduce: fresh profile, finish the welcome flow, then change colours in Settings. Severity: high. (user, after S020) → first fix before S021 if quick, else S012. Cause found: an internal page typed into a web tab kept that site's theme-color, which won over palette picks under the Website source; the user's exact welcome path didn't reproduce (welcome + every Appearance control works in smoke).
|
||||
- R1-11 detail [fixed S016 follow-up] "System accent" differed from the desktop on niri + caelestia-niri: Nacre read kdeglobals `AccentColor` (none there), then GNOME `accent-color` (`'red'`, also what the portal reports: #E62D42), which Caelestia never updates. The desktop's real colours are in `~/.local/state/caelestia/scheme.json` (primary `#e6b6f1`). Nacre now reads that file's `colours.primary` first. Nothing missing on the desktop side; optional: set the GNOME/portal accent too for other apps. Still read once at start: a new wallpaper needs a Nacre restart (Later).
|
||||
- R1-12 [open] YouTube still doesn't open (same as R1-03; reconfirmed after the redesign). Severity: high. → S006.
|
||||
- R1-13 [open] Dark mode: icons on DuckDuckGo (the page opened in the user's test) don't use the right colours. Unclear whether it's the site's own icons under dark mode (prefers-color-scheme / colour-scheme handling) or Nacre's chrome icons; check both. Severity: medium. (user) → S006.
|
||||
- R1-14 [open] Site compatibility pass: "more things for sites to actually work right": a proper user agent (Servo 0.7 can set the UA through its preferences even though it can't add request headers; pick a mainstream Firefox/Chrome-like UA string, check per-site overrides), JavaScript features sites expect, and a general "doctor" pass over common sites (YouTube, Google sign-in, captchas, DuckDuckGo, Reddit, GitHub). Severity: high. (user) → S006/S007; extend S006 with a site-doctor checklist.
|
||||
|
|
|
|||
27
src/theme.rs
27
src/theme.rs
|
|
@ -48,10 +48,19 @@ pub fn to_hex(c: Color32) -> String {
|
|||
format!("#{:02X}{:02X}{:02X}", c.r(), c.g(), c.b())
|
||||
}
|
||||
|
||||
/// The system accent colour: KDE's kdeglobals, else GNOME's accent-color setting.
|
||||
/// The system accent colour: the Caelestia shell's wallpaper scheme, else KDE's kdeglobals, else GNOME's
|
||||
/// accent-color setting.
|
||||
pub fn system_accent() -> Option<Color32> {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
// Caelestia (niri or KDE) themes the desktop from ~/.local/state/caelestia/scheme.json and leaves the
|
||||
// GNOME accent at whatever it was.
|
||||
if let Some(path) = dirs::state_dir().map(|d| d.join("caelestia/scheme.json"))
|
||||
&& let Ok(text) = std::fs::read_to_string(path)
|
||||
&& let Some(c) = caelestia_primary(&text)
|
||||
{
|
||||
return Some(c);
|
||||
}
|
||||
if let Some(path) = dirs::config_dir().map(|d| d.join("kdeglobals"))
|
||||
&& let Ok(text) = std::fs::read_to_string(path)
|
||||
{
|
||||
|
|
@ -94,6 +103,13 @@ pub fn system_accent() -> Option<Color32> {
|
|||
}
|
||||
}
|
||||
|
||||
/// The primary colour of a Caelestia `scheme.json` (`{"colours": {"primary": "e6b6f1", ...}}`).
|
||||
fn caelestia_primary(text: &str) -> Option<Color32> {
|
||||
let json: serde_json::Value = serde_json::from_str(text).ok()?;
|
||||
let hex = json.get("colours")?.get("primary")?.as_str()?;
|
||||
parse_hex(hex)
|
||||
}
|
||||
|
||||
/// Whether the system prefers dark (used for "System" mode before winit reports a theme).
|
||||
pub fn system_dark(winit_theme: Option<winit::window::Theme>) -> bool {
|
||||
match winit_theme {
|
||||
|
|
@ -609,6 +625,15 @@ mod tests {
|
|||
assert!(!output.shapes.is_empty());
|
||||
}
|
||||
|
||||
// R1-11: on niri with the Caelestia shell, "System accent" took GNOME's stale accent instead of the desktop's.
|
||||
#[test]
|
||||
fn caelestia_scheme_primary() {
|
||||
let text = r#"{"name": "dynamic", "mode": "dark", "colours": {"background": "161217", "primary": "e6b6f1"}}"#;
|
||||
assert_eq!(caelestia_primary(text), Some(Color32::from_rgb(0xE6, 0xB6, 0xF1)));
|
||||
assert_eq!(caelestia_primary(r#"{"colours": {}}"#), None);
|
||||
assert_eq!(caelestia_primary("not json"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colours() {
|
||||
assert_eq!(parse_hex("#6750A4"), Some(Color32::from_rgb(0x67, 0x50, 0xA4)));
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ env -u WAYLAND_DISPLAY -u DISPLAY -u DBUS_SESSION_BUS_ADDRESS -u NACRE_HOME \
|
|||
-u http_proxy -u https_proxy -u all_proxy -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY \
|
||||
"${dispvars[@]}" \
|
||||
HOME="$home" XDG_CONFIG_HOME="$home/.config" XDG_DATA_HOME="$home/.local/share" \
|
||||
XDG_CACHE_HOME="$home/.cache" XDG_RUNTIME_DIR="$runtime" \
|
||||
XDG_CACHE_HOME="$home/.cache" XDG_STATE_HOME="$home/.local/state" XDG_RUNTIME_DIR="$runtime" \
|
||||
RUST_BACKTRACE=1 NACRE_SCRIPT="$out/script.txt" \
|
||||
timeout -k 10 "${SMOKE_TIMEOUT:-180}" "$bin" >"$out/nacre.log" 2>&1
|
||||
code=$?
|
||||
|
|
|
|||
Loading…
Reference in a new issue