Stop shelling out to pywal; use bread-theme's native extractor #5

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

Depends on the bread-theme release from epic PYWAL.

  • Delete src/pywal.rs; generate_palette goes away.
  • set(): extract the palette once via bread-theme, write the global palette (new bread-owned cache) plus per-output files. Removes the current re-read of ~/.cache/wal via load_palette().
  • sync_focused_global(): write the global palette from the per-output palette it already has instead of re-running wal -i (removes the double extraction).
  • get(): read the last wallpaper from current.json instead of ~/.cache/wal/wal.
  • Bump the bread-theme tag in Cargo.toml.
  • Remove python-pywal from bakery.toml system_deps; update bakery description, README, EVENTS.md.

Part of epic PYWAL.

Depends on the bread-theme release from epic PYWAL. - Delete `src/pywal.rs`; `generate_palette` goes away. - `set()`: extract the palette once via bread-theme, write the global palette (new bread-owned cache) plus per-output files. Removes the current re-read of `~/.cache/wal` via `load_palette()`. - `sync_focused_global()`: write the global palette from the per-output palette it already has instead of re-running `wal -i` (removes the double extraction). - `get()`: read the last wallpaper from `current.json` instead of `~/.cache/wal/wal`. - Bump the bread-theme tag in Cargo.toml. - Remove `python-pywal` from `bakery.toml` `system_deps`; update bakery description, README, EVENTS.md. Part of epic PYWAL.
Author
Owner

PR: #6

Deleted src/pywal.rs, set()/sync_focused_global() now use bread-theme's native palette_from_image + write_global_palette instead of shelling to wal, get() reads current.json. bread-theme dep points at feature/native-palette for now (needs the release tag before merge). Verified build/test/clippy/fmt against a temporary local override of the in-progress bread-theme worktree, then reverted the override.

PR: https://git.breadway.dev/Breadway/breadpaper/pulls/6 Deleted src/pywal.rs, set()/sync_focused_global() now use bread-theme's native palette_from_image + write_global_palette instead of shelling to wal, get() reads current.json. bread-theme dep points at feature/native-palette for now (needs the release tag before merge). Verified build/test/clippy/fmt against a temporary local override of the in-progress bread-theme worktree, then reverted the override.
Author
Owner

Review: changes requested on breadpaper#6 (#6). Not merged: it depends on unreleased bread-theme.

  1. CI is red because Cargo.lock does not match the branch dep; reproduced in a clean clone with --locked. After the bread-theme release, re-point to the tag and commit a regenerated lock.
  2. set() rebuilds theme.css through the external bread-theme reload binary. An older installed CLI would read the stale ~/.cache/wal cache. Write the shared sheet in-process with theme::write_shared_from(&palette), as sync_focused_global already does.
  3. webp, gif and bmp wallpapers are accepted but cannot be decoded yet. The fix is upstream in bread-theme. Meanwhile, set() applies the wallpaper before extraction fails, which leaves half-applied state.
  4. Nit: stale "awww/wal" comment at src/lib.rs:469.

The get() precedence (focused output, then "*", then first entry) is fine.

Rework happens on the existing branch feature/drop-pywal, and PR #6 stays open. Do not open a second PR for this key.

Review: changes requested on breadpaper#6 (https://git.breadway.dev/Breadway/breadpaper/pulls/6). Not merged: it depends on unreleased bread-theme. 1. CI is red because Cargo.lock does not match the branch dep; reproduced in a clean clone with `--locked`. After the bread-theme release, re-point to the tag and commit a regenerated lock. 2. `set()` rebuilds theme.css through the external `bread-theme reload` binary. An older installed CLI would read the stale `~/.cache/wal` cache. Write the shared sheet in-process with `theme::write_shared_from(&palette)`, as `sync_focused_global` already does. 3. webp, gif and bmp wallpapers are accepted but cannot be decoded yet. The fix is upstream in bread-theme. Meanwhile, `set()` applies the wallpaper before extraction fails, which leaves half-applied state. 4. Nit: stale "awww/wal" comment at src/lib.rs:469. The get() precedence (focused output, then "*", then first entry) is fine. Rework happens on the existing branch feature/drop-pywal, and PR #6 stays open. Do not open a second PR for this key.
Author
Owner

Pushed follow-up commit to feature/drop-pywal addressing all 4 review points: in-process shared stylesheet write (theme::write_shared_from) replacing the bread-theme reload shell-out, palette extraction moved before wallpaper application in both set() and set_on() to avoid half-applied state, resolve_current() extracted with 4 new precedence tests, and the stale awww/wal comment fixed. Also refreshed Cargo.lock against the now-pushed feature/native-palette branch and verified cargo build --locked in a fresh clone.

Verified: cargo build --release, cargo test --release (32 passed), cargo clippy --all-targets -- -D warnings, cargo fmt --check, all clean.

PR: #6

Pushed follow-up commit to feature/drop-pywal addressing all 4 review points: in-process shared stylesheet write (theme::write_shared_from) replacing the bread-theme reload shell-out, palette extraction moved before wallpaper application in both set() and set_on() to avoid half-applied state, resolve_current() extracted with 4 new precedence tests, and the stale awww/wal comment fixed. Also refreshed Cargo.lock against the now-pushed feature/native-palette branch and verified cargo build --locked in a fresh clone. Verified: cargo build --release, cargo test --release (32 passed), cargo clippy --all-targets -- -D warnings, cargo fmt --check, all clean. PR: https://git.breadway.dev/Breadway/breadpaper/pulls/6
Author
Owner

Follow-up: refreshed Cargo.lock again to bread-theme's latest feature/native-palette commit (3758f0c) since the branch received new commits after the earlier refresh. Re-verified in a fresh clone: cargo build --release, cargo test --release (32 passed), clippy, fmt, all clean. Issue stays in review, no other changes.

