44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
mod config;
|
|
use config::*;
|
|
mod enums;
|
|
mod files;
|
|
use enums::WallpaperHandler;
|
|
use files::*;
|
|
mod handlers;
|
|
mod lib;
|
|
|
|
use untildify::untildify;
|
|
|
|
fn main() {
|
|
// Load the config file from the default path
|
|
let path = untildify("~/.config/wallpaperctl/wallpaperctl.ini");
|
|
let config = Config::from_config(path);
|
|
|
|
// Initialise the `Wallpapers` struct with a clone of the config
|
|
let mut wallpapers = Wallpapers::new(config.clone());
|
|
|
|
// Load all wallpapers based on the config file specs
|
|
wallpapers.load_all();
|
|
|
|
// Check the configured Wallpaper engine and run the change_wallpapers() method from the respective handlers
|
|
let wallpaper_engine = config.wallpaper_engine;
|
|
// println!("{:?}", &wallpapers);
|
|
match wallpaper_engine {
|
|
WallpaperHandler::Plasma => {
|
|
handlers::plasma::change_wallpapers(&wallpapers);
|
|
}
|
|
WallpaperHandler::Feh => {
|
|
handlers::feh::change_wallpapers(&wallpapers);
|
|
}
|
|
WallpaperHandler::Gnome => {
|
|
handlers::gnome::change_wallpapers(&wallpapers);
|
|
}
|
|
WallpaperHandler::Hyprpaper => {
|
|
handlers::hyprpaper::change_wallpapers(&wallpapers);
|
|
}
|
|
_ => {
|
|
println!("Error: Unknown wallpaper engine");
|
|
}
|
|
}
|
|
}
|