Compare commits

..

2 commits

Author SHA1 Message Date
Breadway
1b8830eab3 fix: correct awww subcommand to img, support bare path arg, add --version
Some checks failed
Mirror to GitHub / mirror (push) Failing after 2s
release / build (push) Failing after 6s
Build and publish package / package (push) Failing after 39s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 22:44:48 +08:00
Breadway
cb558efdcc fix(ci): clone to /tmp to avoid stale work-dir permissions, use hestia label
Some checks failed
Mirror to GitHub / mirror (push) Failing after 1s
release / build (push) Failing after 6s
Build and publish package / package (push) Failing after 38s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 19:09:15 +08:00
3 changed files with 24 additions and 12 deletions

View file

@ -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"

View file

@ -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<PathBuf>,
#[command(subcommand)]
command: Command,
command: Option<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
@ -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 {

View file

@ -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(())
}