1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use std::path::PathBuf;
use clap::{Parser, Subcommand, ValueEnum};
/// All-in-one tool for Apple dynamic HEIF wallpapers on GNU/Linux.
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct Args {
/// Action subcommand
#[command(subcommand)]
pub action: Action,
/// Control output verbosity
#[clap(flatten)]
pub verbose: clap_verbosity_flag::Verbosity,
}
/// Main action subcommands
#[derive(Subcommand, Debug)]
pub enum Action {
/// Print out wallpaper info
Info {
/// Path to HEIF wallpaper file
file: PathBuf,
},
/// Quickly cycle through all images in the wallpaper
Preview {
/// Path to HEIF wallpaper file
file: PathBuf,
/// Delay between wallpaper changes in milliseconds
#[arg(short, long, default_value_t = 500)]
delay: u64,
/// Repeat the preview in a loop until killed
#[arg(short, long, action)]
repeat: bool,
},
/// Extract all images and metadata from HEIF wallpaper to a directory
Unpack {
/// Path to HEIF wallpaper file
file: PathBuf,
/// Path to output directory
output: PathBuf,
},
/// Set the wallpaper
Set {
/// Path to HEIF wallpaper file
file: Option<PathBuf>,
/// Run continuously and update the wallpaper as time passes
#[arg(short, long, action)]
daemon: bool,
/// Use light or dark variant
#[arg(short, long, value_enum)]
appearance: Option<Appearance>,
},
/// Clear the wallpaper cache
Clear {
/// Clear all - do not skip the currently set wallpaper
#[arg(short, long, action)]
all: bool,
},
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)]
pub enum Appearance {
Light,
Dark,
}