Canonical webview accent mapping + live per-output / monitor-move theming #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/per-monitor-theme"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes two per-monitor colour-theming bugs in
commands/theme.rs.Finding #1 (High) — accent mapping — NEEDS MAINTAINER CONFIRMATION
render_theme_csshand-rolled the:root { --name: ... }block and mapped:So
--accent == --red == --on-accent == --on-red, all set to pywal'scolor1— the ANSI-red slotbread-themereserves for errors/destructive actions. Every GTK app in the ecosystem (andbread_theme::color_pairs/css_custom_properties/stylesheet) mapsaccent = color4,red = color1. On a multi-monitor desktop the settings window accented in a visibly different hue from the bar, the lock screen and every other window on the same monitor, and the frontend's--red/--on-reddestructive-button styling (delete/remove/forget buttons across ~10 views) was indistinguishable from a normal accent button.Decision: go canonical (
accent = color4)render_theme_cssnow callsbread_theme::css_custom_properties(palette)+bread_theme::css_tokens()directly instead of a hand-rolled copy. Both are exported from the pinnedbread-themev0.7.4 (the code comment claiming otherwise referenced v0.7.1 and was stale). This:--accent = color4, matching the rest of the desktop per monitor;--red(color1) and--on-redas distinct tokens, so destructive actions read as destructive again;css_tokensemits--font-family: 'Varela Round', sans-serifinstead of the local copy's'Varela Round, sans-serif'(one over-quoted family that dropped the generic fallback).bos-ui-demos/settings-redesign.htmlhas a marketing line ("Accent is the warm color from the image - not pywal color4") suggesting thecolor1mapping was once deliberate. It contradicts thebread-themetoken contract and the rest of the ecosystem, and it's only in a demo file, so I went canonical — please confirm this is the intended direction. If the warm-accent look is wanted, it should at minimum not sharecolor1with--red, and ideally be a documented deviation inbread-themeitself.Finding #4 (Medium) — live updates
watch_and_emitwatched only the sharedtheme.css, filtered to that exact filename. Consequences:breadpaper set_onon a non-focused monitor writes onlypalettes/<out>.json+themes/<out>.css— notheme.cssrewrite, so a settings window parked on that monitor kept stale colours;Change
bread/dir (so it also seespalettes/andthemes/), and the filter accepts the sharedtheme.cssor the per-output palette/CSS file for the monitor this window is currently on (bread_theme::output_palette_path/output_css_path). If the monitor can't be resolved it falls back to reacting to any per-output*.json/*.csswrite, so a change is never missed..tmp.<pid>scratch files frombread-theme's atomic writes are ignored.WindowEvent::Movedhandler that re-renders with the new output's palette when the window lands on a different monitor (compares against the last monitor so a drag doesn't spam re-renders).monitor_name/emit_current_themehelpers out of the duplicated logic.Tests
cargo build --locked,cargo build --release --locked,cargo clippy --all-targets --locked -D warnings,cargo test --locked(64 tests) — all pass. No frontend changes. NoCargo.lockchange (bothbread-themehelpers already in v0.7.4). No.cargo/config.tomlpatch in this repo.Note:
origin/mainis notcargo fmt --checkclean (pre-existing, across ~12 files); this branch touches onlycommands/theme.rsand leaves it fmt-clean without reformatting the rest.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.