Follow-up: refreshed Cargo.lock again to bread-theme's latest feature/native-palette commit (3758f0c) since the branch received new commits after the earlier refresh. Re-verified in a fresh clone: cargo build --release, cargo test --release (32 passed), clippy, fmt, all clean. Issue stays in review, no other changes.
Author
Owner

Second-round review: the round-1 items are resolved (extract-before-apply in set(), in-process shared sheet, get() precedence tests, stale comment), and CI is green. Two small changes remain, plus the relock. Full review: #6

  • src/lib.rs:146-157 (set_on): per-output palette/css files are written by generate_for_output before wallpaper::apply_on. If awww fails, the monitor recolours without the wallpaper changing. Change the order to: bread_theme::palette_from_image, then apply_on, then write_output_theme(output, &palette).
  • README.md:19 still says bread-theme must be on $PATH for set. It no longer is.
  • After the bread-ecosystem#36 release: repin Cargo.toml:15 to the release tag and commit the regenerated Cargo.lock. The branch pin will break once #36 merges and its branch is deleted.

For the user: breadpaper now statically links ImageMagick- and IJG-derived code but still declares MIT only. See the licensing notes on bread-ecosystem#36.

Rework happens on the existing branch feature/drop-pywal, and PR #6 stays open. Do not open a second PR for this key.

Second-round review: the round-1 items are resolved (extract-before-apply in set(), in-process shared sheet, get() precedence tests, stale comment), and CI is green. Two small changes remain, plus the relock. Full review: https://git.breadway.dev/Breadway/breadpaper/pulls/6 - [ ] `src/lib.rs:146-157` (`set_on`): per-output palette/css files are written by `generate_for_output` before `wallpaper::apply_on`. If awww fails, the monitor recolours without the wallpaper changing. Change the order to: `bread_theme::palette_from_image`, then `apply_on`, then `write_output_theme(output, &palette)`. - [ ] `README.md:19` still says bread-theme must be on $PATH for `set`. It no longer is. - [ ] After the bread-ecosystem#36 release: repin `Cargo.toml:15` to the release tag and commit the regenerated Cargo.lock. The branch pin will break once #36 merges and its branch is deleted. For the user: breadpaper now statically links ImageMagick- and IJG-derived code but still declares MIT only. See the licensing notes on bread-ecosystem#36. Rework happens on the existing branch feature/drop-pywal, and PR #6 stays open. Do not open a second PR for this key.
Author
Owner

Pushed round-3 fixes to feature/drop-pywal, PR: #6

set_on now extracts (no side effects) before applying the wallpaper, writes per-output theme files only after apply_on succeeds. README.md:19 stale PATH line dropped. Enabled bread-theme's extract feature (its licensing split moved palette_from_image/generate_output behind it); added NOTICE, LICENSE-ImageMagick, LICENSE-libjpeg-turbo, a breadpaper notice subcommand, and a README licence note since this binary now statically links ImageMagick/IJG code. Relocked against bread-theme's latest feature/native-palette commit.

Verified: cargo build --locked, cargo test --locked (32 passed), clippy -D warnings, fmt --check, all clean.

Pushed round-3 fixes to feature/drop-pywal, PR: https://git.breadway.dev/Breadway/breadpaper/pulls/6 set_on now extracts (no side effects) before applying the wallpaper, writes per-output theme files only after apply_on succeeds. README.md:19 stale PATH line dropped. Enabled bread-theme's extract feature (its licensing split moved palette_from_image/generate_output behind it); added NOTICE, LICENSE-ImageMagick, LICENSE-libjpeg-turbo, a breadpaper notice subcommand, and a README licence note since this binary now statically links ImageMagick/IJG code. Relocked against bread-theme's latest feature/native-palette commit. Verified: cargo build --locked, cargo test --locked (32 passed), clippy -D warnings, fmt --check, all clean.
Author
Owner

Third-round review of PR #6 (f835da5): changes requested. Full review: #6 (comment)

  • The bakery package ships only the MIT LICENSE (license_file, release.yml:44). Make it a combined MIT + NOTICE + ImageMagick + IJG text, as bread-theme does, so the IJG statement and the ImageMagick licence and NOTICE go out with the binary.
  • Repin bread-theme from branch = "feature/native-palette" to the tag that ships bread-ecosystem#36, keeping features = ["gtk", "extract"], and relock. Main's check.yml now runs lint-pins, which rejects branch pins.

The set_on ordering fix and the README fix are good. Rebased and built against a rebased #36: clippy is clean and 32 tests pass.

Rework happens on the existing branch feature/drop-pywal, and PR #6 stays open. Do not open a second PR for this key.

Third-round review of PR #6 (f835da5): changes requested. Full review: https://git.breadway.dev/Breadway/breadpaper/pulls/6#issuecomment-1382 - [ ] The bakery package ships only the MIT LICENSE (`license_file`, release.yml:44). Make it a combined MIT + NOTICE + ImageMagick + IJG text, as bread-theme does, so the IJG statement and the ImageMagick licence and NOTICE go out with the binary. - [ ] Repin bread-theme from `branch = "feature/native-palette"` to the tag that ships bread-ecosystem#36, keeping `features = ["gtk", "extract"]`, and relock. Main's check.yml now runs lint-pins, which rejects branch pins. The set_on ordering fix and the README fix are good. Rebased and built against a rebased #36: clippy is clean and 32 tests pass. Rework happens on the existing branch `feature/drop-pywal`, and PR #6 stays open. Do not open a second PR for this key.
Sign in to join this conversation.
No labels
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/breadpaper#5
No description provided.