bread-theme: bread-owned global palette cache with ~/.cache/wal fallback #31

Closed
opened 2026-09-26 12:29:22 +08:00 by Breadway · 3 comments
Owner

Move the session-global palette off pywal's cache to a bread-owned path, e.g. $XDG_CACHE_HOME/bread/palette.json.

  • New public API to write the global palette (breadpaper will call it instead of wal), atomic like the other bread-theme writes.
  • load_palette() reads the new path first, then falls back to ~/.cache/wal/colors.json so existing installs don't flash back to default accents after upgrade.
  • Make sure bread-theme reload and the gtk.rs watchers pick up changes to the new file.
  • Keep write_wal_cache as an optional export for third-party pywal-template users, but nothing in bread should depend on it.
  • Also persist the last global wallpaper path somewhere bread-owned if breadpaper needs it (see PAPER issue; current.json may already suffice).

Part of epic PYWAL.

Move the session-global palette off pywal's cache to a bread-owned path, e.g. `$XDG_CACHE_HOME/bread/palette.json`. - New public API to write the global palette (breadpaper will call it instead of `wal`), atomic like the other bread-theme writes. - `load_palette()` reads the new path first, then falls back to `~/.cache/wal/colors.json` so existing installs don't flash back to default accents after upgrade. - Make sure `bread-theme reload` and the gtk.rs watchers pick up changes to the new file. - Keep `write_wal_cache` as an optional export for third-party pywal-template users, but nothing in bread should depend on it. - Also persist the last global wallpaper path somewhere bread-owned if breadpaper needs it (see PAPER issue; `current.json` may already suffice). Part of epic PYWAL.
Author
Owner

PR: #36

Session-global palette moved to $XDG_CACHE_HOME/bread/palette.json (palette_cache_path()), written atomically by write_global_palette. load_palette() reads it first, falls back to ~/.cache/wal/colors.json, then Palette::default(). palette_cache_dir() exported too for breadman to watch.

PR: https://git.breadway.dev/Breadway/bread-ecosystem/pulls/36 Session-global palette moved to $XDG_CACHE_HOME/bread/palette.json (palette_cache_path()), written atomically by write_global_palette. load_palette() reads it first, falls back to ~/.cache/wal/colors.json, then Palette::default(). palette_cache_dir() exported too for breadman to watch.
Author
Owner

Reviewed on bread-ecosystem#36. This part is good:

  • palette_cache_path() = $XDG_CACHE_HOME/bread/palette.json, written atomically by write_global_palette.
  • load_palette reads it first, then falls back to ~/.cache/wal/colors.json, then the default (palette.rs:81-92).
  • Tests cover the precedence.
  • The BOS skel palette.json parses through it correctly.

Nit: palette_cache_dir() falls back to a literal ~/.cache path. Not merged, because it ships in the same PR as ECO-29/30, which need rework. Left in review.

Reviewed on bread-ecosystem#36. This part is good: - `palette_cache_path()` = `$XDG_CACHE_HOME/bread/palette.json`, written atomically by `write_global_palette`. - `load_palette` reads it first, then falls back to `~/.cache/wal/colors.json`, then the default (palette.rs:81-92). - Tests cover the precedence. - The BOS skel palette.json parses through it correctly. Nit: `palette_cache_dir()` falls back to a literal `~/.cache` path. Not merged, because it ships in the same PR as ECO-29/30, which need rework. Left in review.
Author
Owner

Second-round review: ready. palette_cache_path() resolves to $XDG_CACHE_HOME/bread/palette.json, and load_palette() reads it before ~/.cache/wal/colors.json and then the default. The precedence is covered by a behavioural test (load_palette_prefers_the_new_cache_over_the_wal_fallback), and writes are atomic. This stays in review because it lands with bread-ecosystem#36 (release-sensitive repo, currently held for the ECO-30 fix).

Second-round review: ready. `palette_cache_path()` resolves to `$XDG_CACHE_HOME/bread/palette.json`, and `load_palette()` reads it before `~/.cache/wal/colors.json` and then the default. The precedence is covered by a behavioural test (`load_palette_prefers_the_new_cache_over_the_wal_fallback`), and writes are atomic. This stays in review because it lands with bread-ecosystem#36 (release-sensitive repo, currently held for the ECO-30 fix).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Breadway/bread-ecosystem#31
No description provided.