initial config generation to main file

This commit is contained in:
Benjamyn Love 2024-03-10 22:26:02 +11:00
parent d7c70583c0
commit 502f1e89a5
4 changed files with 11 additions and 11 deletions

View File

@ -4,7 +4,7 @@ use core::fmt;
use crate::enums::*;
use untildify;
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Monitors {
pub monitors: Vec<MonitorType>,
}
@ -29,7 +29,7 @@ impl fmt::Display for Monitors {
}
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct WallpaperDir {
ultrawide: String,
horizontal: String,
@ -68,7 +68,7 @@ impl fmt::Display for WallpaperDir {
}
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Config {
pub x_server: String,
pub wallpaper_engine: WallpaperHandler,

View File

@ -1,6 +1,6 @@
use core::fmt;
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum WallpaperHandler {
Feh,
Plasma,

View File

@ -6,7 +6,7 @@ use std::fmt::Write as _;
use crate::config::*;
use crate::enums::*;
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Wallpaper {
path: String,
}
@ -23,7 +23,7 @@ impl fmt::Display for Wallpaper {
}
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Wallpapers {
ultrawide: Vec<Wallpaper>,
horizontal: Vec<Wallpaper>,
@ -32,14 +32,12 @@ pub struct Wallpapers {
}
impl Wallpapers {
pub fn new() -> Wallpapers {
pub fn new(config: Config) -> Wallpapers {
Wallpapers {
ultrawide: vec![],
horizontal: vec![],
vertical: vec![],
config: Config::from_config(
"/home/ben/.config/wallpaperctl/wallpaperctl.ini".to_owned(),
),
config,
}
}

View File

@ -1,11 +1,13 @@
mod config;
use config::*;
mod enums;
mod files;
use files::*;
mod handlers;
fn main() {
let mut wallpapers = Wallpapers::new();
let config = Config::from_config("/home/ben/.config/wallpaperctl/wallpaperctl.ini".to_owned());
let mut wallpapers = Wallpapers::new(config.clone());
wallpapers.load_all();
handlers::plasma::change_wallpapers(&wallpapers);