From 9e0e494839b141c59761ae79a88637762eed5043 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:05:48 +0800 Subject: [PATCH 01/26] Initial implementation of breadpaper CLI tool that sets a wallpaper with awww, generates a pywal colour palette, and reloads bread-theme to recolour all running bread GTK apps. Includes CI workflows, bakery metadata, and Arch PKGBUILD. Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/mirror.yml | 19 ++++ .forgejo/workflows/package.yml | 37 +++++++ .github/workflows/ci.yml | 38 +++++++ .github/workflows/release.yml | 61 +++++++++++ .gitignore | 1 + Cargo.lock | 193 +++++++++++++++++++++++++++++++++ Cargo.toml | 10 ++ bakery.toml | 9 ++ packaging/arch/PKGBUILD | 33 ++++++ src/lib.rs | 61 +++++++++++ src/main.rs | 36 ++++++ src/pywal.rs | 18 +++ src/theme.rs | 15 +++ src/wallpaper.rs | 17 +++ 14 files changed, 548 insertions(+) create mode 100644 .forgejo/workflows/mirror.yml create mode 100644 .forgejo/workflows/package.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 bakery.toml create mode 100644 packaging/arch/PKGBUILD create mode 100644 src/lib.rs create mode 100644 src/main.rs create mode 100644 src/pywal.rs create mode 100644 src/theme.rs create mode 100644 src/wallpaper.rs diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml new file mode 100644 index 0000000..01e1dad --- /dev/null +++ b/.forgejo/workflows/mirror.yml @@ -0,0 +1,19 @@ +name: Mirror to GitHub + +on: + push: + branches: ['**'] + tags: ['**'] + +jobs: + mirror: + runs-on: [self-hosted, hestia] + steps: + - name: Mirror to GitHub + run: | + set -euo pipefail + git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git + cd repo.git + git push --prune \ + "https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadpaper.git" \ + '+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*' diff --git a/.forgejo/workflows/package.yml b/.forgejo/workflows/package.yml new file mode 100644 index 0000000..1a26be9 --- /dev/null +++ b/.forgejo/workflows/package.yml @@ -0,0 +1,37 @@ +name: Build and publish package + +on: + push: + tags: ['v*'] + +jobs: + package: + runs-on: [self-hosted, hestia] + container: + image: archlinux:latest + steps: + - name: Build and publish + env: + PUBLISH_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + run: | + set -euo pipefail + VERSION="${GITHUB_REF_NAME#v}" + pacman -Syu --noconfirm base-devel git rust cargo + useradd -m builder + git config --global --add safe.directory '*' + git clone --branch "${GITHUB_REF_NAME}" --depth 1 \ + "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" /home/builder/src + cd /home/builder/src + git archive --format=tar.gz --prefix="breadpaper-${VERSION}/" HEAD \ + > packaging/arch/breadpaper-${VERSION}.tar.gz + SHA=$(sha256sum packaging/arch/breadpaper-${VERSION}.tar.gz | awk '{print $1}') + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" packaging/arch/PKGBUILD + sed -i "s/^sha256sums=.*/sha256sums=('${SHA}')/" packaging/arch/PKGBUILD + chown -R builder:builder /home/builder/src + su builder -c "cd /home/builder/src/packaging/arch && makepkg -f --noconfirm --nocheck" + PKG=$(find /home/builder/src/packaging/arch -name '*.pkg.tar.zst' | head -1) + curl -fsS -X PUT \ + -H "Authorization: token ${PUBLISH_TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@${PKG}" \ + "https://git.breadway.dev/api/packages/Breadway/arch/os" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5abaed1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-D warnings" + +jobs: + test: + name: fmt · clippy · test · build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Format check + run: cargo fmt --all -- --check + + - name: Clippy + run: cargo clippy --all-targets -- -D warnings + + - name: Test + run: cargo test --all --verbose + + - name: Release build + run: cargo build --release --verbose diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fe0f52d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + +env: + DL_DIR: /srv/breadway-dl + ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + +jobs: + build: + runs-on: [self-hosted, hestia] + steps: + - uses: actions/checkout@v4 + + - name: build + run: cargo build --release --locked + + - name: test + run: cargo test --release --locked + + - name: prepare artifacts + run: | + VERSION="${GITHUB_REF_NAME#v}" + PKG_DIR="${DL_DIR}/breadpaper/${VERSION}" + mkdir -p "${PKG_DIR}" + cp target/release/breadpaper "${PKG_DIR}/breadpaper-x86_64" + strip "${PKG_DIR}/breadpaper-x86_64" + sha256sum "${PKG_DIR}/breadpaper-x86_64" | awk '{print $1}' \ + > "${PKG_DIR}/breadpaper-x86_64.sha256" + cp bakery.toml "${PKG_DIR}/bakery.toml" + ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest" + + - name: ensure bread-ecosystem + run: | + if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then + git -C "${ECOSYSTEM_DIR}" pull --ff-only + else + mkdir -p "$(dirname "${ECOSYSTEM_DIR}")" + git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" + fi + + - name: regenerate index.json + run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" + + - name: upload to GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${GITHUB_REF_NAME#v}" + PKG_DIR="${DL_DIR}/breadpaper/${VERSION}" + gh release create "${GITHUB_REF_NAME}" \ + --title "breadpaper v${VERSION}" --generate-notes 2>/dev/null || true + gh release upload "${GITHUB_REF_NAME}" \ + "${PKG_DIR}/breadpaper-x86_64" \ + "${PKG_DIR}/breadpaper-x86_64.sha256" \ + --clobber diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f145084 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,193 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "breadpaper" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..da29e25 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "breadpaper" +version = "0.1.0" +edition = "2024" +description = "Wallpaper manager for the bread desktop" +license = "MIT" + +[dependencies] +clap = { version = "4", features = ["derive"] } +anyhow = "1" diff --git a/bakery.toml b/bakery.toml new file mode 100644 index 0000000..2253fa9 --- /dev/null +++ b/bakery.toml @@ -0,0 +1,9 @@ +name = "breadpaper" +description = "Wallpaper manager for the bread desktop — sets awww wallpaper, generates pywal palette, reloads bread themes" +binaries = ["breadpaper"] +system_deps = ["python-pywal"] +optional_system_deps = ["awww"] +bread_deps = ["bread"] + +[install] +post_install = [] diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD new file mode 100644 index 0000000..aaeafc4 --- /dev/null +++ b/packaging/arch/PKGBUILD @@ -0,0 +1,33 @@ +# Maintainer: Breadway + +pkgname=breadpaper +pkgver=0.1.0 +pkgrel=1 +pkgdesc="Wallpaper manager for the bread desktop" +arch=('x86_64') +url="https://github.com/Breadway/breadpaper" +license=('MIT') +options=(!lto !debug) +depends=('glibc' 'python-pywal') +optdepends=( + 'awww: Wayland wallpaper daemon' +) +makedepends=('rust' 'cargo') +source=("${pkgname}-${pkgver}.tar.gz") +sha256sums=('SKIP') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + cargo build --release --locked +} + +check() { + cd "${srcdir}/${pkgname}-${pkgver}" + cargo test --release --locked +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + install -Dm755 target/release/breadpaper "${pkgdir}/usr/bin/breadpaper" + install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..f990b9e --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,61 @@ +mod pywal; +mod theme; +mod wallpaper; + +use std::path::{Path, PathBuf}; + +use anyhow::{Context, Result, bail}; + +const IMAGE_EXTENSIONS: &[&str] = &["png", "jpg", "jpeg", "webp", "gif", "bmp"]; + +pub fn set(path: &Path) -> Result<()> { + let path = validate(path)?; + apply_wallpaper(&path)?; + generate_palette(&path)?; + reload_theme()?; + Ok(()) +} + +pub fn get() -> Result { + let home = std::env::var("HOME").context("HOME not set")?; + let wal_file = PathBuf::from(home).join(".cache/wal/wal"); + + let contents = std::fs::read_to_string(&wal_file) + .with_context(|| format!("no wallpaper set yet ({})", wal_file.display()))?; + + Ok(PathBuf::from(contents.trim())) +} + +pub fn apply_wallpaper(path: &Path) -> Result<()> { + wallpaper::apply(path) +} + +pub fn generate_palette(path: &Path) -> Result<()> { + pywal::generate(path) +} + +pub fn reload_theme() -> Result<()> { + theme::reload() +} + +fn validate(path: &Path) -> Result { + let canonical = path + .canonicalize() + .with_context(|| format!("not found: {}", path.display()))?; + + let ext = canonical + .extension() + .and_then(|e| e.to_str()) + .unwrap_or("") + .to_lowercase(); + + if !IMAGE_EXTENSIONS.contains(&ext.as_str()) { + bail!( + "unsupported file type '.{}' — expected one of: {}", + ext, + IMAGE_EXTENSIONS.join(", ") + ); + } + + Ok(canonical) +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..38d3fc6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,36 @@ +use std::path::PathBuf; +use std::process; + +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +#[command(name = "breadpaper", about = "Wallpaper manager for the bread desktop")] +struct Cli { + #[command(subcommand)] + command: Command, +} + +#[derive(Subcommand)] +enum Command { + /// Set wallpaper, generate pywal palette, and reload bread themes + Set { + /// Path to the image file + path: PathBuf, + }, + /// Print the current wallpaper path + Get, +} + +fn main() { + let cli = Cli::parse(); + + let result = match cli.command { + Command::Set { path } => breadpaper::set(&path), + Command::Get => breadpaper::get().map(|p| println!("{}", p.display())), + }; + + if let Err(e) = result { + eprintln!("error: {e:#}"); + process::exit(1); + } +} diff --git a/src/pywal.rs b/src/pywal.rs new file mode 100644 index 0000000..ed78f80 --- /dev/null +++ b/src/pywal.rs @@ -0,0 +1,18 @@ +use std::path::Path; +use std::process::Command; + +use anyhow::{Context, Result, bail}; + +pub fn generate(path: &Path) -> Result<()> { + let status = Command::new("wal") + .arg("-i") + .arg(path) + .arg("-n") // skip wal's own wallpaper backend; awww already set it + .status() + .context("failed to run wal — is python-pywal installed?")?; + + if !status.success() { + bail!("wal exited with {}", status); + } + Ok(()) +} diff --git a/src/theme.rs b/src/theme.rs new file mode 100644 index 0000000..5d06076 --- /dev/null +++ b/src/theme.rs @@ -0,0 +1,15 @@ +use std::process::Command; + +use anyhow::{Context, Result, bail}; + +pub fn reload() -> Result<()> { + let status = Command::new("bread-theme") + .arg("reload") + .status() + .context("failed to run bread-theme — is it installed?")?; + + if !status.success() { + bail!("bread-theme reload exited with {}", status); + } + Ok(()) +} diff --git a/src/wallpaper.rs b/src/wallpaper.rs new file mode 100644 index 0000000..4655308 --- /dev/null +++ b/src/wallpaper.rs @@ -0,0 +1,17 @@ +use std::path::Path; +use std::process::Command; + +use anyhow::{Context, Result, bail}; + +pub fn apply(path: &Path) -> Result<()> { + let status = Command::new("awww") + .arg("set") + .arg(path) + .status() + .context("failed to run awww — is awww-daemon running?")?; + + if !status.success() { + bail!("awww set exited with {}", status); + } + Ok(()) +} From a8b38597ff1a8614143cb61a8669e7295b61fea2 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:05:48 +0800 Subject: [PATCH 02/26] Initial implementation of breadpaper CLI tool that sets a wallpaper with awww, generates a pywal colour palette, and reloads bread-theme to recolour all running bread GTK apps. Includes CI workflows, bakery metadata, and Arch PKGBUILD. --- .forgejo/workflows/mirror.yml | 19 ++++ .forgejo/workflows/package.yml | 37 +++++++ .github/workflows/ci.yml | 38 +++++++ .github/workflows/release.yml | 61 +++++++++++ .gitignore | 1 + Cargo.lock | 193 +++++++++++++++++++++++++++++++++ Cargo.toml | 10 ++ bakery.toml | 9 ++ packaging/arch/PKGBUILD | 33 ++++++ src/lib.rs | 61 +++++++++++ src/main.rs | 36 ++++++ src/pywal.rs | 18 +++ src/theme.rs | 15 +++ src/wallpaper.rs | 17 +++ 14 files changed, 548 insertions(+) create mode 100644 .forgejo/workflows/mirror.yml create mode 100644 .forgejo/workflows/package.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 bakery.toml create mode 100644 packaging/arch/PKGBUILD create mode 100644 src/lib.rs create mode 100644 src/main.rs create mode 100644 src/pywal.rs create mode 100644 src/theme.rs create mode 100644 src/wallpaper.rs diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml new file mode 100644 index 0000000..01e1dad --- /dev/null +++ b/.forgejo/workflows/mirror.yml @@ -0,0 +1,19 @@ +name: Mirror to GitHub + +on: + push: + branches: ['**'] + tags: ['**'] + +jobs: + mirror: + runs-on: [self-hosted, hestia] + steps: + - name: Mirror to GitHub + run: | + set -euo pipefail + git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git + cd repo.git + git push --prune \ + "https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadpaper.git" \ + '+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*' diff --git a/.forgejo/workflows/package.yml b/.forgejo/workflows/package.yml new file mode 100644 index 0000000..1a26be9 --- /dev/null +++ b/.forgejo/workflows/package.yml @@ -0,0 +1,37 @@ +name: Build and publish package + +on: + push: + tags: ['v*'] + +jobs: + package: + runs-on: [self-hosted, hestia] + container: + image: archlinux:latest + steps: + - name: Build and publish + env: + PUBLISH_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + run: | + set -euo pipefail + VERSION="${GITHUB_REF_NAME#v}" + pacman -Syu --noconfirm base-devel git rust cargo + useradd -m builder + git config --global --add safe.directory '*' + git clone --branch "${GITHUB_REF_NAME}" --depth 1 \ + "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" /home/builder/src + cd /home/builder/src + git archive --format=tar.gz --prefix="breadpaper-${VERSION}/" HEAD \ + > packaging/arch/breadpaper-${VERSION}.tar.gz + SHA=$(sha256sum packaging/arch/breadpaper-${VERSION}.tar.gz | awk '{print $1}') + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" packaging/arch/PKGBUILD + sed -i "s/^sha256sums=.*/sha256sums=('${SHA}')/" packaging/arch/PKGBUILD + chown -R builder:builder /home/builder/src + su builder -c "cd /home/builder/src/packaging/arch && makepkg -f --noconfirm --nocheck" + PKG=$(find /home/builder/src/packaging/arch -name '*.pkg.tar.zst' | head -1) + curl -fsS -X PUT \ + -H "Authorization: token ${PUBLISH_TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@${PKG}" \ + "https://git.breadway.dev/api/packages/Breadway/arch/os" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5abaed1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-D warnings" + +jobs: + test: + name: fmt · clippy · test · build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Format check + run: cargo fmt --all -- --check + + - name: Clippy + run: cargo clippy --all-targets -- -D warnings + + - name: Test + run: cargo test --all --verbose + + - name: Release build + run: cargo build --release --verbose diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fe0f52d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + +env: + DL_DIR: /srv/breadway-dl + ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + +jobs: + build: + runs-on: [self-hosted, hestia] + steps: + - uses: actions/checkout@v4 + + - name: build + run: cargo build --release --locked + + - name: test + run: cargo test --release --locked + + - name: prepare artifacts + run: | + VERSION="${GITHUB_REF_NAME#v}" + PKG_DIR="${DL_DIR}/breadpaper/${VERSION}" + mkdir -p "${PKG_DIR}" + cp target/release/breadpaper "${PKG_DIR}/breadpaper-x86_64" + strip "${PKG_DIR}/breadpaper-x86_64" + sha256sum "${PKG_DIR}/breadpaper-x86_64" | awk '{print $1}' \ + > "${PKG_DIR}/breadpaper-x86_64.sha256" + cp bakery.toml "${PKG_DIR}/bakery.toml" + ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest" + + - name: ensure bread-ecosystem + run: | + if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then + git -C "${ECOSYSTEM_DIR}" pull --ff-only + else + mkdir -p "$(dirname "${ECOSYSTEM_DIR}")" + git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" + fi + + - name: regenerate index.json + run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" + + - name: upload to GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${GITHUB_REF_NAME#v}" + PKG_DIR="${DL_DIR}/breadpaper/${VERSION}" + gh release create "${GITHUB_REF_NAME}" \ + --title "breadpaper v${VERSION}" --generate-notes 2>/dev/null || true + gh release upload "${GITHUB_REF_NAME}" \ + "${PKG_DIR}/breadpaper-x86_64" \ + "${PKG_DIR}/breadpaper-x86_64.sha256" \ + --clobber diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f145084 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,193 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "breadpaper" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..da29e25 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "breadpaper" +version = "0.1.0" +edition = "2024" +description = "Wallpaper manager for the bread desktop" +license = "MIT" + +[dependencies] +clap = { version = "4", features = ["derive"] } +anyhow = "1" diff --git a/bakery.toml b/bakery.toml new file mode 100644 index 0000000..2253fa9 --- /dev/null +++ b/bakery.toml @@ -0,0 +1,9 @@ +name = "breadpaper" +description = "Wallpaper manager for the bread desktop — sets awww wallpaper, generates pywal palette, reloads bread themes" +binaries = ["breadpaper"] +system_deps = ["python-pywal"] +optional_system_deps = ["awww"] +bread_deps = ["bread"] + +[install] +post_install = [] diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD new file mode 100644 index 0000000..aaeafc4 --- /dev/null +++ b/packaging/arch/PKGBUILD @@ -0,0 +1,33 @@ +# Maintainer: Breadway + +pkgname=breadpaper +pkgver=0.1.0 +pkgrel=1 +pkgdesc="Wallpaper manager for the bread desktop" +arch=('x86_64') +url="https://github.com/Breadway/breadpaper" +license=('MIT') +options=(!lto !debug) +depends=('glibc' 'python-pywal') +optdepends=( + 'awww: Wayland wallpaper daemon' +) +makedepends=('rust' 'cargo') +source=("${pkgname}-${pkgver}.tar.gz") +sha256sums=('SKIP') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + cargo build --release --locked +} + +check() { + cd "${srcdir}/${pkgname}-${pkgver}" + cargo test --release --locked +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + install -Dm755 target/release/breadpaper "${pkgdir}/usr/bin/breadpaper" + install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..f990b9e --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,61 @@ +mod pywal; +mod theme; +mod wallpaper; + +use std::path::{Path, PathBuf}; + +use anyhow::{Context, Result, bail}; + +const IMAGE_EXTENSIONS: &[&str] = &["png", "jpg", "jpeg", "webp", "gif", "bmp"]; + +pub fn set(path: &Path) -> Result<()> { + let path = validate(path)?; + apply_wallpaper(&path)?; + generate_palette(&path)?; + reload_theme()?; + Ok(()) +} + +pub fn get() -> Result { + let home = std::env::var("HOME").context("HOME not set")?; + let wal_file = PathBuf::from(home).join(".cache/wal/wal"); + + let contents = std::fs::read_to_string(&wal_file) + .with_context(|| format!("no wallpaper set yet ({})", wal_file.display()))?; + + Ok(PathBuf::from(contents.trim())) +} + +pub fn apply_wallpaper(path: &Path) -> Result<()> { + wallpaper::apply(path) +} + +pub fn generate_palette(path: &Path) -> Result<()> { + pywal::generate(path) +} + +pub fn reload_theme() -> Result<()> { + theme::reload() +} + +fn validate(path: &Path) -> Result { + let canonical = path + .canonicalize() + .with_context(|| format!("not found: {}", path.display()))?; + + let ext = canonical + .extension() + .and_then(|e| e.to_str()) + .unwrap_or("") + .to_lowercase(); + + if !IMAGE_EXTENSIONS.contains(&ext.as_str()) { + bail!( + "unsupported file type '.{}' — expected one of: {}", + ext, + IMAGE_EXTENSIONS.join(", ") + ); + } + + Ok(canonical) +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..38d3fc6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,36 @@ +use std::path::PathBuf; +use std::process; + +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +#[command(name = "breadpaper", about = "Wallpaper manager for the bread desktop")] +struct Cli { + #[command(subcommand)] + command: Command, +} + +#[derive(Subcommand)] +enum Command { + /// Set wallpaper, generate pywal palette, and reload bread themes + Set { + /// Path to the image file + path: PathBuf, + }, + /// Print the current wallpaper path + Get, +} + +fn main() { + let cli = Cli::parse(); + + let result = match cli.command { + Command::Set { path } => breadpaper::set(&path), + Command::Get => breadpaper::get().map(|p| println!("{}", p.display())), + }; + + if let Err(e) = result { + eprintln!("error: {e:#}"); + process::exit(1); + } +} diff --git a/src/pywal.rs b/src/pywal.rs new file mode 100644 index 0000000..ed78f80 --- /dev/null +++ b/src/pywal.rs @@ -0,0 +1,18 @@ +use std::path::Path; +use std::process::Command; + +use anyhow::{Context, Result, bail}; + +pub fn generate(path: &Path) -> Result<()> { + let status = Command::new("wal") + .arg("-i") + .arg(path) + .arg("-n") // skip wal's own wallpaper backend; awww already set it + .status() + .context("failed to run wal — is python-pywal installed?")?; + + if !status.success() { + bail!("wal exited with {}", status); + } + Ok(()) +} diff --git a/src/theme.rs b/src/theme.rs new file mode 100644 index 0000000..5d06076 --- /dev/null +++ b/src/theme.rs @@ -0,0 +1,15 @@ +use std::process::Command; + +use anyhow::{Context, Result, bail}; + +pub fn reload() -> Result<()> { + let status = Command::new("bread-theme") + .arg("reload") + .status() + .context("failed to run bread-theme — is it installed?")?; + + if !status.success() { + bail!("bread-theme reload exited with {}", status); + } + Ok(()) +} diff --git a/src/wallpaper.rs b/src/wallpaper.rs new file mode 100644 index 0000000..4655308 --- /dev/null +++ b/src/wallpaper.rs @@ -0,0 +1,17 @@ +use std::path::Path; +use std::process::Command; + +use anyhow::{Context, Result, bail}; + +pub fn apply(path: &Path) -> Result<()> { + let status = Command::new("awww") + .arg("set") + .arg(path) + .status() + .context("failed to run awww — is awww-daemon running?")?; + + if !status.success() { + bail!("awww set exited with {}", status); + } + Ok(()) +} From c296cf3fd5427383a37476a920a6f607c2cfa75e Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:16:44 +0800 Subject: [PATCH 03/26] fix(pkg): move python-pywal to optdepends in PKGBUILD python-pywal is AUR-only; makepkg cannot resolve it as a hard depends. Co-Authored-By: Claude Sonnet 4.6 --- packaging/arch/PKGBUILD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index aaeafc4..7f20f48 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -8,8 +8,9 @@ arch=('x86_64') url="https://github.com/Breadway/breadpaper" license=('MIT') options=(!lto !debug) -depends=('glibc' 'python-pywal') +depends=('glibc') optdepends=( + 'python-pywal: colour palette generation from wallpaper (AUR)' 'awww: Wayland wallpaper daemon' ) makedepends=('rust' 'cargo') From 580a51c3500602b2f7508fc4ee1a73d2145e82b4 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:16:44 +0800 Subject: [PATCH 04/26] fix(pkg): move python-pywal to optdepends in PKGBUILD python-pywal is AUR-only; makepkg cannot resolve it as a hard depends. --- packaging/arch/PKGBUILD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index aaeafc4..7f20f48 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -8,8 +8,9 @@ arch=('x86_64') url="https://github.com/Breadway/breadpaper" license=('MIT') options=(!lto !debug) -depends=('glibc' 'python-pywal') +depends=('glibc') optdepends=( + 'python-pywal: colour palette generation from wallpaper (AUR)' 'awww: Wayland wallpaper daemon' ) makedepends=('rust' 'cargo') From 44287fe83a3b4a45e03214e885d573d7f96b6b3f Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:35:41 +0800 Subject: [PATCH 05/26] debug: print git config and env in mirror step --- .forgejo/workflows/mirror.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 01e1dad..6c45f3d 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -12,6 +12,9 @@ jobs: - name: Mirror to GitHub run: | set -euo pipefail + echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" + echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" + git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites)" git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ From 8e1f0babb8deaa111dac5f267f043c295c3752c7 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:35:41 +0800 Subject: [PATCH 06/26] debug: print git config and env in mirror step --- .forgejo/workflows/mirror.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 01e1dad..6c45f3d 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -12,6 +12,9 @@ jobs: - name: Mirror to GitHub run: | set -euo pipefail + echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" + echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" + git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites)" git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ From 758112d93f14d6196e19b64e13f694b35b5640cb Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:38:34 +0800 Subject: [PATCH 07/26] debug: add git env and system config inspection --- .forgejo/workflows/mirror.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 6c45f3d..53b0502 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -14,7 +14,9 @@ jobs: set -euo pipefail echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites)" + env | grep -iE "^GIT" | sort || echo "(no GIT env vars)" + git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites in global gitconfig)" + git config --list --system 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites in system gitconfig)" git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ From 4aad0afeac8d0e38c2906ee0c26371bf2a81706c Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:38:34 +0800 Subject: [PATCH 08/26] debug: add git env and system config inspection --- .forgejo/workflows/mirror.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 6c45f3d..53b0502 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -14,7 +14,9 @@ jobs: set -euo pipefail echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites)" + env | grep -iE "^GIT" | sort || echo "(no GIT env vars)" + git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites in global gitconfig)" + git config --list --system 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites in system gitconfig)" git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ From 428c3cc566948cbbd15d9049b8d2f3fe95c54062 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:39:30 +0800 Subject: [PATCH 09/26] debug: inspect workspace git config --- .forgejo/workflows/mirror.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 53b0502..2e8fe90 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -14,9 +14,10 @@ jobs: set -euo pipefail echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - env | grep -iE "^GIT" | sort || echo "(no GIT env vars)" - git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites in global gitconfig)" - git config --list --system 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites in system gitconfig)" + echo "=== workspace git config ===" + cat "${GITHUB_WORKSPACE}/.git/config" 2>/dev/null || echo "(no workspace .git/config)" + echo "=== all git config ===" + git config --list 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites anywhere)" git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ From 2d0d9728b26386d2ccb740abc385dbfdc8259e34 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:39:30 +0800 Subject: [PATCH 10/26] debug: inspect workspace git config --- .forgejo/workflows/mirror.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 53b0502..2e8fe90 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -14,9 +14,10 @@ jobs: set -euo pipefail echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - env | grep -iE "^GIT" | sort || echo "(no GIT env vars)" - git config --list --global | grep -E "url|insteadOf" || echo "(no url rewrites in global gitconfig)" - git config --list --system 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites in system gitconfig)" + echo "=== workspace git config ===" + cat "${GITHUB_WORKSPACE}/.git/config" 2>/dev/null || echo "(no workspace .git/config)" + echo "=== all git config ===" + git config --list 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites anywhere)" git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ From 7f87ef311c80a218bd0eb612090ffca652ce2bcc Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:40:22 +0800 Subject: [PATCH 11/26] debug: GIT_CURL_VERBOSE trace --- .forgejo/workflows/mirror.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 2e8fe90..bdf4f7d 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -14,11 +14,7 @@ jobs: set -euo pipefail echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - echo "=== workspace git config ===" - cat "${GITHUB_WORKSPACE}/.git/config" 2>/dev/null || echo "(no workspace .git/config)" - echo "=== all git config ===" - git config --list 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites anywhere)" - git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git + GIT_CURL_VERBOSE=1 git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git 2>&1 | head -40 || true cd repo.git git push --prune \ "https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadpaper.git" \ From 19e660937f2a9a53ab424524389fd4980301c256 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:40:22 +0800 Subject: [PATCH 12/26] debug: GIT_CURL_VERBOSE trace --- .forgejo/workflows/mirror.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index 2e8fe90..bdf4f7d 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -14,11 +14,7 @@ jobs: set -euo pipefail echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - echo "=== workspace git config ===" - cat "${GITHUB_WORKSPACE}/.git/config" 2>/dev/null || echo "(no workspace .git/config)" - echo "=== all git config ===" - git config --list 2>/dev/null | grep -E "url|insteadOf" || echo "(no url rewrites anywhere)" - git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git + GIT_CURL_VERBOSE=1 git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git 2>&1 | head -40 || true cd repo.git git push --prune \ "https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadpaper.git" \ From 0ee60d179cc3b1a42e81ab3a9de1aba6b629aa13 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:45:56 +0800 Subject: [PATCH 13/26] fix: move release workflow to Forgejo, add LICENSE release.yml moves from .github/ to .forgejo/ so it runs directly on the hestia runner without needing the GitHub mirror. GitHub upload step dropped; bakery uses dl.breadway.dev as primary. LICENSE added to fix PKGBUILD package() failure. Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/mirror.yml | 4 +--- {.github => .forgejo}/workflows/release.yml | 16 ---------------- LICENSE | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 19 deletions(-) rename {.github => .forgejo}/workflows/release.yml (70%) create mode 100644 LICENSE diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index bdf4f7d..01e1dad 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -12,9 +12,7 @@ jobs: - name: Mirror to GitHub run: | set -euo pipefail - echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" - echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - GIT_CURL_VERBOSE=1 git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git 2>&1 | head -40 || true + git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ "https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadpaper.git" \ diff --git a/.github/workflows/release.yml b/.forgejo/workflows/release.yml similarity index 70% rename from .github/workflows/release.yml rename to .forgejo/workflows/release.yml index fe0f52d..50a0bd7 100644 --- a/.github/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -4,9 +4,6 @@ on: push: tags: ["v*"] -permissions: - contents: write - env: DL_DIR: /srv/breadway-dl ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem @@ -46,16 +43,3 @@ jobs: - name: regenerate index.json run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" - - - name: upload to GitHub Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION="${GITHUB_REF_NAME#v}" - PKG_DIR="${DL_DIR}/breadpaper/${VERSION}" - gh release create "${GITHUB_REF_NAME}" \ - --title "breadpaper v${VERSION}" --generate-notes 2>/dev/null || true - gh release upload "${GITHUB_REF_NAME}" \ - "${PKG_DIR}/breadpaper-x86_64" \ - "${PKG_DIR}/breadpaper-x86_64.sha256" \ - --clobber diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..373e4ee --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Breadway + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 4bb2fd43ca3edc97a9ff23bc20cdbef9625cd7e5 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:45:56 +0800 Subject: [PATCH 14/26] fix: move release workflow to Forgejo, add LICENSE release.yml moves from .github/ to .forgejo/ so it runs directly on the hestia runner without needing the GitHub mirror. GitHub upload step dropped; bakery uses dl.breadway.dev as primary. LICENSE added to fix PKGBUILD package() failure. --- .forgejo/workflows/mirror.yml | 4 +--- {.github => .forgejo}/workflows/release.yml | 16 ---------------- LICENSE | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 19 deletions(-) rename {.github => .forgejo}/workflows/release.yml (70%) create mode 100644 LICENSE diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml index bdf4f7d..01e1dad 100644 --- a/.forgejo/workflows/mirror.yml +++ b/.forgejo/workflows/mirror.yml @@ -12,9 +12,7 @@ jobs: - name: Mirror to GitHub run: | set -euo pipefail - echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" - echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-unset}" - GIT_CURL_VERBOSE=1 git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git 2>&1 | head -40 || true + git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git cd repo.git git push --prune \ "https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadpaper.git" \ diff --git a/.github/workflows/release.yml b/.forgejo/workflows/release.yml similarity index 70% rename from .github/workflows/release.yml rename to .forgejo/workflows/release.yml index fe0f52d..50a0bd7 100644 --- a/.github/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -4,9 +4,6 @@ on: push: tags: ["v*"] -permissions: - contents: write - env: DL_DIR: /srv/breadway-dl ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem @@ -46,16 +43,3 @@ jobs: - name: regenerate index.json run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" - - - name: upload to GitHub Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION="${GITHUB_REF_NAME#v}" - PKG_DIR="${DL_DIR}/breadpaper/${VERSION}" - gh release create "${GITHUB_REF_NAME}" \ - --title "breadpaper v${VERSION}" --generate-notes 2>/dev/null || true - gh release upload "${GITHUB_REF_NAME}" \ - "${PKG_DIR}/breadpaper-x86_64" \ - "${PKG_DIR}/breadpaper-x86_64.sha256" \ - --clobber diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..373e4ee --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Breadway + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 04927b773bba6e7a8b78c7a8fe8c4fa9489ff5c7 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:49:06 +0800 Subject: [PATCH 15/26] fix(ci): replace actions/checkout with manual git clone in release actions/checkout uses GITHUB_SERVER_URL=http://localhost:3002 which is unreachable from inside the Docker container. Use the public Forgejo URL directly, matching the pattern used by package.yml. Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 50a0bd7..f85b60b 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -12,7 +12,10 @@ jobs: build: runs-on: [self-hosted, hestia] steps: - - uses: actions/checkout@v4 + - name: checkout + run: | + git clone --branch "${GITHUB_REF_NAME}" --depth 1 \ + "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" . - name: build run: cargo build --release --locked From ca843bf2556c5ac4b7e7b97d47badd4faad51718 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:49:06 +0800 Subject: [PATCH 16/26] fix(ci): replace actions/checkout with manual git clone in release actions/checkout uses GITHUB_SERVER_URL=http://localhost:3002 which is unreachable from inside the Docker container. Use the public Forgejo URL directly, matching the pattern used by package.yml. --- .forgejo/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 50a0bd7..f85b60b 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -12,7 +12,10 @@ jobs: build: runs-on: [self-hosted, hestia] steps: - - uses: actions/checkout@v4 + - name: checkout + run: | + git clone --branch "${GITHUB_REF_NAME}" --depth 1 \ + "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" . - name: build run: cargo build --release --locked From 53b12f6a5b9c5986ffbc3c11df3eb8b033e236ce Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:54:59 +0800 Subject: [PATCH 17/26] fix(ci): run release job on hestia host to access cargo and dl server hestia-host maps to host execution on the Forgejo runner, giving access to /home/breadway/.cargo/bin/cargo and /srv/breadway-dl without Docker. Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index f85b60b..c374bf6 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -10,7 +10,7 @@ env: jobs: build: - runs-on: [self-hosted, hestia] + runs-on: hestia-host steps: - name: checkout run: | From 2d0cdae3962e6941e3529dee314c0c0549908811 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:54:59 +0800 Subject: [PATCH 18/26] fix(ci): run release job on hestia host to access cargo and dl server hestia-host maps to host execution on the Forgejo runner, giving access to /home/breadway/.cargo/bin/cargo and /srv/breadway-dl without Docker. --- .forgejo/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index f85b60b..c374bf6 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -10,7 +10,7 @@ env: jobs: build: - runs-on: [self-hosted, hestia] + runs-on: hestia-host steps: - name: checkout run: | From 861d29646242a2116268668ee011a0e87b320080 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 18:54:32 +0800 Subject: [PATCH 19/26] fix(ci): add cargo to PATH for host runner Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index c374bf6..384b829 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -7,6 +7,7 @@ on: env: DL_DIR: /srv/breadway-dl ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin jobs: build: From 014fd9c12e367df99729683d2256edc607ee36af Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 18:54:32 +0800 Subject: [PATCH 20/26] fix(ci): add cargo to PATH for host runner --- .forgejo/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index c374bf6..384b829 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -7,6 +7,7 @@ on: env: DL_DIR: /srv/breadway-dl ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin jobs: build: From cb558efdccd6d3b5f16f460814774ef87b3daf30 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 19:09:15 +0800 Subject: [PATCH 21/26] fix(ci): clone to /tmp to avoid stale work-dir permissions, use hestia label Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/release.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 384b829..cd57261 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -11,18 +11,24 @@ env: jobs: build: - runs-on: hestia-host + runs-on: hestia + defaults: + run: + working-directory: /tmp/breadpaper-build + steps: - name: checkout + working-directory: /tmp run: | + rm -rf /tmp/breadpaper-build git clone --branch "${GITHUB_REF_NAME}" --depth 1 \ - "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" . + "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" /tmp/breadpaper-build - name: build - run: cargo build --release --locked + run: /home/breadway/.cargo/bin/cargo build --release --locked - name: test - run: cargo test --release --locked + run: /home/breadway/.cargo/bin/cargo test --release --locked - name: prepare artifacts run: | @@ -37,6 +43,7 @@ jobs: ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest" - name: ensure bread-ecosystem + working-directory: /tmp run: | if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then git -C "${ECOSYSTEM_DIR}" pull --ff-only @@ -46,4 +53,5 @@ jobs: fi - name: regenerate index.json + working-directory: /tmp run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" From b064e86f2f793239b2004c21c4c46809ee347321 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 19:09:15 +0800 Subject: [PATCH 22/26] fix(ci): clone to /tmp to avoid stale work-dir permissions, use hestia label --- .forgejo/workflows/release.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 384b829..cd57261 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -11,18 +11,24 @@ env: jobs: build: - runs-on: hestia-host + runs-on: hestia + defaults: + run: + working-directory: /tmp/breadpaper-build + steps: - name: checkout + working-directory: /tmp run: | + rm -rf /tmp/breadpaper-build git clone --branch "${GITHUB_REF_NAME}" --depth 1 \ - "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" . + "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" /tmp/breadpaper-build - name: build - run: cargo build --release --locked + run: /home/breadway/.cargo/bin/cargo build --release --locked - name: test - run: cargo test --release --locked + run: /home/breadway/.cargo/bin/cargo test --release --locked - name: prepare artifacts run: | @@ -37,6 +43,7 @@ jobs: ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest" - name: ensure bread-ecosystem + working-directory: /tmp run: | if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then git -C "${ECOSYSTEM_DIR}" pull --ff-only @@ -46,4 +53,5 @@ jobs: fi - name: regenerate index.json + working-directory: /tmp run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" From 1b8830eab335623ba9cbfe34f1038cb41638c791 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 22:44:48 +0800 Subject: [PATCH 23/26] fix: correct awww subcommand to img, support bare path arg, add --version Co-Authored-By: Claude Sonnet 4.6 --- src/main.rs | 16 ++++++++++------ src/wallpaper.rs | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 38d3fc6..d108e3d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,17 +4,19 @@ use std::process; use clap::{Parser, Subcommand}; #[derive(Parser)] -#[command(name = "breadpaper", about = "Wallpaper manager for the bread desktop")] +#[command(name = "breadpaper", version, about = "Wallpaper manager for the bread desktop")] struct Cli { + /// Image file to set as wallpaper (shorthand for `set`) + path: Option, + #[command(subcommand)] - command: Command, + command: Option, } #[derive(Subcommand)] enum Command { /// Set wallpaper, generate pywal palette, and reload bread themes Set { - /// Path to the image file path: PathBuf, }, /// Print the current wallpaper path @@ -24,9 +26,11 @@ enum Command { fn main() { let cli = Cli::parse(); - let result = match cli.command { - Command::Set { path } => breadpaper::set(&path), - Command::Get => breadpaper::get().map(|p| println!("{}", p.display())), + let result = match (cli.command, cli.path) { + (Some(Command::Set { path }), _) | (None, Some(path)) => breadpaper::set(&path), + (Some(Command::Get), _) | (None, None) => { + breadpaper::get().map(|p| println!("{}", p.display())) + } }; if let Err(e) = result { diff --git a/src/wallpaper.rs b/src/wallpaper.rs index 4655308..f59fae1 100644 --- a/src/wallpaper.rs +++ b/src/wallpaper.rs @@ -5,13 +5,13 @@ use anyhow::{Context, Result, bail}; pub fn apply(path: &Path) -> Result<()> { let status = Command::new("awww") - .arg("set") + .arg("img") .arg(path) .status() .context("failed to run awww — is awww-daemon running?")?; if !status.success() { - bail!("awww set exited with {}", status); + bail!("awww img exited with {}", status); } Ok(()) } From 5c9efcf316fc1fac08c9290ec165d9b6290146c0 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 22:44:48 +0800 Subject: [PATCH 24/26] fix: correct awww subcommand to img, support bare path arg, add --version --- src/main.rs | 16 ++++++++++------ src/wallpaper.rs | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 38d3fc6..d108e3d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,17 +4,19 @@ use std::process; use clap::{Parser, Subcommand}; #[derive(Parser)] -#[command(name = "breadpaper", about = "Wallpaper manager for the bread desktop")] +#[command(name = "breadpaper", version, about = "Wallpaper manager for the bread desktop")] struct Cli { + /// Image file to set as wallpaper (shorthand for `set`) + path: Option, + #[command(subcommand)] - command: Command, + command: Option, } #[derive(Subcommand)] enum Command { /// Set wallpaper, generate pywal palette, and reload bread themes Set { - /// Path to the image file path: PathBuf, }, /// Print the current wallpaper path @@ -24,9 +26,11 @@ enum Command { fn main() { let cli = Cli::parse(); - let result = match cli.command { - Command::Set { path } => breadpaper::set(&path), - Command::Get => breadpaper::get().map(|p| println!("{}", p.display())), + let result = match (cli.command, cli.path) { + (Some(Command::Set { path }), _) | (None, Some(path)) => breadpaper::set(&path), + (Some(Command::Get), _) | (None, None) => { + breadpaper::get().map(|p| println!("{}", p.display())) + } }; if let Err(e) = result { diff --git a/src/wallpaper.rs b/src/wallpaper.rs index 4655308..f59fae1 100644 --- a/src/wallpaper.rs +++ b/src/wallpaper.rs @@ -5,13 +5,13 @@ use anyhow::{Context, Result, bail}; pub fn apply(path: &Path) -> Result<()> { let status = Command::new("awww") - .arg("set") + .arg("img") .arg(path) .status() .context("failed to run awww — is awww-daemon running?")?; if !status.success() { - bail!("awww set exited with {}", status); + bail!("awww img exited with {}", status); } Ok(()) } From a7749506883f4151cc8d43edee5cf0b2107e76cb Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 22:53:08 +0800 Subject: [PATCH 25/26] fix(ci): clone bread-ecosystem to /tmp to avoid stale permissions Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/release.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index cd57261..ff3f0c2 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -6,7 +6,7 @@ on: env: DL_DIR: /srv/breadway-dl - ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin jobs: @@ -45,12 +45,8 @@ jobs: - name: ensure bread-ecosystem working-directory: /tmp run: | - if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then - git -C "${ECOSYSTEM_DIR}" pull --ff-only - else - mkdir -p "$(dirname "${ECOSYSTEM_DIR}")" - git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" - fi + rm -rf "${ECOSYSTEM_DIR}" + git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" - name: regenerate index.json working-directory: /tmp From 1b4f9c5c044276e86731462fe32d9b33067931d3 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 22:53:08 +0800 Subject: [PATCH 26/26] fix(ci): clone bread-ecosystem to /tmp to avoid stale permissions --- .forgejo/workflows/release.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index cd57261..ff3f0c2 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -6,7 +6,7 @@ on: env: DL_DIR: /srv/breadway-dl - ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin jobs: @@ -45,12 +45,8 @@ jobs: - name: ensure bread-ecosystem working-directory: /tmp run: | - if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then - git -C "${ECOSYSTEM_DIR}" pull --ff-only - else - mkdir -p "$(dirname "${ECOSYSTEM_DIR}")" - git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" - fi + rm -rf "${ECOSYSTEM_DIR}" + git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" - name: regenerate index.json working-directory: /tmp