Compare commits

..

No commits in common. "1b8830eab335623ba9cbfe34f1038cb41638c791" and "861d29646242a2116268668ee011a0e87b320080" have entirely different histories.

3 changed files with 12 additions and 24 deletions

View file

@ -11,24 +11,18 @@ env:
jobs: jobs:
build: build:
runs-on: hestia runs-on: hestia-host
defaults:
run:
working-directory: /tmp/breadpaper-build
steps: steps:
- name: checkout - name: checkout
working-directory: /tmp
run: | run: |
rm -rf /tmp/breadpaper-build
git clone --branch "${GITHUB_REF_NAME}" --depth 1 \ git clone --branch "${GITHUB_REF_NAME}" --depth 1 \
"https://git.breadway.dev/${GITHUB_REPOSITORY}.git" /tmp/breadpaper-build "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" .
- name: build - name: build
run: /home/breadway/.cargo/bin/cargo build --release --locked run: cargo build --release --locked
- name: test - name: test
run: /home/breadway/.cargo/bin/cargo test --release --locked run: cargo test --release --locked
- name: prepare artifacts - name: prepare artifacts
run: | run: |
@ -43,7 +37,6 @@ jobs:
ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest" ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest"
- name: ensure bread-ecosystem - name: ensure bread-ecosystem
working-directory: /tmp
run: | run: |
if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then
git -C "${ECOSYSTEM_DIR}" pull --ff-only git -C "${ECOSYSTEM_DIR}" pull --ff-only
@ -53,5 +46,4 @@ jobs:
fi fi
- name: regenerate index.json - name: regenerate index.json
working-directory: /tmp
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"

View file

@ -4,19 +4,17 @@ use std::process;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
#[derive(Parser)] #[derive(Parser)]
#[command(name = "breadpaper", version, about = "Wallpaper manager for the bread desktop")] #[command(name = "breadpaper", about = "Wallpaper manager for the bread desktop")]
struct Cli { struct Cli {
/// Image file to set as wallpaper (shorthand for `set`)
path: Option<PathBuf>,
#[command(subcommand)] #[command(subcommand)]
command: Option<Command>, command: Command,
} }
#[derive(Subcommand)] #[derive(Subcommand)]
enum Command { enum Command {
/// Set wallpaper, generate pywal palette, and reload bread themes /// Set wallpaper, generate pywal palette, and reload bread themes
Set { Set {
/// Path to the image file
path: PathBuf, path: PathBuf,
}, },
/// Print the current wallpaper path /// Print the current wallpaper path
@ -26,11 +24,9 @@ enum Command {
fn main() { fn main() {
let cli = Cli::parse(); let cli = Cli::parse();
let result = match (cli.command, cli.path) { let result = match cli.command {
(Some(Command::Set { path }), _) | (None, Some(path)) => breadpaper::set(&path), Command::Set { path } => breadpaper::set(&path),
(Some(Command::Get), _) | (None, None) => { Command::Get => breadpaper::get().map(|p| println!("{}", p.display())),
breadpaper::get().map(|p| println!("{}", p.display()))
}
}; };
if let Err(e) = result { if let Err(e) = result {

View file

@ -5,13 +5,13 @@ use anyhow::{Context, Result, bail};
pub fn apply(path: &Path) -> Result<()> { pub fn apply(path: &Path) -> Result<()> {
let status = Command::new("awww") let status = Command::new("awww")
.arg("img") .arg("set")
.arg(path) .arg(path)
.status() .status()
.context("failed to run awww — is awww-daemon running?")?; .context("failed to run awww — is awww-daemon running?")?;
if !status.success() { if !status.success() {
bail!("awww img exited with {}", status); bail!("awww set exited with {}", status);
} }
Ok(()) Ok(())
} }