Implemented main script logic
This commit is contained in:
parent
502f1e89a5
commit
5a2fb02d9b
5
src/handlers/feh.rs
Normal file
5
src/handlers/feh.rs
Normal file
@ -0,0 +1,5 @@
|
||||
use crate::Wallpapers;
|
||||
|
||||
pub fn change_wallpapers(wallpapers: &Wallpapers) {
|
||||
println!("Not implemented");
|
||||
}
|
||||
5
src/handlers/gnome.rs
Normal file
5
src/handlers/gnome.rs
Normal file
@ -0,0 +1,5 @@
|
||||
use crate::Wallpapers;
|
||||
|
||||
pub fn change_wallpapers(wallpapers: &Wallpapers) {
|
||||
println!("Not implemented");
|
||||
}
|
||||
@ -2,3 +2,7 @@ pub mod dbus_plasma_interface;
|
||||
use dbus_plasma_interface::*;
|
||||
pub mod plasma;
|
||||
use plasma::*;
|
||||
pub mod feh;
|
||||
use feh::*;
|
||||
pub mod gnome;
|
||||
use gnome::*;
|
||||
|
||||
22
src/main.rs
22
src/main.rs
@ -2,13 +2,35 @@ mod config;
|
||||
use config::*;
|
||||
mod enums;
|
||||
mod files;
|
||||
use enums::WallpaperHandler;
|
||||
use files::*;
|
||||
mod handlers;
|
||||
|
||||
fn main() {
|
||||
// Load the config file from the default path
|
||||
// TODO: Have this load from the users home directory
|
||||
let config = Config::from_config("/home/ben/.config/wallpaperctl/wallpaperctl.ini".to_owned());
|
||||
|
||||
// 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;
|
||||
match wallpaper_engine {
|
||||
WallpaperHandler::Plasma => {
|
||||
handlers::plasma::change_wallpapers(&wallpapers);
|
||||
}
|
||||
WallpaperHandler::Feh => {
|
||||
handlers::feh::change_wallpapers(&wallpapers);
|
||||
}
|
||||
WallpaperHandler::Gnome => {
|
||||
handlers::gnome::change_wallpapers(&wallpapers);
|
||||
}
|
||||
_ => {
|
||||
println!("Error: Unknown wallpaper engine");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user