Implemented main script logic

This commit is contained in:
benjamyn committed 2024-03-10 22:35:32 +11:00
1 parent 502f1e89a5
commit 5a2fb02d9b
4 files changed
+37 -1

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
use crate::Wallpapers;
pub fn change_wallpapers(wallpapers: &Wallpapers) {
println!("Not implemented");
}
+5
View File
@@ -0,0 +1,5 @@
use crate::Wallpapers;
pub fn change_wallpapers(wallpapers: &Wallpapers) {
println!("Not implemented");
}
+4
View File
@@ -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::*;
+23 -1
View File
@@ -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");
}
}
}