diff --git a/src/handlers/feh.rs b/src/handlers/feh.rs new file mode 100644 index 0000000..6bd39cc --- /dev/null +++ b/src/handlers/feh.rs @@ -0,0 +1,5 @@ +use crate::Wallpapers; + +pub fn change_wallpapers(wallpapers: &Wallpapers) { + println!("Not implemented"); +} diff --git a/src/handlers/gnome.rs b/src/handlers/gnome.rs new file mode 100644 index 0000000..6bd39cc --- /dev/null +++ b/src/handlers/gnome.rs @@ -0,0 +1,5 @@ +use crate::Wallpapers; + +pub fn change_wallpapers(wallpapers: &Wallpapers) { + println!("Not implemented"); +} diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 880d104..027a7d3 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -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::*; diff --git a/src/main.rs b/src/main.rs index c0d7a56..9479586 100644 --- a/src/main.rs +++ b/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(); - handlers::plasma::change_wallpapers(&wallpapers); + + // 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"); + } + } }